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