# RISC-V Incoming MSI Controller (IMSIC)

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Interrupt controller bindings_

> Device-tree binding reference for RISC-V Incoming MSI Controller (IMSIC).

<!-- SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;interrupt&#45;controller&#47;riscv&#44;imsics&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Anup Patel &#60;anup&#64;brainfault&#46;org&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">The RISC-V advanced interrupt architecture (AIA) defines a per-CPU incoming
MSI controller (IMSIC) for handling MSIs in a RISC-V platform. The RISC-V
AIA specification can be found at https://github.com/riscv/riscv-aia.</p>
<p style="white-space: pre-wrap">The IMSIC is a per-CPU (or per-HART) device with separate interrupt file
for each privilege level (machine or supervisor). The configuration of
a IMSIC interrupt file is done using AIA CSRs and it also has a 4KB MMIO
space to receive MSIs from devices. Each IMSIC interrupt file supports a
fixed number of interrupt identities (to distinguish MSIs from devices)
which is same for given privilege level across CPUs (or HARTs).</p>
<p style="white-space: pre-wrap">The device tree of a RISC-V platform will have one IMSIC device tree node
for each privilege level (machine or supervisor) which collectively describe
IMSIC interrupt files at that privilege level across CPUs (or HARTs).</p>
<p style="white-space: pre-wrap">The arrangement of IMSIC interrupt files in MMIO space of a RISC-V platform
follows a particular scheme defined by the RISC-V AIA specification. A IMSIC
group is a set of IMSIC interrupt files co-located in MMIO space and we can
have multiple IMSIC groups (i.e. clusters, sockets, chiplets, etc) in a
RISC-V platform. The MSI target address of a IMSIC interrupt file at given
privilege level (machine or supervisor) encodes group index, HART index,
and guest index (shown below).</p>
<p style="white-space: pre-wrap">XLEN-1            &gt; (HART Index MSB)                  12    0
|                  |                                  |     |
-------------------------------------------------------------
|xxxxxx|Group Index|xxxxxxxxxxx|HART Index|Guest Index|  0  |
-------------------------------------------------------------</p>
</div>

<a id="dt-935ee547587f3e75de61"></a>

## All of these rules must match (<code>allOf</code>)

<a id="dt-d33de94ac1d3652cd22a"></a>

### Rule 1

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-95c8874f25311f4b1ab1">[<code>&#47;schemas&#47;interrupt&#45;controller&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-shared/interrupt-controller.md#dt-root>)</span>

<a id="dt-22ca5ec5b89308748ecc"></a>

### Rule 2

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-8549616abc3b04702c51">[<code>&#47;schemas&#47;interrupt&#45;controller&#47;msi&#45;controller&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-interrupt-controller/msi-controller.md#dt-root>)</span>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — required here

<a id="dt-cc3709943397035582d2"></a>

#### Array item rules (<code>items</code>)

<a id="dt-fec97e71a4359503ae6e"></a>

**Item 1**

> **Allowed values (<code>enum</code>):** <a id="dt-851ace07a50c83495949"></a> <span id="dt-63b688f2ccd82724cb8f"><code>&#34;qemu&#44;imsics&#34;</code></span>, <span id="dt-2d97ae0f34d14dd8e72b"><code>&#34;spacemit&#44;k3&#45;imsics&#34;</code></span>

<a id="dt-0891c69625632ea817fd"></a>

**Item 2**

> **Exact value (<code>const</code>):** <span id="dt-f1f862a3cfab3ac620c8"><code>&#34;riscv&#44;imsics&#34;</code></span>

<a id="dt-9c1635fdb65d87e33d77"></a>

### <code>reg</code> — required here

**Minimum number of items (<code>minItems</code>):** <span id="dt-4b3e7791b11b96c3db87"><code>1</code></span>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-71421d35675d9a533ad2"><code>16384</code></span>

<div id="dt-571d87f60678ead6c5ff">
<p style="white-space: pre-wrap">Base address of each IMSIC group.</p>
</div>

<a id="dt-b98252f9c39642b1db8f"></a>

### <code>interrupt&#45;controller</code> — required here

<code>true</code> — No constraints added by this property rule.

<a id="dt-8586fac2d9a71adf4795"></a>

### <code>&#35;interrupt&#45;cells</code> — not listed as required here

**Exact value (<code>const</code>):** <span id="dt-317bbf786489389e8233"><code>0</code></span>

<a id="dt-2614987f6ab7ae9e99b5"></a>

### <code>msi&#45;controller</code> — required here

<code>true</code> — No constraints added by this property rule.

<a id="dt-bc77e949c35366999180"></a>

### <code>&#35;msi&#45;cells</code> — required here

**Exact value (<code>const</code>):** <span id="dt-6343f5dac24054414061"><code>0</code></span>

<a id="dt-bb6bf440c9aa134fafb2"></a>

### <code>interrupts&#45;extended</code> — required here

**Minimum number of items (<code>minItems</code>):** <span id="dt-17ac127356ee8de84b32"><code>1</code></span>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-0fa45bd7e7f39b9405fc"><code>16384</code></span>

<div id="dt-374fadb395de5ea0d76c">
<p style="white-space: pre-wrap">This property represents the set of CPUs (or HARTs) for which given device tree node describes the IMSIC interrupt files. Each node pointed to should be a riscv,cpu-intc node, which has a CPU node (i.e. RISC-V HART) as parent.</p>
</div>

<a id="dt-f2fb35d977fb93a44a99"></a>

### <code>riscv&#44;num&#45;ids</code> — required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-d5a717d65bb53d951f69">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d57795d6573ee5d67d37>)</span>

