Skip to content

Commit 6bfd2d4

Browse files
committed
Merge tag 'irq-core-2024-05-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull interrupt subsystem updates from Thomas Gleixner: "Core code: - Interrupt storm detection for the lockup watchdog: Lockups which are caused by interrupt storms are not easy to debug because there is no information about the events which make the lockup detector trigger. To make this more user friendly, provide an extenstion to interrupt statistics which allows to take snapshots and an interface to retrieve the delta to the snapshot. Use this new mechanism in the watchdog code to do a two stage lockup analysis by taking the snapshot and printing the deltas for the topmost active interrupts on the second trigger. Note: This contains both the interrupt and the watchdog changes as the latter depend on the former obviously. - Avoid summation loops in the /proc/interrupts output and use the global counter when possible - Skip suspended interrupts on CPU hotplug operations to ensure that they are not delivered before the system resumes the device drivers when coming out of suspend. - On CPU hot-unplug interrupts which are affine to the outgoing CPU are migrated to a different CPU in the affinity mask. This can fail when the CPUs have no vectors left. Instead of giving up try to migrate it to any online CPU and thereby breaking the affinity setting in order to prevent a stale device interrupt which targets an offline CPU - The usual small cleanups Driver code: - Support for the RISCV AIA MSI controller - Make the interrupt allocation for the Loongson PCH controller more flexible to prevent vector exhaustion - The usual set of cleanups and fixes all over the place" * tag 'irq-core-2024-05-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (51 commits) irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc cpuidle: Avoid explicit cpumask allocation on stack irqchip/sifive-plic: Avoid explicit cpumask allocation on stack irqchip/riscv-aplic-direct: Avoid explicit cpumask allocation on stack irqchip/loongson-eiointc: Avoid explicit cpumask allocation on stack irqchip/gic-v3-its: Avoid explicit cpumask allocation on stack irqchip/irq-bcm6345-l1: Avoid explicit cpumask allocation on stack cpumask: Introduce cpumask_first_and_and() irqchip/irq-brcmstb-l2: Avoid saving mask on shutdown genirq: Reuse irq_is_nmi() genirq/cpuhotplug: Retry with cpu_online_mask when migration fails genirq/cpuhotplug: Skip suspended interrupts when restoring affinity arm64: dts: st: Add interrupt parent to pinctrl on stm32mp251 arm64: dts: st: Add exti1 and exti2 nodes on stm32mp251 ARM: dts: stm32: List exti parent interrupts on stm32mp131 ARM: dts: stm32: List exti parent interrupts on stm32mp151 arm64: Kconfig.platforms: Enable STM32_EXTI for ARCH_STM32 irqchip/stm32-exti: Mark events reserved with RIF configuration check irqchip/stm32-exti: Skip secure events irqchip/stm32-exti: Convert driver to standard PM ...
2 parents a9d9ce3 + 382d2ff commit 6bfd2d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3977
-182
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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/riscv,aplic.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: RISC-V Advanced Platform Level Interrupt Controller (APLIC)
8+
9+
maintainers:
10+
- Anup Patel <anup@brainfault.org>
11+
12+
description:
13+
The RISC-V advanced interrupt architecture (AIA) defines an advanced
14+
platform level interrupt controller (APLIC) for handling wired interrupts
15+
in a RISC-V platform. The RISC-V AIA specification can be found at
16+
https://github.com/riscv/riscv-aia.
17+
18+
The RISC-V APLIC is implemented as hierarchical APLIC domains where all
19+
interrupt sources connect to the root APLIC domain and a parent APLIC
20+
domain can delegate interrupt sources to it's child APLIC domains. There
21+
is one device tree node for each APLIC domain.
22+
23+
allOf:
24+
- $ref: /schemas/interrupt-controller.yaml#
25+
26+
properties:
27+
compatible:
28+
items:
29+
- enum:
30+
- qemu,aplic
31+
- const: riscv,aplic
32+
33+
reg:
34+
maxItems: 1
35+
36+
interrupt-controller: true
37+
38+
"#interrupt-cells":
39+
const: 2
40+
41+
interrupts-extended:
42+
minItems: 1
43+
maxItems: 16384
44+
description:
45+
Given APLIC domain directly injects external interrupts to a set of
46+
RISC-V HARTS (or CPUs). Each node pointed to should be a riscv,cpu-intc
47+
node, which has a CPU node (i.e. RISC-V HART) as parent.
48+
49+
msi-parent:
50+
description:
51+
Given APLIC domain forwards wired interrupts as MSIs to a AIA incoming
52+
message signaled interrupt controller (IMSIC). If both "msi-parent" and
53+
"interrupts-extended" properties are present then it means the APLIC
54+
domain supports both MSI mode and Direct mode in HW. In this case, the
55+
APLIC driver has to choose between MSI mode or Direct mode.
56+
57+
riscv,num-sources:
58+
$ref: /schemas/types.yaml#/definitions/uint32
59+
minimum: 1
60+
maximum: 1023
61+
description:
62+
Specifies the number of wired interrupt sources supported by this
63+
APLIC domain.
64+
65+
riscv,children:
66+
$ref: /schemas/types.yaml#/definitions/phandle-array
67+
minItems: 1
68+
maxItems: 1024
69+
items:
70+
maxItems: 1
71+
description:
72+
A list of child APLIC domains for the given APLIC domain. Each child
73+
APLIC domain is assigned a child index in increasing order, with the
74+
first child APLIC domain assigned child index 0. The APLIC domain child
75+
index is used by firmware to delegate interrupts from the given APLIC
76+
domain to a particular child APLIC domain.
77+
78+
riscv,delegation:
79+
$ref: /schemas/types.yaml#/definitions/phandle-array
80+
minItems: 1
81+
maxItems: 1024
82+
items:
83+
items:
84+
- description: child APLIC domain phandle
85+
- description: first interrupt number of the parent APLIC domain (inclusive)
86+
- description: last interrupt number of the parent APLIC domain (inclusive)
87+
description:
88+
A interrupt delegation list where each entry is a triple consisting
89+
of child APLIC domain phandle, first interrupt number of the parent
90+
APLIC domain, and last interrupt number of the parent APLIC domain.
91+
Firmware must configure interrupt delegation registers based on
92+
interrupt delegation list.
93+
94+
dependencies:
95+
riscv,delegation: [ "riscv,children" ]
96+
97+
required:
98+
- compatible
99+
- reg
100+
- interrupt-controller
101+
- "#interrupt-cells"
102+
- riscv,num-sources
103+
104+
anyOf:
105+
- required:
106+
- interrupts-extended
107+
- required:
108+
- msi-parent
109+
110+
unevaluatedProperties: false
111+
112+
examples:
113+
- |
114+
// Example 1 (APLIC domains directly injecting interrupt to HARTs):
115+
116+
interrupt-controller@c000000 {
117+
compatible = "qemu,aplic", "riscv,aplic";
118+
interrupts-extended = <&cpu1_intc 11>,
119+
<&cpu2_intc 11>,
120+
<&cpu3_intc 11>,
121+
<&cpu4_intc 11>;
122+
reg = <0xc000000 0x4080>;
123+
interrupt-controller;
124+
#interrupt-cells = <2>;
125+
riscv,num-sources = <63>;
126+
riscv,children = <&aplic1>, <&aplic2>;
127+
riscv,delegation = <&aplic1 1 63>;
128+
};
129+
130+
aplic1: interrupt-controller@d000000 {
131+
compatible = "qemu,aplic", "riscv,aplic";
132+
interrupts-extended = <&cpu1_intc 9>,
133+
<&cpu2_intc 9>;
134+
reg = <0xd000000 0x4080>;
135+
interrupt-controller;
136+
#interrupt-cells = <2>;
137+
riscv,num-sources = <63>;
138+
};
139+
140+
aplic2: interrupt-controller@e000000 {
141+
compatible = "qemu,aplic", "riscv,aplic";
142+
interrupts-extended = <&cpu3_intc 9>,
143+
<&cpu4_intc 9>;
144+
reg = <0xe000000 0x4080>;
145+
interrupt-controller;
146+
#interrupt-cells = <2>;
147+
riscv,num-sources = <63>;
148+
};
149+
150+
- |
151+
// Example 2 (APLIC domains forwarding interrupts as MSIs):
152+
153+
interrupt-controller@c000000 {
154+
compatible = "qemu,aplic", "riscv,aplic";
155+
msi-parent = <&imsic_mlevel>;
156+
reg = <0xc000000 0x4000>;
157+
interrupt-controller;
158+
#interrupt-cells = <2>;
159+
riscv,num-sources = <63>;
160+
riscv,children = <&aplic3>;
161+
riscv,delegation = <&aplic3 1 63>;
162+
};
163+
164+
aplic3: interrupt-controller@d000000 {
165+
compatible = "qemu,aplic", "riscv,aplic";
166+
msi-parent = <&imsic_slevel>;
167+
reg = <0xd000000 0x4000>;
168+
interrupt-controller;
169+
#interrupt-cells = <2>;
170+
riscv,num-sources = <63>;
171+
};
172+
...
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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/riscv,imsics.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: RISC-V Incoming MSI Controller (IMSIC)
8+
9+
maintainers:
10+
- Anup Patel <anup@brainfault.org>
11+
12+
description: |
13+
The RISC-V advanced interrupt architecture (AIA) defines a per-CPU incoming
14+
MSI controller (IMSIC) for handling MSIs in a RISC-V platform. The RISC-V
15+
AIA specification can be found at https://github.com/riscv/riscv-aia.
16+
17+
The IMSIC is a per-CPU (or per-HART) device with separate interrupt file
18+
for each privilege level (machine or supervisor). The configuration of
19+
a IMSIC interrupt file is done using AIA CSRs and it also has a 4KB MMIO
20+
space to receive MSIs from devices. Each IMSIC interrupt file supports a
21+
fixed number of interrupt identities (to distinguish MSIs from devices)
22+
which is same for given privilege level across CPUs (or HARTs).
23+
24+
The device tree of a RISC-V platform will have one IMSIC device tree node
25+
for each privilege level (machine or supervisor) which collectively describe
26+
IMSIC interrupt files at that privilege level across CPUs (or HARTs).
27+
28+
The arrangement of IMSIC interrupt files in MMIO space of a RISC-V platform
29+
follows a particular scheme defined by the RISC-V AIA specification. A IMSIC
30+
group is a set of IMSIC interrupt files co-located in MMIO space and we can
31+
have multiple IMSIC groups (i.e. clusters, sockets, chiplets, etc) in a
32+
RISC-V platform. The MSI target address of a IMSIC interrupt file at given
33+
privilege level (machine or supervisor) encodes group index, HART index,
34+
and guest index (shown below).
35+
36+
XLEN-1 > (HART Index MSB) 12 0
37+
| | | |
38+
-------------------------------------------------------------
39+
|xxxxxx|Group Index|xxxxxxxxxxx|HART Index|Guest Index| 0 |
40+
-------------------------------------------------------------
41+
42+
allOf:
43+
- $ref: /schemas/interrupt-controller.yaml#
44+
- $ref: /schemas/interrupt-controller/msi-controller.yaml#
45+
46+
properties:
47+
compatible:
48+
items:
49+
- enum:
50+
- qemu,imsics
51+
- const: riscv,imsics
52+
53+
reg:
54+
minItems: 1
55+
maxItems: 16384
56+
description:
57+
Base address of each IMSIC group.
58+
59+
interrupt-controller: true
60+
61+
"#interrupt-cells":
62+
const: 0
63+
64+
msi-controller: true
65+
66+
"#msi-cells":
67+
const: 0
68+
69+
interrupts-extended:
70+
minItems: 1
71+
maxItems: 16384
72+
description:
73+
This property represents the set of CPUs (or HARTs) for which given
74+
device tree node describes the IMSIC interrupt files. Each node pointed
75+
to should be a riscv,cpu-intc node, which has a CPU node (i.e. RISC-V
76+
HART) as parent.
77+
78+
riscv,num-ids:
79+
$ref: /schemas/types.yaml#/definitions/uint32
80+
minimum: 63
81+
maximum: 2047
82+
description:
83+
Number of interrupt identities supported by IMSIC interrupt file.
84+
85+
riscv,num-guest-ids:
86+
$ref: /schemas/types.yaml#/definitions/uint32
87+
minimum: 63
88+
maximum: 2047
89+
description:
90+
Number of interrupt identities are supported by IMSIC guest interrupt
91+
file. When not specified it is assumed to be same as specified by the
92+
riscv,num-ids property.
93+
94+
riscv,guest-index-bits:
95+
minimum: 0
96+
maximum: 7
97+
default: 0
98+
description:
99+
Number of guest index bits in the MSI target address.
100+
101+
riscv,hart-index-bits:
102+
minimum: 0
103+
maximum: 15
104+
description:
105+
Number of HART index bits in the MSI target address. When not
106+
specified it is calculated based on the interrupts-extended property.
107+
108+
riscv,group-index-bits:
109+
minimum: 0
110+
maximum: 7
111+
default: 0
112+
description:
113+
Number of group index bits in the MSI target address.
114+
115+
riscv,group-index-shift:
116+
$ref: /schemas/types.yaml#/definitions/uint32
117+
minimum: 0
118+
maximum: 55
119+
default: 24
120+
description:
121+
The least significant bit position of the group index bits in the
122+
MSI target address.
123+
124+
required:
125+
- compatible
126+
- reg
127+
- interrupt-controller
128+
- msi-controller
129+
- "#msi-cells"
130+
- interrupts-extended
131+
- riscv,num-ids
132+
133+
unevaluatedProperties: false
134+
135+
examples:
136+
- |
137+
// Example 1 (Machine-level IMSIC files with just one group):
138+
139+
interrupt-controller@24000000 {
140+
compatible = "qemu,imsics", "riscv,imsics";
141+
interrupts-extended = <&cpu1_intc 11>,
142+
<&cpu2_intc 11>,
143+
<&cpu3_intc 11>,
144+
<&cpu4_intc 11>;
145+
reg = <0x28000000 0x4000>;
146+
interrupt-controller;
147+
#interrupt-cells = <0>;
148+
msi-controller;
149+
#msi-cells = <0>;
150+
riscv,num-ids = <127>;
151+
};
152+
153+
- |
154+
// Example 2 (Supervisor-level IMSIC files with two groups):
155+
156+
interrupt-controller@28000000 {
157+
compatible = "qemu,imsics", "riscv,imsics";
158+
interrupts-extended = <&cpu1_intc 9>,
159+
<&cpu2_intc 9>,
160+
<&cpu3_intc 9>,
161+
<&cpu4_intc 9>;
162+
reg = <0x28000000 0x2000>, /* Group0 IMSICs */
163+
<0x29000000 0x2000>; /* Group1 IMSICs */
164+
interrupt-controller;
165+
#interrupt-cells = <0>;
166+
msi-controller;
167+
#msi-cells = <0>;
168+
riscv,num-ids = <127>;
169+
riscv,group-index-bits = <1>;
170+
riscv,group-index-shift = <24>;
171+
};
172+
...

Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,23 @@ examples:
8989
reg = <0x5000d000 0x400>;
9090
};
9191
92+
- |
9293
//Example 2
93-
exti2: interrupt-controller@40013c00 {
94+
#include <dt-bindings/interrupt-controller/arm-gic.h>
95+
exti2: interrupt-controller@5000d000 {
96+
compatible = "st,stm32mp1-exti", "syscon";
97+
interrupt-controller;
98+
#interrupt-cells = <2>;
99+
reg = <0x5000d000 0x400>;
100+
interrupts-extended =
101+
<&intc GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
102+
<0>,
103+
<&intc GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
104+
};
105+
106+
- |
107+
//Example 3
108+
exti3: interrupt-controller@40013c00 {
94109
compatible = "st,stm32-exti";
95110
interrupt-controller;
96111
#interrupt-cells = <2>;

0 commit comments

Comments
 (0)