Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 0017387

Browse files
committed
Merge tag 'irq-core-2023-06-26' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner: "Updates for the interrupt subsystem: Core: - Convert the interrupt descriptor storage to a maple tree to overcome the limitations of the radixtree + fixed size bitmap. This allows us to handle very large servers with a huge number of guests without imposing a huge memory overhead on everyone - Implement optional retriggering of interrupts which utilize the fasteoi handler to work around a GICv3 architecture issue Drivers: - A set of fixes and updates for the Loongson/Loongarch related drivers - Workaound for an ASR8601 integration hickup which ends up with CPU numbering which can't be represented in the GIC implementation - The usual set of boring fixes and updates all over the place" * tag 'irq-core-2023-06-26' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits) Revert "irqchip/mxs: Include linux/irqchip/mxs.h" irqchip/jcore-aic: Fix missing allocation of IRQ descriptors irqchip/stm32-exti: Fix warning on initialized field overwritten irqchip/stm32-exti: Add STM32MP15xx IWDG2 EXTI to GIC map irqchip/gicv3: Add a iort_pmsi_get_dev_id() prototype irqchip/mxs: Include linux/irqchip/mxs.h irqchip/clps711x: Remove unused clps711x_intc_init() function irqchip/mmp: Remove non-DT codepath irqchip/ftintc010: Mark all function static irqdomain: Include internals.h for function prototypes irqchip/loongson-eiointc: Add DT init support dt-bindings: interrupt-controller: Add Loongson EIOINTC irqchip/loongson-eiointc: Fix irq affinity setting during resume irqchip/loongson-liointc: Add IRQCHIP_SKIP_SET_WAKE flag irqchip/loongson-liointc: Fix IRQ trigger polarity irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment irqchip/loongson-pch-pic: Fix initialization of HT vector register irqchip/gic-v3-its: Enable RESEND_WHEN_IN_PROGRESS for LPIs genirq: Allow fasteoi handler to resend interrupts on concurrent handling genirq: Expand doc for PENDING and REPLAY flags ...
2 parents cef2dd7 + f121ab7 commit 0017387

23 files changed

+384
-297
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,7 @@ stable kernels.
214214
+----------------+-----------------+-----------------+-----------------------------+
215215
| Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 |
216216
+----------------+-----------------+-----------------+-----------------------------+
217+
218+
+----------------+-----------------+-----------------+-----------------------------+
219+
| ASR | ASR8601 | #8601001 | N/A |
220+
+----------------+-----------------+-----------------+-----------------------------+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/interrupt-controller/loongson,eiointc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson Extended I/O Interrupt Controller
8+
9+
maintainers:
10+
- Binbin Zhou <[email protected]>
11+
12+
description: |
13+
This interrupt controller is found on the Loongson-3 family chips and
14+
Loongson-2K series chips and is used to distribute interrupts directly to
15+
individual cores without forwarding them through the HT's interrupt line.
16+
17+
allOf:
18+
- $ref: /schemas/interrupt-controller.yaml#
19+
20+
properties:
21+
compatible:
22+
enum:
23+
- loongson,ls2k0500-eiointc
24+
- loongson,ls2k2000-eiointc
25+
26+
reg:
27+
maxItems: 1
28+
29+
interrupts:
30+
maxItems: 1
31+
32+
interrupt-controller: true
33+
34+
'#interrupt-cells':
35+
const: 1
36+
37+
required:
38+
- compatible
39+
- reg
40+
- interrupts
41+
- interrupt-controller
42+
- '#interrupt-cells'
43+
44+
unevaluatedProperties: false
45+
46+
examples:
47+
- |
48+
eiointc: interrupt-controller@1fe11600 {
49+
compatible = "loongson,ls2k0500-eiointc";
50+
reg = <0x1fe10000 0x10000>;
51+
52+
interrupt-controller;
53+
#interrupt-cells = <1>;
54+
55+
interrupt-parent = <&cpuintc>;
56+
interrupts = <3>;
57+
};
58+
59+
...

drivers/irqchip/irq-clps711x.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,6 @@ static int __init _clps711x_intc_init(struct device_node *np,
212212
return err;
213213
}
214214

