|
| 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 | + }; |
0 commit comments