Skip to content

Commit 8c52b6d

Browse files
committed
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fixes from Thomas Gleixner: - a few simple fixes for fallout from the recent gic-v3 changes - a workaround for a Cavium thunderX erratum - a bugfix for the pic32 irqchip to make external interrupts work proper - a missing return value in the generic IPI management code * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/irq-pic32-evic: Fix bug with external interrupts. irqchip/gicv3-its: numa: Enable workaround for Cavium thunderx erratum 23144 irqchip/gic-v3: Fix quiescence check in gic_enable_redist irqchip/gic-v3: Fix copy+paste mistakes in defines irqchip/gic-v3: Fix ICC_SGI1R_EL1.INTID decoding mask genirq: Fix missing return value in irq_destroy_ipi()
2 parents 2c22132 + 2eec370 commit 8c52b6d

File tree

7 files changed

+63
-8
lines changed

7 files changed

+63
-8
lines changed

Documentation/arm64/silicon-errata.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ stable kernels.
5656
| ARM | MMU-500 | #841119,#826419 | N/A |
5757
| | | | |
5858
| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
59+
| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
5960
| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
6061
| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
6162
| Cavium | ThunderX SMMUv2 | #27704 | N/A |

arch/arm64/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,15 @@ config CAVIUM_ERRATUM_22375
438438

439439
If unsure, say Y.
440440

441+
config CAVIUM_ERRATUM_23144
442+
bool "Cavium erratum 23144: ITS SYNC hang on dual socket system"
443+
depends on NUMA
444+
default y
445+
help
446+
ITS SYNC command hang for cross node io and collections/cpu mapping.
447+
448+
If unsure, say Y.
449+
441450
config CAVIUM_ERRATUM_23154
442451
bool "Cavium erratum 23154: Access to ICC_IAR1_EL1 is not sync'ed"
443452
default y

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0)
4343
#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1)
44+
#define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2)
4445

4546
#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
4647

@@ -82,6 +83,7 @@ struct its_node {
8283
u64 flags;
8384
u32 ite_size;
8485
u32 device_ids;
86+
int numa_node;
8587
};
8688

8789
#define ITS_ITT_ALIGN SZ_256
@@ -613,11 +615,23 @@ static void its_unmask_irq(struct irq_data *d)
613615
static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
614616
bool force)
615617
{
616-
unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
618+
unsigned int cpu;
619+
const struct cpumask *cpu_mask = cpu_online_mask;
617620
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
618621
struct its_collection *target_col;
619622
u32 id = its_get_event_id(d);
620623

624+
/* lpi cannot be routed to a redistributor that is on a foreign node */
625+
if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) {
626+
if (its_dev->its->numa_node >= 0) {
627+
cpu_mask = cpumask_of_node(its_dev->its->numa_node);
628+
if (!cpumask_intersects(mask_val, cpu_mask))
629+
return -EINVAL;
630+
}
631+
}
632+
633+
cpu = cpumask_any_and(mask_val, cpu_mask);
634+
621635
if (cpu >= nr_cpu_ids)
622636
return -EINVAL;
623637

@@ -1101,6 +1115,16 @@ static void its_cpu_init_collection(void)
11011115
list_for_each_entry(its, &its_nodes, entry) {
11021116
u64 target;
11031117

1118+
/* avoid cross node collections and its mapping */
1119+
if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) {
1120+
struct device_node *cpu_node;
1121+
1122+
cpu_node = of_get_cpu_node(cpu, NULL);
1123+
if (its->numa_node != NUMA_NO_NODE &&
1124+
its->numa_node != of_node_to_nid(cpu_node))
1125+
continue;
1126+
}
1127+
11041128
/*
11051129
* We now have to bind each collection to its target
11061130
* redistributor.
@@ -1351,9 +1375,14 @@ static void its_irq_domain_activate(struct irq_domain *domain,
13511375
{
13521376
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
13531377
u32 event = its_get_event_id(d);
1378+
const struct cpumask *cpu_mask = cpu_online_mask;
1379+
1380+
/* get the cpu_mask of local node */
1381+
if (its_dev->its->numa_node >= 0)
1382+
cpu_mask = cpumask_of_node(its_dev->its->numa_node);
13541383