215-
void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
216-
{
217-
BUG_ON(_clps711x_intc_init(NULL, base, size));
218-
}
219-
220-
#ifdef CONFIG_IRQCHIP
221215
static int __init clps711x_intc_init_dt(struct device_node *np,
222216
struct device_node *parent)
223217
{
@@ -231,4 +225,3 @@ static int __init clps711x_intc_init_dt(struct device_node *np,
231225
return _clps711x_intc_init(np, res.start, resource_size(&res));
232226
}
233227
IRQCHIP_DECLARE(clps711x, "cirrus,ep7209-intc", clps711x_intc_init_dt);
234-
#endif

drivers/irqchip/irq-ftintc010.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static struct irq_chip ft010_irq_chip = {
125125
/* Local static for the IRQ entry call */
126126
static struct ft010_irq_data firq;
127127

128-
asmlinkage void __exception_irq_entry ft010_irqchip_handle_irq(struct pt_regs *regs)
128+
static asmlinkage void __exception_irq_entry ft010_irqchip_handle_irq(struct pt_regs *regs)
129129
{
130130
struct ft010_irq_data *f = &firq;
131131
int irq;
@@ -162,7 +162,7 @@ static const struct irq_domain_ops ft010_irqdomain_ops = {
162162
.xlate = irq_domain_xlate_onetwocell,
163163
};
164164

165-
int __init ft010_of_init_irq(struct device_node *node,
165+
static int __init ft010_of_init_irq(struct device_node *node,
166166
struct device_node *parent)
167167
{
168168
struct ft010_irq_data *f = &firq;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,6 +3585,7 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
35853585
irqd = irq_get_irq_data(virq + i);
35863586
irqd_set_single_target(irqd);
35873587
irqd_set_affinity_on_activate(irqd);
3588+
irqd_set_resend_when_in_progress(irqd);
35883589
pr_debug("ID:%d pID:%d vID:%d\n",
35893590
(int)(hwirq + i - its_dev->event_map.lpi_base),
35903591
(int)(hwirq + i), virq + i);
@@ -4523,6 +4524,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
45234524
irq_domain_set_hwirq_and_chip(domain, virq + i, i,
45244525
irqchip, vm->vpes[i]);
45254526
set_bit(i, bitmap);
4527+
irqd_set_resend_when_in_progress(irq_get_irq_data(virq + i));
45264528
}
45274529

45284530
if (err) {

drivers/irqchip/irq-gic-v3.c

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0)
4141
#define FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539 (1ULL << 1)
4242
#define FLAGS_WORKAROUND_MTK_GICR_SAVE (1ULL << 2)
43+
#define FLAGS_WORKAROUND_ASR_ERRATUM_8601001 (1ULL << 3)
4344

4445
#define GIC_IRQ_TYPE_PARTITION (GIC_IRQ_TYPE_LPI + 1)
4546

@@ -656,10 +657,16 @@ static int gic_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
656657
return 0;
657658
}
658659

659-
static u64 gic_mpidr_to_affinity(unsigned long mpidr)
660+
static u64 gic_cpu_to_affinity(int cpu)
660661
{
662+
u64 mpidr = cpu_logical_map(cpu);
661663
u64 aff;
662664

665+
/* ASR8601 needs to have its affinities shifted down... */
666+
if (unlikely(gic_data.flags & FLAGS_WORKAROUND_ASR_ERRATUM_8601001))
667+
mpidr = (MPIDR_AFFINITY_LEVEL(mpidr, 1) |
668+
(MPIDR_AFFINITY_LEVEL(mpidr, 2) << 8));
669+
663670
aff = ((u64)MPIDR_AFFINITY_LEVEL(mpidr, 3) << 32 |
664671
MPIDR_AFFINITY_LEVEL(mpidr, 2) << 16 |
665672
MPIDR_AFFINITY_LEVEL(mpidr, 1) << 8 |
@@ -914,7 +921,7 @@ static void __init gic_dist_init(void)
914921
* Set all global interrupts to the boot CPU only. ARE must be
915922
* enabled.
916923
*/
917-
affinity = gic_mpidr_to_affinity(cpu_logical_map(smp_processor_id()));
924+
affinity = gic_cpu_to_affinity(smp_processor_id());
918925
for (i = 32; i < GIC_LINE_NR; i++)
919926
gic_write_irouter(affinity, base + GICD_IROUTER + i * 8);
920927

@@ -963,14 +970,16 @@ static int gic_iterate_rdists(int (*fn)(struct redist_region *, void __iomem *))
963970

964971
static int __gic_populate_rdist(struct redist_region *region, void __iomem *ptr)
965972
{
966-
unsigned long mpidr = cpu_logical_map(smp_processor_id());
973+
unsigned long mpidr;
967974
u64 typer;
968975
u32 aff;
969976

970977
/*
971978
* Convert affinity to a 32bit value that can be matched to
972979
* GICR_TYPER bits [63:32].
973980
*/
981+
mpidr = gic_cpu_to_affinity(smp_processor_id());
982+
974983
aff = (MPIDR_AFFINITY_LEVEL(mpidr, 3) << 24 |
975984
MPIDR_AFFINITY_LEVEL(mpidr, 2) << 16 |
976985
MPIDR_AFFINITY_LEVEL(mpidr, 1) << 8 |
@@ -1084,7 +1093,7 @@ static inline bool gic_dist_security_disabled(void)
10841093
static void gic_cpu_sys_reg_init(void)
10851094
{
10861095
int i, cpu = smp_processor_id();
1087-
u64 mpidr = cpu_logical_map(cpu);
1096+
u64 mpidr = gic_cpu_to_affinity(cpu);
10881097
u64 need_rss = MPIDR_RS(mpidr);
10891098
bool group0;
10901099
u32 pribits;
@@ -1183,11 +1192,11 @@ static void gic_cpu_sys_reg_init(void)
11831192
for_each_online_cpu(i) {
11841193
bool have_rss = per_cpu(has_rss, i) && per_cpu(has_rss, cpu);
11851194

1186-
need_rss |= MPIDR_RS(cpu_logical_map(i));
1195+
need_rss |= MPIDR_RS(gic_cpu_to_affinity(i));
11871196
if (need_rss && (!have_rss))
11881197
pr_crit("CPU%d (%lx) can't SGI CPU%d (%lx), no RSS\n",
11891198
cpu, (unsigned long)mpidr,
1190-
i, (unsigned long)cpu_logical_map(i));
1199+
i, (unsigned long)gic_cpu_to_affinity(i));
11911200
}
11921201

11931202
/**
@@ -1263,9 +1272,11 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask,
12631272
unsigned long cluster_id)
12641273
{
12651274
int next_cpu, cpu = *base_cpu;
1266-
unsigned long mpidr = cpu_logical_map(cpu);
1275+
unsigned long mpidr;
12671276
u16 tlist = 0;
12681277

1278+
mpidr = gic_cpu_to_affinity(cpu);
1279+
12691280
while (cpu < nr_cpu_ids) {
12701281
tlist |= 1 << (mpidr & 0xf);
12711282

@@ -1274,7 +1285,7 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask,
12741285
goto out;
12751286
cpu = next_cpu;
12761287

1277-
mpidr = cpu_logical_map(cpu);
1288+
mpidr = gic_cpu_to_affinity(cpu);
12781289

12791290
if (cluster_id != MPIDR_TO_SGI_CLUSTER_ID(mpidr)) {
12801291
cpu--;
@@ -1319,7 +1330,7 @@ static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
13191330
dsb(ishst);
13201331

13211332
for_each_cpu(cpu, mask) {
1322-
u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu));
1333+
u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(gic_cpu_to_affinity(cpu));
13231334
u16 tlist;
13241335

13251336
tlist = gic_compute_target_list(&cpu, mask, cluster_id);
@@ -1377,7 +1388,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
13771388

13781389
offset = convert_offset_index(d, GICD_IROUTER, &index);
13791390
reg = gic_dist_base(d) + offset + (index * 8);
1380-
val = gic_mpidr_to_affinity(cpu_logical_map(cpu));
1391+
val = gic_cpu_to_affinity(cpu);
13811392

13821393
gic_write_irouter(val, reg);
13831394

@@ -1796,12 +1807,26 @@ static bool gic_enable_quirk_nvidia_t241(void *data)
17961807
return true;
17971808
}
17981809

1810+
static bool gic_enable_quirk_asr8601(void *data)
1811+
{
1812+
struct gic_chip_data *d = data;
1813+
1814+
d->flags |= FLAGS_WORKAROUND_ASR_ERRATUM_8601001;
1815+
1816+
return true;
1817+
}
1818+
17991819
static const struct gic_quirk gic_quirks[] = {
18001820
{
18011821
.desc = "GICv3: Qualcomm MSM8996 broken firmware",
18021822
.compatible = "qcom,msm8996-gic-v3",
18031823
.init = gic_enable_quirk_msm8996,
18041824
},
1825+
{
1826+
.desc = "GICv3: ASR erratum 8601001",
1827+
.compatible = "asr,asr8601-gic-v3",
1828+
.init = gic_enable_quirk_asr8601,
1829+
},
18051830
{
18061831
.desc = "GICv3: Mediatek Chromebook GICR save problem",
18071832
.property = "mediatek,broken-save-restore-fw",

drivers/irqchip/irq-jcore-aic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static int __init aic_irq_of_init(struct device_node *node,
6868
unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
6969
unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
7070
struct irq_domain *domain;
71+
int ret;
7172

7273
pr_info("Initializing J-Core AIC\n");
7374

@@ -100,6 +101,12 @@ static int __init aic_irq_of_init(struct device_node *node,
100101
jcore_aic.irq_unmask = noop;
101102
jcore_aic.name = "AIC";
102103

104+
ret = irq_alloc_descs(-1, min_irq, dom_sz - min_irq,
105+
of_node_to_nid(node));
106+
107+
if (ret < 0)
108+
return ret;
109+
103110
domain = irq_domain_add_legacy(node, dom_sz - min_irq, min_irq, min_irq,
104111
&jcore_aic_irqdomain_ops,
105112
&jcore_aic);

0 commit comments

Comments
 (0)