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