1*7d0873ebSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2*7d0873ebSEmmanuel Vadot%YAML 1.2 3*7d0873ebSEmmanuel Vadot--- 4*7d0873ebSEmmanuel Vadot$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml# 5*7d0873ebSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6*7d0873ebSEmmanuel Vadot 7*7d0873ebSEmmanuel Vadottitle: RISC-V Advanced Platform Level Interrupt Controller (APLIC) 8*7d0873ebSEmmanuel Vadot 9*7d0873ebSEmmanuel Vadotmaintainers: 10*7d0873ebSEmmanuel Vadot - Anup Patel <anup@brainfault.org> 11*7d0873ebSEmmanuel Vadot 12*7d0873ebSEmmanuel Vadotdescription: 13*7d0873ebSEmmanuel Vadot The RISC-V advanced interrupt architecture (AIA) defines an advanced 14*7d0873ebSEmmanuel Vadot platform level interrupt controller (APLIC) for handling wired interrupts 15*7d0873ebSEmmanuel Vadot in a RISC-V platform. The RISC-V AIA specification can be found at 16*7d0873ebSEmmanuel Vadot https://github.com/riscv/riscv-aia. 17*7d0873ebSEmmanuel Vadot 18*7d0873ebSEmmanuel Vadot The RISC-V APLIC is implemented as hierarchical APLIC domains where all 19*7d0873ebSEmmanuel Vadot interrupt sources connect to the root APLIC domain and a parent APLIC 20*7d0873ebSEmmanuel Vadot domain can delegate interrupt sources to it's child APLIC domains. There 21*7d0873ebSEmmanuel Vadot is one device tree node for each APLIC domain. 22*7d0873ebSEmmanuel Vadot 23*7d0873ebSEmmanuel VadotallOf: 24*7d0873ebSEmmanuel Vadot - $ref: /schemas/interrupt-controller.yaml# 25*7d0873ebSEmmanuel Vadot 26*7d0873ebSEmmanuel Vadotproperties: 27*7d0873ebSEmmanuel Vadot compatible: 28*7d0873ebSEmmanuel Vadot items: 29*7d0873ebSEmmanuel Vadot - enum: 30*7d0873ebSEmmanuel Vadot - qemu,aplic 31*7d0873ebSEmmanuel Vadot - const: riscv,aplic 32*7d0873ebSEmmanuel Vadot 33*7d0873ebSEmmanuel Vadot reg: 34*7d0873ebSEmmanuel Vadot maxItems: 1 35*7d0873ebSEmmanuel Vadot 36*7d0873ebSEmmanuel Vadot interrupt-controller: true 37*7d0873ebSEmmanuel Vadot 38*7d0873ebSEmmanuel Vadot "#interrupt-cells": 39*7d0873ebSEmmanuel Vadot const: 2 40*7d0873ebSEmmanuel Vadot 41*7d0873ebSEmmanuel Vadot interrupts-extended: 42*7d0873ebSEmmanuel Vadot minItems: 1 43*7d0873ebSEmmanuel Vadot maxItems: 16384 44*7d0873ebSEmmanuel Vadot description: 45*7d0873ebSEmmanuel Vadot Given APLIC domain directly injects external interrupts to a set of 46*7d0873ebSEmmanuel Vadot RISC-V HARTS (or CPUs). Each node pointed to should be a riscv,cpu-intc 47*7d0873ebSEmmanuel Vadot node, which has a CPU node (i.e. RISC-V HART) as parent. 48*7d0873ebSEmmanuel Vadot 49*7d0873ebSEmmanuel Vadot msi-parent: 50*7d0873ebSEmmanuel Vadot description: 51*7d0873ebSEmmanuel Vadot Given APLIC domain forwards wired interrupts as MSIs to a AIA incoming 52*7d0873ebSEmmanuel Vadot message signaled interrupt controller (IMSIC). If both "msi-parent" and 53*7d0873ebSEmmanuel Vadot "interrupts-extended" properties are present then it means the APLIC 54*7d0873ebSEmmanuel Vadot domain supports both MSI mode and Direct mode in HW. In this case, the 55*7d0873ebSEmmanuel Vadot APLIC driver has to choose between MSI mode or Direct mode. 56*7d0873ebSEmmanuel Vadot 57*7d0873ebSEmmanuel Vadot riscv,num-sources: 58*7d0873ebSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 59*7d0873ebSEmmanuel Vadot minimum: 1 60*7d0873ebSEmmanuel Vadot maximum: 1023 61*7d0873ebSEmmanuel Vadot description: 62*7d0873ebSEmmanuel Vadot Specifies the number of wired interrupt sources supported by this 63*7d0873ebSEmmanuel Vadot APLIC domain. 64*7d0873ebSEmmanuel Vadot 65*7d0873ebSEmmanuel Vadot riscv,children: 66*7d0873ebSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 67*7d0873ebSEmmanuel Vadot minItems: 1 68*7d0873ebSEmmanuel Vadot maxItems: 1024 69*7d0873ebSEmmanuel Vadot items: 70*7d0873ebSEmmanuel Vadot maxItems: 1 71*7d0873ebSEmmanuel Vadot description: 72*7d0873ebSEmmanuel Vadot A list of child APLIC domains for the given APLIC domain. Each child 73*7d0873ebSEmmanuel Vadot APLIC domain is assigned a child index in increasing order, with the 74*7d0873ebSEmmanuel Vadot first child APLIC domain assigned child index 0. The APLIC domain child 75*7d0873ebSEmmanuel Vadot index is used by firmware to delegate interrupts from the given APLIC 76*7d0873ebSEmmanuel Vadot domain to a particular child APLIC domain. 77*7d0873ebSEmmanuel Vadot 78*7d0873ebSEmmanuel Vadot riscv,delegation: 79*7d0873ebSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 80*7d0873ebSEmmanuel Vadot minItems: 1 81*7d0873ebSEmmanuel Vadot maxItems: 1024 82*7d0873ebSEmmanuel Vadot items: 83*7d0873ebSEmmanuel Vadot items: 84*7d0873ebSEmmanuel Vadot - description: child APLIC domain phandle 85*7d0873ebSEmmanuel Vadot - description: first interrupt number of the parent APLIC domain (inclusive) 86*7d0873ebSEmmanuel Vadot - description: last interrupt number of the parent APLIC domain (inclusive) 87*7d0873ebSEmmanuel Vadot description: 88*7d0873ebSEmmanuel Vadot A interrupt delegation list where each entry is a triple consisting 89*7d0873ebSEmmanuel Vadot of child APLIC domain phandle, first interrupt number of the parent 90*7d0873ebSEmmanuel Vadot APLIC domain, and last interrupt number of the parent APLIC domain. 91*7d0873ebSEmmanuel Vadot Firmware must configure interrupt delegation registers based on 92*7d0873ebSEmmanuel Vadot interrupt delegation list. 93*7d0873ebSEmmanuel Vadot 94*7d0873ebSEmmanuel Vadotdependencies: 95*7d0873ebSEmmanuel Vadot riscv,delegation: [ "riscv,children" ] 96*7d0873ebSEmmanuel Vadot 97*7d0873ebSEmmanuel Vadotrequired: 98*7d0873ebSEmmanuel Vadot - compatible 99*7d0873ebSEmmanuel Vadot - reg 100*7d0873ebSEmmanuel Vadot - interrupt-controller 101*7d0873ebSEmmanuel Vadot - "#interrupt-cells" 102*7d0873ebSEmmanuel Vadot - riscv,num-sources 103*7d0873ebSEmmanuel Vadot 104*7d0873ebSEmmanuel VadotanyOf: 105*7d0873ebSEmmanuel Vadot - required: 106*7d0873ebSEmmanuel Vadot - interrupts-extended 107*7d0873ebSEmmanuel Vadot - required: 108*7d0873ebSEmmanuel Vadot - msi-parent 109*7d0873ebSEmmanuel Vadot 110*7d0873ebSEmmanuel VadotunevaluatedProperties: false 111*7d0873ebSEmmanuel Vadot 112*7d0873ebSEmmanuel Vadotexamples: 113*7d0873ebSEmmanuel Vadot - | 114*7d0873ebSEmmanuel Vadot // Example 1 (APLIC domains directly injecting interrupt to HARTs): 115*7d0873ebSEmmanuel Vadot 116*7d0873ebSEmmanuel Vadot interrupt-controller@c000000 { 117*7d0873ebSEmmanuel Vadot compatible = "qemu,aplic", "riscv,aplic"; 118*7d0873ebSEmmanuel Vadot interrupts-extended = <&cpu1_intc 11>, 119*7d0873ebSEmmanuel Vadot <&cpu2_intc 11>, 120*7d0873ebSEmmanuel Vadot <&cpu3_intc 11>, 121*7d0873ebSEmmanuel Vadot <&cpu4_intc 11>; 122*7d0873ebSEmmanuel Vadot reg = <0xc000000 0x4080>; 123*7d0873ebSEmmanuel Vadot interrupt-controller; 124*7d0873ebSEmmanuel Vadot #interrupt-cells = <2>; 125*7d0873ebSEmmanuel Vadot riscv,num-sources = <63>; 126*7d0873ebSEmmanuel Vadot riscv,children = <&aplic1>, <&aplic2>; 127*7d0873ebSEmmanuel Vadot riscv,delegation = <&aplic1 1 63>; 128*7d0873ebSEmmanuel Vadot }; 129*7d0873ebSEmmanuel Vadot 130*7d0873ebSEmmanuel Vadot aplic1: interrupt-controller@d000000 { 131*7d0873ebSEmmanuel Vadot compatible = "qemu,aplic", "riscv,aplic"; 132*7d0873ebSEmmanuel Vadot interrupts-extended = <&cpu1_intc 9>, 133*7d0873ebSEmmanuel Vadot <&cpu2_intc 9>; 134*7d0873ebSEmmanuel Vadot reg = <0xd000000 0x4080>; 135*7d0873ebSEmmanuel Vadot interrupt-controller; 136*7d0873ebSEmmanuel Vadot #interrupt-cells = <2>; 137*7d0873ebSEmmanuel Vadot riscv,num-sources = <63>; 138*7d0873ebSEmmanuel Vadot }; 139*7d0873ebSEmmanuel Vadot 140*7d0873ebSEmmanuel Vadot aplic2: interrupt-controller@e000000 { 141*7d0873ebSEmmanuel Vadot compatible = "qemu,aplic", "riscv,aplic"; 142*7d0873ebSEmmanuel Vadot interrupts-extended = <&cpu3_intc 9>, 143*7d0873ebSEmmanuel Vadot <&cpu4_intc 9>; 144*7d0873ebSEmmanuel Vadot reg = <0xe000000 0x4080>; 145*7d0873ebSEmmanuel Vadot interrupt-controller; 146*7d0873ebSEmmanuel Vadot #interrupt-cells = <2>; 147*7d0873ebSEmmanuel Vadot riscv,num-sources = <63>; 148*7d0873ebSEmmanuel Vadot }; 149*7d0873ebSEmmanuel Vadot 150*7d0873ebSEmmanuel Vadot - | 151*7d0873ebSEmmanuel Vadot // Example 2 (APLIC domains forwarding interrupts as MSIs): 152*7d0873ebSEmmanuel Vadot 153*7d0873ebSEmmanuel Vadot interrupt-controller@c000000 { 154*7d0873ebSEmmanuel Vadot compatible = "qemu,aplic", "riscv,aplic"; 155*7d0873ebSEmmanuel Vadot msi-parent = <&imsic_mlevel>; 156*7d0873ebSEmmanuel Vadot reg = <0xc000000 0x4000>; 157*7d0873ebSEmmanuel Vadot interrupt-controller; 158*7d0873ebSEmmanuel Vadot #interrupt-cells = <2>; 159*7d0873ebSEmmanuel Vadot riscv,num-sources = <63>; 160*7d0873ebSEmmanuel Vadot riscv,children = <&aplic3>; 161*7d0873ebSEmmanuel Vadot riscv,delegation = <&aplic3 1 63>; 162*7d0873ebSEmmanuel Vadot }; 163*7d0873ebSEmmanuel Vadot 164*7d0873ebSEmmanuel Vadot aplic3: interrupt-controller@d000000 { 165*7d0873ebSEmmanuel Vadot compatible = "qemu,aplic", "riscv,aplic"; 166*7d0873ebSEmmanuel Vadot msi-parent = <&imsic_slevel>; 167*7d0873ebSEmmanuel Vadot reg = <0xd000000 0x4000>; 168*7d0873ebSEmmanuel Vadot interrupt-controller; 169*7d0873ebSEmmanuel Vadot #interrupt-cells = <2>; 170*7d0873ebSEmmanuel Vadot riscv,num-sources = <63>; 171*7d0873ebSEmmanuel Vadot }; 172*7d0873ebSEmmanuel Vadot... 173