xref: /linux/Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml (revision 1260ed77798502de9c98020040d2995008de10cc)
13b806a5aSAnup Patel# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
23b806a5aSAnup Patel%YAML 1.2
33b806a5aSAnup Patel---
43b806a5aSAnup Patel$id: http://devicetree.org/schemas/interrupt-controller/riscv,aplic.yaml#
53b806a5aSAnup Patel$schema: http://devicetree.org/meta-schemas/core.yaml#
63b806a5aSAnup Patel
73b806a5aSAnup Pateltitle: RISC-V Advanced Platform Level Interrupt Controller (APLIC)
83b806a5aSAnup Patel
93b806a5aSAnup Patelmaintainers:
103b806a5aSAnup Patel  - Anup Patel <anup@brainfault.org>
113b806a5aSAnup Patel
123b806a5aSAnup Pateldescription:
133b806a5aSAnup Patel  The RISC-V advanced interrupt architecture (AIA) defines an advanced
143b806a5aSAnup Patel  platform level interrupt controller (APLIC) for handling wired interrupts
153b806a5aSAnup Patel  in a RISC-V platform. The RISC-V AIA specification can be found at
163b806a5aSAnup Patel  https://github.com/riscv/riscv-aia.
173b806a5aSAnup Patel
183b806a5aSAnup Patel  The RISC-V APLIC is implemented as hierarchical APLIC domains where all
193b806a5aSAnup Patel  interrupt sources connect to the root APLIC domain and a parent APLIC
203b806a5aSAnup Patel  domain can delegate interrupt sources to it's child APLIC domains. There
213b806a5aSAnup Patel  is one device tree node for each APLIC domain.
223b806a5aSAnup Patel
233b806a5aSAnup PatelallOf:
243b806a5aSAnup Patel  - $ref: /schemas/interrupt-controller.yaml#
253b806a5aSAnup Patel
263b806a5aSAnup Patelproperties:
273b806a5aSAnup Patel  compatible:
283b806a5aSAnup Patel    items:
293b806a5aSAnup Patel      - enum:
303b806a5aSAnup Patel          - qemu,aplic
313b806a5aSAnup Patel      - const: riscv,aplic
323b806a5aSAnup Patel
333b806a5aSAnup Patel  reg:
343b806a5aSAnup Patel    maxItems: 1
353b806a5aSAnup Patel
363b806a5aSAnup Patel  interrupt-controller: true
373b806a5aSAnup Patel
383b806a5aSAnup Patel  "#interrupt-cells":
393b806a5aSAnup Patel    const: 2
403b806a5aSAnup Patel
413b806a5aSAnup Patel  interrupts-extended:
423b806a5aSAnup Patel    minItems: 1
433b806a5aSAnup Patel    maxItems: 16384
443b806a5aSAnup Patel    description:
453b806a5aSAnup Patel      Given APLIC domain directly injects external interrupts to a set of
463b806a5aSAnup Patel      RISC-V HARTS (or CPUs). Each node pointed to should be a riscv,cpu-intc
473b806a5aSAnup Patel      node, which has a CPU node (i.e. RISC-V HART) as parent.
483b806a5aSAnup Patel
493b806a5aSAnup Patel  msi-parent:
503b806a5aSAnup Patel    description:
513b806a5aSAnup Patel      Given APLIC domain forwards wired interrupts as MSIs to a AIA incoming
523b806a5aSAnup Patel      message signaled interrupt controller (IMSIC). If both "msi-parent" and
533b806a5aSAnup Patel      "interrupts-extended" properties are present then it means the APLIC
543b806a5aSAnup Patel      domain supports both MSI mode and Direct mode in HW. In this case, the
553b806a5aSAnup Patel      APLIC driver has to choose between MSI mode or Direct mode.
563b806a5aSAnup Patel
573b806a5aSAnup Patel  riscv,num-sources:
583b806a5aSAnup Patel    $ref: /schemas/types.yaml#/definitions/uint32
593b806a5aSAnup Patel    minimum: 1
603b806a5aSAnup Patel    maximum: 1023
613b806a5aSAnup Patel    description:
623b806a5aSAnup Patel      Specifies the number of wired interrupt sources supported by this
633b806a5aSAnup Patel      APLIC domain.
643b806a5aSAnup Patel
653b806a5aSAnup Patel  riscv,children:
663b806a5aSAnup Patel    $ref: /schemas/types.yaml#/definitions/phandle-array
673b806a5aSAnup Patel    minItems: 1
683b806a5aSAnup Patel    maxItems: 1024
693b806a5aSAnup Patel    items:
703b806a5aSAnup Patel      maxItems: 1
713b806a5aSAnup Patel    description:
723b806a5aSAnup Patel      A list of child APLIC domains for the given APLIC domain. Each child
733b806a5aSAnup Patel      APLIC domain is assigned a child index in increasing order, with the
743b806a5aSAnup Patel      first child APLIC domain assigned child index 0. The APLIC domain child
753b806a5aSAnup Patel      index is used by firmware to delegate interrupts from the given APLIC
763b806a5aSAnup Patel      domain to a particular child APLIC domain.
773b806a5aSAnup Patel
783b806a5aSAnup Patel  riscv,delegation:
793b806a5aSAnup Patel    $ref: /schemas/types.yaml#/definitions/phandle-array
803b806a5aSAnup Patel    minItems: 1
813b806a5aSAnup Patel    maxItems: 1024
823b806a5aSAnup Patel    items:
833b806a5aSAnup Patel      items:
843b806a5aSAnup Patel        - description: child APLIC domain phandle
853b806a5aSAnup Patel        - description: first interrupt number of the parent APLIC domain (inclusive)
863b806a5aSAnup Patel        - description: last interrupt number of the parent APLIC domain (inclusive)
873b806a5aSAnup Patel    description:
883b806a5aSAnup Patel      A interrupt delegation list where each entry is a triple consisting
893b806a5aSAnup Patel      of child APLIC domain phandle, first interrupt number of the parent
903b806a5aSAnup Patel      APLIC domain, and last interrupt number of the parent APLIC domain.
913b806a5aSAnup Patel      Firmware must configure interrupt delegation registers based on
923b806a5aSAnup Patel      interrupt delegation list.
933b806a5aSAnup Patel
94*c057b6e4SVladimir Kondratiev  riscv,hart-indexes:
95*c057b6e4SVladimir Kondratiev    $ref: /schemas/types.yaml#/definitions/uint32-array
96*c057b6e4SVladimir Kondratiev    minItems: 1
97*c057b6e4SVladimir Kondratiev    maxItems: 16384
98*c057b6e4SVladimir Kondratiev    description:
99*c057b6e4SVladimir Kondratiev      A list of hart indexes that APLIC should use to address each hart
100*c057b6e4SVladimir Kondratiev      that is mentioned in the "interrupts-extended"
101*c057b6e4SVladimir Kondratiev
1023b806a5aSAnup Pateldependencies:
1033b806a5aSAnup Patel  riscv,delegation: [ "riscv,children" ]
1043b806a5aSAnup Patel
1053b806a5aSAnup Patelrequired:
1063b806a5aSAnup Patel  - compatible
1073b806a5aSAnup Patel  - reg
1083b806a5aSAnup Patel  - interrupt-controller
1093b806a5aSAnup Patel  - "#interrupt-cells"
1103b806a5aSAnup Patel  - riscv,num-sources
1113b806a5aSAnup Patel
1123b806a5aSAnup PatelanyOf:
1133b806a5aSAnup Patel  - required:
1143b806a5aSAnup Patel      - interrupts-extended
1153b806a5aSAnup Patel  - required:
1163b806a5aSAnup Patel      - msi-parent
1173b806a5aSAnup Patel
1183b806a5aSAnup PatelunevaluatedProperties: false
1193b806a5aSAnup Patel
1203b806a5aSAnup Patelexamples:
1213b806a5aSAnup Patel  - |
1223b806a5aSAnup Patel    // Example 1 (APLIC domains directly injecting interrupt to HARTs):
1233b806a5aSAnup Patel
1243b806a5aSAnup Patel    interrupt-controller@c000000 {
1253b806a5aSAnup Patel      compatible = "qemu,aplic", "riscv,aplic";
1263b806a5aSAnup Patel      interrupts-extended = <&cpu1_intc 11>,
1273b806a5aSAnup Patel                            <&cpu2_intc 11>,
1283b806a5aSAnup Patel                            <&cpu3_intc 11>,
1293b806a5aSAnup Patel                            <&cpu4_intc 11>;
1303b806a5aSAnup Patel      reg = <0xc000000 0x4080>;
1313b806a5aSAnup Patel      interrupt-controller;
1323b806a5aSAnup Patel      #interrupt-cells = <2>;
1333b806a5aSAnup Patel      riscv,num-sources = <63>;
1343b806a5aSAnup Patel      riscv,children = <&aplic1>, <&aplic2>;
1353b806a5aSAnup Patel      riscv,delegation = <&aplic1 1 63>;
1363b806a5aSAnup Patel    };
1373b806a5aSAnup Patel
1383b806a5aSAnup Patel    aplic1: interrupt-controller@d000000 {
1393b806a5aSAnup Patel      compatible = "qemu,aplic", "riscv,aplic";
1403b806a5aSAnup Patel      interrupts-extended = <&cpu1_intc 9>,
1413b806a5aSAnup Patel                            <&cpu2_intc 9>;
1423b806a5aSAnup Patel      reg = <0xd000000 0x4080>;
1433b806a5aSAnup Patel      interrupt-controller;
1443b806a5aSAnup Patel      #interrupt-cells = <2>;
1453b806a5aSAnup Patel      riscv,num-sources = <63>;
1463b806a5aSAnup Patel    };
1473b806a5aSAnup Patel
1483b806a5aSAnup Patel    aplic2: interrupt-controller@e000000 {
1493b806a5aSAnup Patel      compatible = "qemu,aplic", "riscv,aplic";
1503b806a5aSAnup Patel      interrupts-extended = <&cpu3_intc 9>,
1513b806a5aSAnup Patel                            <&cpu4_intc 9>;
1523b806a5aSAnup Patel      reg = <0xe000000 0x4080>;
1533b806a5aSAnup Patel      interrupt-controller;
1543b806a5aSAnup Patel      #interrupt-cells = <2>;
1553b806a5aSAnup Patel      riscv,num-sources = <63>;
1563b806a5aSAnup Patel    };
1573b806a5aSAnup Patel
1583b806a5aSAnup Patel  - |
1593b806a5aSAnup Patel    // Example 2 (APLIC domains forwarding interrupts as MSIs):
1603b806a5aSAnup Patel
1613b806a5aSAnup Patel    interrupt-controller@c000000 {
1623b806a5aSAnup Patel      compatible = "qemu,aplic", "riscv,aplic";
1633b806a5aSAnup Patel      msi-parent = <&imsic_mlevel>;
1643b806a5aSAnup Patel      reg = <0xc000000 0x4000>;
1653b806a5aSAnup Patel      interrupt-controller;
1663b806a5aSAnup Patel      #interrupt-cells = <2>;
1673b806a5aSAnup Patel      riscv,num-sources = <63>;
1683b806a5aSAnup Patel      riscv,children = <&aplic3>;
1693b806a5aSAnup Patel      riscv,delegation = <&aplic3 1 63>;
1703b806a5aSAnup Patel    };
1713b806a5aSAnup Patel
1723b806a5aSAnup Patel    aplic3: interrupt-controller@d000000 {
1733b806a5aSAnup Patel      compatible = "qemu,aplic", "riscv,aplic";
1743b806a5aSAnup Patel      msi-parent = <&imsic_slevel>;
1753b806a5aSAnup Patel      reg = <0xd000000 0x4000>;
1763b806a5aSAnup Patel      interrupt-controller;
1773b806a5aSAnup Patel      #interrupt-cells = <2>;
1783b806a5aSAnup Patel      riscv,num-sources = <63>;
1793b806a5aSAnup Patel    };
1803b806a5aSAnup Patel...
181