1b67bc7cbSPalmer DabbeltRISC-V Hart-Level Interrupt Controller (HLIC) 2b67bc7cbSPalmer Dabbelt--------------------------------------------- 3b67bc7cbSPalmer Dabbelt 4b67bc7cbSPalmer DabbeltRISC-V cores include Control Status Registers (CSRs) which are local to each 5b67bc7cbSPalmer DabbeltCPU core (HART in RISC-V terminology) and can be read or written by software. 6b67bc7cbSPalmer DabbeltSome of these CSRs are used to control local interrupts connected to the core. 7b67bc7cbSPalmer DabbeltEvery interrupt is ultimately routed through a hart's HLIC before it 8b67bc7cbSPalmer Dabbeltinterrupts that hart. 9b67bc7cbSPalmer Dabbelt 10b67bc7cbSPalmer DabbeltThe RISC-V supervisor ISA manual specifies three interrupt sources that are 11b67bc7cbSPalmer Dabbeltattached to every HLIC: software interrupts, the timer interrupt, and external 12b67bc7cbSPalmer Dabbeltinterrupts. Software interrupts are used to send IPIs between cores. The 13b67bc7cbSPalmer Dabbelttimer interrupt comes from an architecturally mandated real-time timer that is 14*11f65ad1SPalmer Dabbeltcontrolled via Supervisor Binary Interface (SBI) calls and CSR reads. External 15b67bc7cbSPalmer Dabbeltinterrupts connect all other device interrupts to the HLIC, which are routed 16b67bc7cbSPalmer Dabbeltvia the platform-level interrupt controller (PLIC). 17b67bc7cbSPalmer Dabbelt 18b67bc7cbSPalmer DabbeltAll RISC-V systems that conform to the supervisor ISA specification are 19b67bc7cbSPalmer Dabbeltrequired to have a HLIC with these three interrupt sources present. Since the 20b67bc7cbSPalmer Dabbeltinterrupt map is defined by the ISA it's not listed in the HLIC's device tree 21b67bc7cbSPalmer Dabbeltentry, though external interrupt controllers (like the PLIC, for example) will 22b67bc7cbSPalmer Dabbeltneed to define how their interrupts map to the relevant HLICs. This means 23b67bc7cbSPalmer Dabbelta PLIC interrupt property will typically list the HLICs for all present HARTs 24b67bc7cbSPalmer Dabbeltin the system. 25b67bc7cbSPalmer Dabbelt 26b67bc7cbSPalmer DabbeltRequired properties: 27b67bc7cbSPalmer Dabbelt- compatible : "riscv,cpu-intc" 28*11f65ad1SPalmer Dabbelt- #interrupt-cells : should be <1>. The interrupt sources are defined by the 29*11f65ad1SPalmer Dabbelt RISC-V supervisor ISA manual, with only the following three interrupts being 30*11f65ad1SPalmer Dabbelt defined for supervisor mode: 31*11f65ad1SPalmer Dabbelt - Source 1 is the supervisor software interrupt, which can be sent by an SBI 32*11f65ad1SPalmer Dabbelt call and is reserved for use by software. 33*11f65ad1SPalmer Dabbelt - Source 5 is the supervisor timer interrupt, which can be configured by 34*11f65ad1SPalmer Dabbelt SBI calls and implements a one-shot timer. 35*11f65ad1SPalmer Dabbelt - Source 9 is the supervisor external interrupt, which chains to all other 36*11f65ad1SPalmer Dabbelt device interrupts. 37b67bc7cbSPalmer Dabbelt- interrupt-controller : Identifies the node as an interrupt controller 38b67bc7cbSPalmer Dabbelt 39b67bc7cbSPalmer DabbeltFurthermore, this interrupt-controller MUST be embedded inside the cpu 40b67bc7cbSPalmer Dabbeltdefinition of the hart whose CSRs control these local interrupts. 41b67bc7cbSPalmer Dabbelt 42b67bc7cbSPalmer DabbeltAn example device tree entry for a HLIC is show below. 43b67bc7cbSPalmer Dabbelt 44b67bc7cbSPalmer Dabbelt cpu1: cpu@1 { 45b67bc7cbSPalmer Dabbelt compatible = "riscv"; 46b67bc7cbSPalmer Dabbelt ... 47b67bc7cbSPalmer Dabbelt cpu1-intc: interrupt-controller { 48b67bc7cbSPalmer Dabbelt #interrupt-cells = <1>; 49*11f65ad1SPalmer Dabbelt compatible = "sifive,fu540-c000-cpu-intc", "riscv,cpu-intc"; 50b67bc7cbSPalmer Dabbelt interrupt-controller; 51b67bc7cbSPalmer Dabbelt }; 52b67bc7cbSPalmer Dabbelt }; 53