riscv,imsics.yaml 5.3 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,imsics.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: RISC-V Incoming MSI Controller (IMSIC)
  7. maintainers:
  8. - Anup Patel <anup@brainfault.org>
  9. description: |
  10. The RISC-V advanced interrupt architecture (AIA) defines a per-CPU incoming
  11. MSI controller (IMSIC) for handling MSIs in a RISC-V platform. The RISC-V
  12. AIA specification can be found at https://github.com/riscv/riscv-aia.
  13. The IMSIC is a per-CPU (or per-HART) device with separate interrupt file
  14. for each privilege level (machine or supervisor). The configuration of
  15. a IMSIC interrupt file is done using AIA CSRs and it also has a 4KB MMIO
  16. space to receive MSIs from devices. Each IMSIC interrupt file supports a
  17. fixed number of interrupt identities (to distinguish MSIs from devices)
  18. which is same for given privilege level across CPUs (or HARTs).
  19. The device tree of a RISC-V platform will have one IMSIC device tree node
  20. for each privilege level (machine or supervisor) which collectively describe
  21. IMSIC interrupt files at that privilege level across CPUs (or HARTs).
  22. The arrangement of IMSIC interrupt files in MMIO space of a RISC-V platform
  23. follows a particular scheme defined by the RISC-V AIA specification. A IMSIC
  24. group is a set of IMSIC interrupt files co-located in MMIO space and we can
  25. have multiple IMSIC groups (i.e. clusters, sockets, chiplets, etc) in a
  26. RISC-V platform. The MSI target address of a IMSIC interrupt file at given
  27. privilege level (machine or supervisor) encodes group index, HART index,
  28. and guest index (shown below).
  29. XLEN-1 > (HART Index MSB) 12 0
  30. | | | |
  31. -------------------------------------------------------------
  32. |xxxxxx|Group Index|xxxxxxxxxxx|HART Index|Guest Index| 0 |
  33. -------------------------------------------------------------
  34. allOf:
  35. - $ref: /schemas/interrupt-controller.yaml#
  36. - $ref: /schemas/interrupt-controller/msi-controller.yaml#
  37. properties:
  38. compatible:
  39. items:
  40. - enum:
  41. - qemu,imsics
  42. - const: riscv,imsics
  43. reg:
  44. minItems: 1
  45. maxItems: 16384
  46. description:
  47. Base address of each IMSIC group.
  48. interrupt-controller: true
  49. "#interrupt-cells":
  50. const: 0
  51. msi-controller: true
  52. "#msi-cells":
  53. const: 0
  54. interrupts-extended:
  55. minItems: 1
  56. maxItems: 16384
  57. description:
  58. This property represents the set of CPUs (or HARTs) for which given
  59. device tree node describes the IMSIC interrupt files. Each node pointed
  60. to should be a riscv,cpu-intc node, which has a CPU node (i.e. RISC-V
  61. HART) as parent.
  62. riscv,num-ids:
  63. $ref: /schemas/types.yaml#/definitions/uint32
  64. minimum: 63
  65. maximum: 2047
  66. description:
  67. Number of interrupt identities supported by IMSIC interrupt file.
  68. riscv,num-guest-ids:
  69. $ref: /schemas/types.yaml#/definitions/uint32
  70. minimum: 63
  71. maximum: 2047
  72. description:
  73. Number of interrupt identities are supported by IMSIC guest interrupt
  74. file. When not specified it is assumed to be same as specified by the
  75. riscv,num-ids property.
  76. riscv,guest-index-bits:
  77. minimum: 0
  78. maximum: 7
  79. default: 0
  80. description:
  81. Number of guest index bits in the MSI target address.
  82. riscv,hart-index-bits:
  83. minimum: 0
  84. maximum: 15
  85. description:
  86. Number of HART index bits in the MSI target address. When not
  87. specified it is calculated based on the interrupts-extended property.
  88. riscv,group-index-bits:
  89. minimum: 0
  90. maximum: 7
  91. default: 0
  92. description:
  93. Number of group index bits in the MSI target address.
  94. riscv,group-index-shift:
  95. $ref: /schemas/types.yaml#/definitions/uint32
  96. minimum: 0
  97. maximum: 55
  98. default: 24
  99. description:
  100. The least significant bit position of the group index bits in the
  101. MSI target address.
  102. required:
  103. - compatible
  104. - reg
  105. - interrupt-controller
  106. - msi-controller
  107. - "#msi-cells"
  108. - interrupts-extended
  109. - riscv,num-ids
  110. unevaluatedProperties: false
  111. examples:
  112. - |
  113. // Example 1 (Machine-level IMSIC files with just one group):
  114. interrupt-controller@24000000 {
  115. compatible = "qemu,imsics", "riscv,imsics";
  116. interrupts-extended = <&cpu1_intc 11>,
  117. <&cpu2_intc 11>,
  118. <&cpu3_intc 11>,
  119. <&cpu4_intc 11>;
  120. reg = <0x28000000 0x4000>;
  121. interrupt-controller;
  122. #interrupt-cells = <0>;
  123. msi-controller;
  124. #msi-cells = <0>;
  125. riscv,num-ids = <127>;
  126. };
  127. - |
  128. // Example 2 (Supervisor-level IMSIC files with two groups):
  129. interrupt-controller@28000000 {
  130. compatible = "qemu,imsics", "riscv,imsics";
  131. interrupts-extended = <&cpu1_intc 9>,
  132. <&cpu2_intc 9>,
  133. <&cpu3_intc 9>,
  134. <&cpu4_intc 9>;
  135. reg = <0x28000000 0x2000>, /* Group0 IMSICs */
  136. <0x29000000 0x2000>; /* Group1 IMSICs */
  137. interrupt-controller;
  138. #interrupt-cells = <0>;
  139. msi-controller;
  140. #msi-cells = <0>;
  141. riscv,num-ids = <127>;
  142. riscv,group-index-bits = <1>;
  143. riscv,group-index-shift = <24>;
  144. };
  145. ...