**Minimum value (<code>minimum</code>):** <span id="dt-93fd07e079f9c0328229"><code>63</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-2d97c9487600853cd7b7"><code>2047</code></span>

<div id="dt-663c535012220525ad55">
<p style="white-space: pre-wrap">Number of interrupt identities supported by IMSIC interrupt file.</p>
</div>

<a id="dt-699e870a17a36ef7d642"></a>

### <code>riscv&#44;num&#45;guest&#45;ids</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-e087889b1131235e9262">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d57795d6573ee5d67d37>)</span>

**Minimum value (<code>minimum</code>):** <span id="dt-7662a022dacd68a3da7e"><code>63</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-11119d63d08583a8389c"><code>2047</code></span>

<div id="dt-16908cc85c33d19e5533">
<p style="white-space: pre-wrap">Number of interrupt identities are supported by IMSIC guest interrupt file. When not specified it is assumed to be same as specified by the riscv,num-ids property.</p>
</div>

<a id="dt-6d9aa8d07fd6c8f7880e"></a>

### <code>riscv&#44;guest&#45;index&#45;bits</code> — not listed as required here

**Minimum value (<code>minimum</code>):** <span id="dt-858c39785ce8659b7c49"><code>0</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-74f9ae1641ba7d8be648"><code>7</code></span>

**Default value (<code>default</code>):** <span id="dt-0b8f9ccda4bf936c7240"><code>0</code></span>

<div id="dt-ca86837d1505a2259a5c">
<p style="white-space: pre-wrap">Number of guest index bits in the MSI target address.</p>
</div>

<a id="dt-fcb54b6eff21e243a963"></a>

### <code>riscv&#44;hart&#45;index&#45;bits</code> — not listed as required here

**Minimum value (<code>minimum</code>):** <span id="dt-331d34aa54c2d4670fe5"><code>0</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-352a1954e4651d388e2b"><code>15</code></span>

<div id="dt-aa20d63022f3227ecceb">
<p style="white-space: pre-wrap">Number of HART index bits in the MSI target address. When not specified it is calculated based on the interrupts-extended property.</p>
</div>

<a id="dt-f595b57d9bf334de7a36"></a>

### <code>riscv&#44;group&#45;index&#45;bits</code> — not listed as required here

**Minimum value (<code>minimum</code>):** <span id="dt-2333e54f04cee8373eb3"><code>0</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-88d650eb0dc50a2227fc"><code>7</code></span>

**Default value (<code>default</code>):** <span id="dt-b60016526bba1dbd55e5"><code>0</code></span>

<div id="dt-0d6c223bd3a4b849857a">
<p style="white-space: pre-wrap">Number of group index bits in the MSI target address.</p>
</div>

<a id="dt-8bbe60fc5ed9bc25438e"></a>

### <code>riscv&#44;group&#45;index&#45;shift</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-fc62131a76d12e5ac174">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d57795d6573ee5d67d37>)</span>

**Minimum value (<code>minimum</code>):** <span id="dt-715327340c891fb40694"><code>0</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-957307c52b3f1e57dc0c"><code>55</code></span>

**Default value (<code>default</code>):** <span id="dt-4e74b9599693abc47350"><code>24</code></span>

<div id="dt-b71357d189c192d6e666">
<p style="white-space: pre-wrap">The least significant bit position of the group index bits in the MSI target address.</p>
</div>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;compatible&#34;</code></span>, <span id="dt-ee7433925c1528c16b99"><code>&#34;reg&#34;</code></span>, <span id="dt-f3765998c4e103e45f2f"><code>&#34;interrupt&#45;controller&#34;</code></span>, <span id="dt-329d9b3604d5b98bc19d"><code>&#34;msi&#45;controller&#34;</code></span>, <span id="dt-391b1d2b563ec12ed437"><code>&#34;&#35;msi&#45;cells&#34;</code></span>, <span id="dt-c127a87237cb22622910"><code>&#34;interrupts&#45;extended&#34;</code></span>, <span id="dt-a5d07fc4223c155670a0"><code>&#34;riscv&#44;num&#45;ids&#34;</code></span>

<a id="dt-63ab525a9812ac23c446"></a>

## Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">// Example 1 (Machine-level IMSIC files with just one group):

interrupt-controller@24000000 {
  compatible = "qemu,imsics", "riscv,imsics";
  interrupts-extended = &lt;&amp;cpu1_intc 11&gt;,
                        &lt;&amp;cpu2_intc 11&gt;,
                        &lt;&amp;cpu3_intc 11&gt;,
                        &lt;&amp;cpu4_intc 11&gt;;
  reg = &lt;0x24000000 0x4000&gt;;
  interrupt-controller;
  #interrupt-cells = &lt;0&gt;;
  msi-controller;
  #msi-cells = &lt;0&gt;;
  riscv,num-ids = &lt;127&gt;;
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">// Example 2 (Supervisor-level IMSIC files with two groups):

interrupt-controller@28000000 {
  compatible = "qemu,imsics", "riscv,imsics";
  interrupts-extended = &lt;&amp;cpu1_intc 9&gt;,
                        &lt;&amp;cpu2_intc 9&gt;,
                        &lt;&amp;cpu3_intc 9&gt;,
                        &lt;&amp;cpu4_intc 9&gt;;
  reg = &lt;0x28000000 0x2000&gt;, /* Group0 IMSICs */
        &lt;0x29000000 0x2000&gt;; /* Group1 IMSICs */
  interrupt-controller;
  #interrupt-cells = &lt;0&gt;;
  msi-controller;
  #msi-cells = &lt;0&gt;;
  riscv,num-ids = &lt;127&gt;;
  riscv,group-index-bits = &lt;1&gt;;
  riscv,group-index-shift = &lt;24&gt;;
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)</span></p>

</details>
