Skip to content

Commit 328762a

Browse files
automerging branch "kernel.org-palmer-linux/wip-irq-3-plic" into "riscv-all"
# Conflicts: # drivers/irqchip/Kconfig # drivers/irqchip/Makefile
2 parents 438f787 + 9a01982 commit 328762a

File tree

4 files changed

+446
-0
lines changed

4 files changed

+446
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
RISC-V Platform-Level Interrupt Controller (PLIC)
2+
-------------------------------------------------
3+
4+
The RISC-V supervisor ISA specification allows for the presence of a
5+
platform-level interrupt controller (PLIC). The PLIC connects all external
6+
interrupts in the system to all hart contexts in the system, via the external
7+
interrupt source in each hart's hart-local interrupt controller (HLIC). A hart
8+
context is a privilege mode in a hardware execution thread. For example, in
9+
an 4 core system with 2-way SMT, you have 8 harts and probably at least two
10+
privilege modes per hart; machine mode and supervisor mode.
11+
12+
Each interrupt can be enabled on per-context basis. Any context can claim
13+
a pending enabled interrupt and then release it once it has been handled.
14+
15+
Each interrupt has a configurable priority. Higher priority interrupts are
16+
serviced firs. Each context can specify a priority threshold. Interrupts
17+
with priority below this threshold will not cause the PLIC to raise its
18+
interrupt line leading to the context.
19+
20+
While the PLIC supports both edge-triggered and level-triggered interrupts,
21+
interrupt handlers are oblivious to this distinction and therefor it is not
22+
specific in the PLIC device-tree binding.
23+
24+
While the RISC-V ISA doesn't specify a memory layout for the PLIC, the
25+
"riscv,plic0" device is a concrete implementation of the PLIC that contains a
26+
specific memory layout. More details about the memory layout of the
27+
"riscv,plic0" device can be found as a comment in the device driver, or as part
28+
of the SiFive U5 Coreplex Series Manual (page 22 of the PDF of version 1.0)
29+
<https://www.sifive.com/documentation/coreplex/u5-coreplex-series-manual/>
30+
31+
Required properties:
32+
- compatible : "riscv,plic0"
33+
- #address-cells : should be <0>
34+
- #interrupt-cells : should be <1>
35+
- interrupt-controller : Identifies the node as an interrupt controller
36+
- reg : Should contain 1 register range (address and length)
37+
- interrupts-extended : Specifies which contexts are connected to the PLIC,
38+
with "-1" specifying that a context is not present.
39+
40+
Example:
41+
42+
plic: interrupt-controller@c000000 {
43+
#address-cells = <0>;
44+
#interrupt-cells = <1>;
45+
compatible = "riscv,plic0";
46+
interrupt-controller;
47+
interrupts-extended = <
48+
&cpu0-intc 11
49+
&cpu1-intc 11 &cpu1-intc 9
50+
&cpu2-intc 11 &cpu2-intc 9
51+
&cpu3-intc 11 &cpu3-intc 9
52+
&cpu4-intc 11 &cpu4-intc 9>;
53+
reg = <0xc000000 0x4000000>;
54+
riscv,ndev = <10>;
55+
};

drivers/irqchip/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,15 @@ config RISCV_INTC
385385
Without a local interrupt controller the system will be unable to
386386
handle any interrupts, including those passed via the PLIC.
387387

388+
config RISCV_PLIC
389+
bool "Platform-Level Interrupt Controller"
390+
depends on RISCV
391+
default y
392+
help
393+
This enables support for the PLIC chip found in standard RISC-V
394+
systems. The PLIC controls devices interrupts and connects them to
395+
each core's local interrupt controller. Aside from timer and
396+
software interrupts, all other interrupt sources (MSI, GPIO, etc)
397+
are subordinate to the PLIC.
398+
388399
If you don't know what to do here, say Y.

drivers/irqchip/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ obj-$(CONFIG_GOLDFISH_PIC) += irq-goldfish-pic.o
8888
obj-$(CONFIG_NDS32) += irq-ativic32.o
8989
obj-$(CONFIG_QCOM_PDC) += qcom-pdc.o
9090
obj-$(CONFIG_RISCV_INTC) += irq-riscv-intc.o
91+
obj-$(CONFIG_RISCV_PLIC) += irq-riscv-plic.o

0 commit comments

Comments
 (0)