1*c66ec88fSEmmanuel VadotSiFive Platform-Level Interrupt Controller (PLIC) 2*c66ec88fSEmmanuel Vadot------------------------------------------------- 3*c66ec88fSEmmanuel Vadot 4*c66ec88fSEmmanuel VadotSiFive SOCs include an implementation of the Platform-Level Interrupt Controller 5*c66ec88fSEmmanuel Vadot(PLIC) high-level specification in the RISC-V Privileged Architecture 6*c66ec88fSEmmanuel Vadotspecification. The PLIC connects all external interrupts in the system to all 7*c66ec88fSEmmanuel Vadothart contexts in the system, via the external interrupt source in each hart. 8*c66ec88fSEmmanuel Vadot 9*c66ec88fSEmmanuel VadotA hart context is a privilege mode in a hardware execution thread. For example, 10*c66ec88fSEmmanuel Vadotin an 4 core system with 2-way SMT, you have 8 harts and probably at least two 11*c66ec88fSEmmanuel Vadotprivilege modes per hart; machine mode and supervisor mode. 12*c66ec88fSEmmanuel Vadot 13*c66ec88fSEmmanuel VadotEach interrupt can be enabled on per-context basis. Any context can claim 14*c66ec88fSEmmanuel Vadota pending enabled interrupt and then release it once it has been handled. 15*c66ec88fSEmmanuel Vadot 16*c66ec88fSEmmanuel VadotEach interrupt has a configurable priority. Higher priority interrupts are 17*c66ec88fSEmmanuel Vadotserviced first. Each context can specify a priority threshold. Interrupts 18*c66ec88fSEmmanuel Vadotwith priority below this threshold will not cause the PLIC to raise its 19*c66ec88fSEmmanuel Vadotinterrupt line leading to the context. 20*c66ec88fSEmmanuel Vadot 21*c66ec88fSEmmanuel VadotWhile the PLIC supports both edge-triggered and level-triggered interrupts, 22*c66ec88fSEmmanuel Vadotinterrupt handlers are oblivious to this distinction and therefore it is not 23*c66ec88fSEmmanuel Vadotspecified in the PLIC device-tree binding. 24*c66ec88fSEmmanuel Vadot 25*c66ec88fSEmmanuel VadotWhile the RISC-V ISA doesn't specify a memory layout for the PLIC, the 26*c66ec88fSEmmanuel Vadot"sifive,plic-1.0.0" device is a concrete implementation of the PLIC that 27*c66ec88fSEmmanuel Vadotcontains a specific memory layout, which is documented in chapter 8 of the 28*c66ec88fSEmmanuel VadotSiFive U5 Coreplex Series Manual <https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf>. 29*c66ec88fSEmmanuel Vadot 30*c66ec88fSEmmanuel VadotRequired properties: 31*c66ec88fSEmmanuel Vadot- compatible : "sifive,plic-1.0.0" and a string identifying the actual 32*c66ec88fSEmmanuel Vadot detailed implementation in case that specific bugs need to be worked around. 33*c66ec88fSEmmanuel Vadot- #address-cells : should be <0> or more. 34*c66ec88fSEmmanuel Vadot- #interrupt-cells : should be <1> or more. 35*c66ec88fSEmmanuel Vadot- interrupt-controller : Identifies the node as an interrupt controller. 36*c66ec88fSEmmanuel Vadot- reg : Should contain 1 register range (address and length). 37*c66ec88fSEmmanuel Vadot- interrupts-extended : Specifies which contexts are connected to the PLIC, 38*c66ec88fSEmmanuel Vadot with "-1" specifying that a context is not present. Each node pointed 39*c66ec88fSEmmanuel Vadot to should be a riscv,cpu-intc node, which has a riscv node as parent. 40*c66ec88fSEmmanuel Vadot- riscv,ndev: Specifies how many external interrupts are supported by 41*c66ec88fSEmmanuel Vadot this controller. 42*c66ec88fSEmmanuel Vadot 43*c66ec88fSEmmanuel VadotExample: 44*c66ec88fSEmmanuel Vadot 45*c66ec88fSEmmanuel Vadot plic: interrupt-controller@c000000 { 46*c66ec88fSEmmanuel Vadot #address-cells = <0>; 47*c66ec88fSEmmanuel Vadot #interrupt-cells = <1>; 48*c66ec88fSEmmanuel Vadot compatible = "sifive,plic-1.0.0", "sifive,fu540-c000-plic"; 49*c66ec88fSEmmanuel Vadot interrupt-controller; 50*c66ec88fSEmmanuel Vadot interrupts-extended = < 51*c66ec88fSEmmanuel Vadot &cpu0-intc 11 52*c66ec88fSEmmanuel Vadot &cpu1-intc 11 &cpu1-intc 9 53*c66ec88fSEmmanuel Vadot &cpu2-intc 11 &cpu2-intc 9 54*c66ec88fSEmmanuel Vadot &cpu3-intc 11 &cpu3-intc 9 55*c66ec88fSEmmanuel Vadot &cpu4-intc 11 &cpu4-intc 9>; 56*c66ec88fSEmmanuel Vadot reg = <0xc000000 0x4000000>; 57*c66ec88fSEmmanuel Vadot riscv,ndev = <10>; 58*c66ec88fSEmmanuel Vadot }; 59