13551384
/* Bind the LPI to the first possible CPU */
1356-
its_dev->event_map.col_map[event] = cpumask_first(cpu_online_mask);
1385+
its_dev->event_map.col_map[event] = cpumask_first(cpu_mask);
13571386

13581387
/* Map the GIC IRQ and event to the device */
13591388
its_send_mapvi(its_dev, d->hwirq, event);
@@ -1443,6 +1472,13 @@ static void __maybe_unused its_enable_quirk_cavium_22375(void *data)
14431472
its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_22375;
14441473
}
14451474

1475+
static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
1476+
{
1477+
struct its_node *its = data;
1478+
1479+
its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
1480+
}
1481+
14461482
static const struct gic_quirk its_quirks[] = {
14471483
#ifdef CONFIG_CAVIUM_ERRATUM_22375
14481484
{
@@ -1451,6 +1487,14 @@ static const struct gic_quirk its_quirks[] = {
14511487
.mask = 0xffff0fff,
14521488
.init = its_enable_quirk_cavium_22375,
14531489
},
1490+
#endif
1491+
#ifdef CONFIG_CAVIUM_ERRATUM_23144
1492+
{
1493+
.desc = "ITS: Cavium erratum 23144",
1494+
.iidr = 0xa100034c, /* ThunderX pass 1.x */
1495+
.mask = 0xffff0fff,
1496+
.init = its_enable_quirk_cavium_23144,
1497+
},
14541498
#endif
14551499
{
14561500
}
@@ -1514,6 +1558,7 @@ static int __init its_probe(struct device_node *node,
15141558
its->base = its_base;
15151559
its->phys_base = res.start;
15161560
its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1;
1561+
its->numa_node = of_node_to_nid(node);
15171562

15181563
its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL);
15191564
if (!its->cmd_base) {

drivers/irqchip/irq-gic-v3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static void gic_enable_redist(bool enable)
155155

156156
while (count--) {
157157
val = readl_relaxed(rbase + GICR_WAKER);
158-
if (enable ^ (val & GICR_WAKER_ChildrenAsleep))
158+
if (enable ^ (bool)(val & GICR_WAKER_ChildrenAsleep))
159159
break;
160160
cpu_relax();
161161
udelay(1);

drivers/irqchip/irq-pic32-evic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int pic32_set_type_edge(struct irq_data *data,
9191
/* set polarity for external interrupts only */
9292
for (i = 0; i < ARRAY_SIZE(priv->ext_irqs); i++) {
9393
if (priv->ext_irqs[i] == data->hwirq) {
94-
ret = pic32_set_ext_polarity(i + 1, flow_type);
94+
ret = pic32_set_ext_polarity(i, flow_type);
9595
if (ret)
9696
return ret;
9797
}

include/linux/irqchip/arm-gic-v3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,12 @@
305305
#define ICC_SGI1R_AFFINITY_1_SHIFT 16
306306
#define ICC_SGI1R_AFFINITY_1_MASK (0xff << ICC_SGI1R_AFFINITY_1_SHIFT)
307307
#define ICC_SGI1R_SGI_ID_SHIFT 24
308-
#define ICC_SGI1R_SGI_ID_MASK (0xff << ICC_SGI1R_SGI_ID_SHIFT)
308+
#define ICC_SGI1R_SGI_ID_MASK (0xfULL << ICC_SGI1R_SGI_ID_SHIFT)
309309
#define ICC_SGI1R_AFFINITY_2_SHIFT 32
310-
#define ICC_SGI1R_AFFINITY_2_MASK (0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT)
310+
#define ICC_SGI1R_AFFINITY_2_MASK (0xffULL << ICC_SGI1R_AFFINITY_2_SHIFT)
311311
#define ICC_SGI1R_IRQ_ROUTING_MODE_BIT 40
312312
#define ICC_SGI1R_AFFINITY_3_SHIFT 48
313-
#define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT)
313+
#define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_3_SHIFT)
314314

315315
#include <asm/arch_gicv3.h>
316316

kernel/irq/ipi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int irq_destroy_ipi(unsigned int irq, const struct cpumask *dest)
125125

126126
domain = data->domain;
127127
if (WARN_ON(domain == NULL))
128-
return;
128+
return -EINVAL;
129129

130130
if (!irq_domain_is_ipi(domain)) {
131131
pr_warn("Trying to destroy a non IPI domain!\n");

0 commit comments

Comments
 (0)