riscv,aplic.yaml 5.2 KB

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