# RISC-V CPUs

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

> Device-tree binding reference for RISC-V CPUs.

<!-- SPDX-License-Identifier: (GPL-2.0 OR MIT) -->


<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;riscv&#47;cpus&#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;Paul Walmsley &#60;paul&#46;walmsley&#64;sifive&#46;com&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Palmer Dabbelt &#60;palmer&#64;sifive&#46;com&#62;&#34;</code></span>, <span id="dt-2f1516674166ff6e66b8"><code>&#34;Conor Dooley &#60;conor&#64;kernel&#46;org&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">This document uses some terminology common to the RISC-V community
that is not widely used, the definitions of which are listed here:</p>
<p style="white-space: pre-wrap">hart: A hardware execution context, which contains all the state
mandated by the RISC-V ISA: a PC and some registers.  This
terminology is designed to disambiguate software's view of execution
contexts from any particular microarchitectural implementation
strategy.  For example, an Intel laptop containing one socket with
two cores, each of which has two hyperthreads, could be described as
having four harts.</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;cpu&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-shared/cpu.md#dt-root>)</span>

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

### Rule 2

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-8549616abc3b04702c51">[<code>extensions&#46;yaml</code>](</kernel/hardware/devicetree-bindings/dt-riscv/extensions.md#dt-root>)</span>

<a id="dt-317510ea5c8bf789ca60"></a>

### Rule 3

> <a id="dt-15ef78abba37234c7e3a"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-ef222142ff9d3190ed20"></a>
> >
> > **This rule must not match (<code>not</code>)**
> >
> > > <a id="dt-4987b4debb3a74d94c5b"></a>
> > >
> > > **Properties and child nodes (<code>properties</code>)**
> > >
> > > <a id="dt-ac7b0d241b0eeac3f8cf"></a>
> > >
> > > **<code>compatible</code> — not listed as required here**
> > >
> > > <a id="dt-bd6e7c649225ce52037a"></a>
> > >
> > > **Rule for matching array elements (<code>contains</code>)**
> > >
> > > > **Allowed values (<code>enum</code>):** <a id="dt-fd10450fb4fc48d60cff"></a> <span id="dt-a53b1d1c12f88be042f7"><code>&#34;thead&#44;c906&#34;</code></span>, <span id="dt-40123c56d322becfcf47"><code>&#34;thead&#44;c910&#34;</code></span>, <span id="dt-243ed75c7dbbaef8b408"><code>&#34;thead&#44;c920&#34;</code></span>
>
> <a id="dt-86c371e5831ff1f84ce5"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > <a id="dt-4b2e0558620eefde94e1"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-c576f59d0b52c9b9f9f4"></a>
> >
> > **<code>thead&#44;vlenb</code> — not listed as required here**
> >
> > <code>false</code> — Not permitted by this property rule.

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

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

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

### <code>compatible</code> — not listed as required here

<a id="dt-39566f01414e34c67b85"></a>

#### Exactly one of these rules must match (<code>oneOf</code>)

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

**Rule 1**

> <a id="dt-07409cc9508405f48983"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-822691c82c9797f7b1f9"></a>
>
> **Item 1**
>
> > **Allowed values (<code>enum</code>):** <a id="dt-3b212051dcd0fc641cd8"></a> <span id="dt-bd6e6716d05ec45653db"><code>&#34;amd&#44;mbv32&#34;</code></span>, <span id="dt-3e7fb897881b12f43f81"><code>&#34;amd&#44;mbv64&#34;</code></span>, <span id="dt-b7d19de74fd35364d49f"><code>&#34;andestech&#44;ax45mp&#34;</code></span>, <span id="dt-6cbdeefc52e7132bc62c"><code>&#34;canaan&#44;k210&#34;</code></span>, <span id="dt-fd88adda17227ca32776"><code>&#34;nuclei&#44;ux900&#34;</code></span>, <span id="dt-f0dfbb755d86acc4c265"><code>&#34;sifive&#44;bullet0&#34;</code></span>, <span id="dt-fd90c4a6b4c12fdce245"><code>&#34;sifive&#44;e5&#34;</code></span>, <span id="dt-e2dcb0e367ca5c3b7bca"><code>&#34;sifive&#44;e7&#34;</code></span>, <span id="dt-8f172ba5f5ba57694b17"><code>&#34;sifive&#44;e71&#34;</code></span>, <span id="dt-818bfc86902057a0cfa5"><code>&#34;sifive&#44;p550&#34;</code></span>, <span id="dt-40cc8e0354bd3c46c2b0"><code>&#34;sifive&#44;rocket0&#34;</code></span>, <span id="dt-a51a88fcd7865e1371b5"><code>&#34;sifive&#44;s7&#34;</code></span>, <span id="dt-23e0456f1590624d28e6"><code>&#34;sifive&#44;u5&#34;</code></span>, <span id="dt-97919bd8d4cffc92f04e"><code>&#34;sifive&#44;u54&#34;</code></span>, <span id="dt-e645e3f9d6254b0c4193"><code>&#34;sifive&#44;u7&#34;</code></span>, <span id="dt-582ea23e6d93a2ab2899"><code>&#34;sifive&#44;u74&#34;</code></span>, <span id="dt-ec4788eeb35c9e532697"><code>&#34;sifive&#44;u74&#45;mc&#34;</code></span>, <span id="dt-ce811e7f5e306c3785e9"><code>&#34;spacemit&#44;x100&#34;</code></span>, <span id="dt-6f653cf4e4f652d90d72"><code>&#34;spacemit&#44;x60&#34;</code></span>, <span id="dt-ab188e9930e05044e305"><code>&#34;thead&#44;c906&#34;</code></span>, <span id="dt-c622a051d6a3347abd43"><code>&#34;thead&#44;c908&#34;</code></span>, <span id="dt-ef02f0552f26ea41f697"><code>&#34;thead&#44;c910&#34;</code></span>, <span id="dt-1f14585309ea54d5cf7a"><code>&#34;thead&#44;c920&#34;</code></span>
>
> <a id="dt-bc83d1191bdc72da8559"></a>
>
> **Item 2**
>
> > **Exact value (<code>const</code>):** <span id="dt-1da74b37131fdcec1073"><code>&#34;riscv&#34;</code></span>

<a id="dt-7482b6e745c4f056161a"></a>

**Rule 2**

> <a id="dt-4c3e118873fbaedb5de2"></a>
>
> **Array item rules (<code>items</code>)**
>
> <a id="dt-b02d8860067795c00ae4"></a>
>
> **Item 1**
>
> > **Allowed values (<code>enum</code>):** <a id="dt-aa1230b5a2b80f9fb387"></a> <span id="dt-49b534c9c8948cfc8034"><code>&#34;sifive&#44;e51&#34;</code></span>, <span id="dt-93451931f534c9a92fb4"><code>&#34;sifive&#44;u54&#45;mc&#34;</code></span>, <span id="dt-bdca084879537277097b"><code>&#34;sifive&#44;x280&#34;</code></span>
>
> <a id="dt-bdc26de0ccb1d52bb6a4"></a>
>
> **Item 2**
>
> > **Exact value (<code>const</code>):** <span id="dt-cc26fa5d96bc7cf0a818"><code>&#34;sifive&#44;rocket0&#34;</code></span>
>
> <a id="dt-1655c7bc2063a21f60f8"></a>
>
> **Item 3**
>
> > **Exact value (<code>const</code>):** <span id="dt-7c57653c6bcac024338a"><code>&#34;riscv&#34;</code></span>

<a id="dt-39cb5b72c94e12bd53ea"></a>

**Rule 3**

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

<div id="dt-e84064a2d568e9bcb9c3">
<p style="white-space: pre-wrap">Identifies that the hart uses the RISC-V instruction set and identifies the type of the hart.</p>
</div>

<a id="dt-2b6bb6e6fd81daf15883"></a>

### <code>mmu&#45;type</code> — not listed as required here

<div id="dt-17dfce439c33bbfa1583">
<p style="white-space: pre-wrap">Identifies the largest MMU address translation mode supported by this hart.  These values originate from the RISC-V Privileged Specification document, available from https://riscv.org/specifications/</p>
</div>

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

**Allowed values (<code>enum</code>):** <a id="dt-e20cf1f10b5934bb0181"></a> <span id="dt-554c7aa7773746b8d1f2"><code>&#34;riscv&#44;sv32&#34;</code></span>, <span id="dt-0ce4a3184a51548f6519"><code>&#34;riscv&#44;sv39&#34;</code></span>, <span id="dt-2657a32b363dd0c82c89"><code>&#34;riscv&#44;sv48&#34;</code></span>, <span id="dt-afdcc953c042707ea5c0"><code>&#34;riscv&#44;sv57&#34;</code></span>, <span id="dt-420a579445bf525dd7bf"><code>&#34;riscv&#44;none&#34;</code></span>

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

### <code>reg</code> — not listed as required here

<div id="dt-571d87f60678ead6c5ff">
<p style="white-space: pre-wrap">The hart ID of this CPU node.</p>
</div>

<a id="dt-8383da4c9123acce74be"></a>

### <code>riscv&#44;cbom&#45;block&#45;size</code> — not listed as required here

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

<div id="dt-b3ec0f1400ca42f82a40">
<p style="white-space: pre-wrap">The blocksize in bytes for the Zicbom cache operations.</p>
</div>

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

### <code>riscv&#44;cbop&#45;block&#45;size</code> — not listed as required here

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

<div id="dt-084a3614eaf5c855f002">
<p style="white-space: pre-wrap">The blocksize in bytes for the Zicbop cache operations.</p>
</div>

<a id="dt-732b1735021ec7e7781e"></a>

### <code>riscv&#44;cboz&#45;block&#45;size</code> — not listed as required here

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

<div id="dt-1d53e4863d96b89a1f97">
<p style="white-space: pre-wrap">The blocksize in bytes for the Zicboz cache operations.</p>
</div>

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

### <code>thead&#44;vlenb</code> — not listed as required here

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

<div id="dt-bd1ace664a47365e5db8">
<p style="white-space: pre-wrap">VLEN/8, the vector register length in bytes. This property is required on thead systems where the vector register length is not identical on all harts, or the vlenb CSR is not available.</p>
</div>

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

### <code>cache&#45;op&#45;block&#45;size</code> — not listed as required here

<code>false</code> — Not permitted by this property rule.

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

### <code>timebase&#45;frequency</code> — not listed as required here

<code>false</code> — Not permitted by this property rule.

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

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

**Value type (<code>type</code>):** <span id="dt-a826dff3f34803983cac"><code>&#34;object&#34;</code></span>

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

<a id="dt-27a662e3d6f67ee28b0d"></a>

### <code>cpu&#45;idle&#45;states</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-8772b21d298e96ca2936">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;phandle&#45;array</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-8f5710c4314b4caa4970>)</span>

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

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

> **Maximum number of items (<code>maxItems</code>):** <span id="dt-480c7a38308fe4b07afb"><code>1</code></span>

<div id="dt-b17792463fcbf248cd22">
<p style="white-space: pre-wrap">List of phandles to idle state nodes supported
by this hart (see ./idle-states.yaml).</p>
</div>

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

### <code>capacity&#45;dmips&#45;mhz</code> — not listed as required here

<div id="dt-a64e00afbce2536634f6">
<p style="white-space: pre-wrap">u32 value representing CPU capacity (see ../cpu/cpu-capacity.txt) in DMIPS/MHz, relative to highest capacity-dmips-mhz in the system.</p>
</div>

<a id="dt-413065af65ac6af8f24e"></a>

## At least one of these rules must match (<code>anyOf</code>)

<a id="dt-96eb361b08260472facb"></a>

### Rule 1

> **Required in this object (<code>required</code>):** <a id="dt-a3ce052275bac2469e04"></a> <span id="dt-396aa8b3d1b1aeeb2c7a"><code>&#34;riscv&#44;isa&#34;</code></span>

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

### Rule 2

> **Required in this object (<code>required</code>):** <a id="dt-bb61b4b3827abc4e9b85"></a> <span id="dt-cffc196e945e46f91e3a"><code>&#34;riscv&#44;isa&#45;base&#34;</code></span>

<a id="dt-3d235861b18e278e9c09"></a>

## Property dependencies (<code>dependencies</code>)

<a id="dt-89fed31238903c035f15"></a>

### <code>riscv&#44;isa&#45;base</code> — applies when this property is present

Also requires: <span id="dt-e8e3ddd9fd38d9192c49"><code>&#34;riscv&#44;isa&#45;extensions&#34;</code></span>

<a id="dt-35bc2c2525cf71c2fdb8"></a>

### <code>riscv&#44;isa&#45;extensions</code> — applies when this property is present

Also requires: <span id="dt-f986408bbcc4be4c5780"><code>&#34;riscv&#44;isa&#45;base&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;interrupt&#45;controller&#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: SiFive Freedom U540G Development Kit
cpus {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;
    timebase-frequency = &lt;1000000&gt;;
    cpu@0 {
            clock-frequency = &lt;0&gt;;
            compatible = "sifive,rocket0", "riscv";
            device_type = "cpu";
            i-cache-block-size = &lt;64&gt;;
            i-cache-sets = &lt;128&gt;;
            i-cache-size = &lt;16384&gt;;
            reg = &lt;0&gt;;
            riscv,isa-base = "rv64i";
            riscv,isa-extensions = "i", "m", "a", "c";

            cpu_intc0: interrupt-controller {
                    #interrupt-cells = &lt;1&gt;;
                    compatible = "riscv,cpu-intc";
                    interrupt-controller;
            };
    };
    cpu@1 {
            clock-frequency = &lt;0&gt;;
            compatible = "sifive,rocket0", "riscv";
            d-cache-block-size = &lt;64&gt;;
            d-cache-sets = &lt;64&gt;;
            d-cache-size = &lt;32768&gt;;
            d-tlb-sets = &lt;1&gt;;
            d-tlb-size = &lt;32&gt;;
            device_type = "cpu";
            i-cache-block-size = &lt;64&gt;;
            i-cache-sets = &lt;64&gt;;
            i-cache-size = &lt;32768&gt;;
            i-tlb-sets = &lt;1&gt;;
            i-tlb-size = &lt;32&gt;;
            mmu-type = "riscv,sv39";
            reg = &lt;1&gt;;
            tlb-split;
            riscv,isa-base = "rv64i";
            riscv,isa-extensions = "i", "m", "a", "f", "d", "c";

            cpu_intc1: interrupt-controller {
                    #interrupt-cells = &lt;1&gt;;
                    compatible = "riscv,cpu-intc";
                    interrupt-controller;
            };
    };
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">// Example 2: Spike ISA Simulator with 1 Hart
cpus {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;
    cpu@0 {
            device_type = "cpu";
            reg = &lt;0&gt;;
            compatible = "riscv";
            mmu-type = "riscv,sv48";
            riscv,isa-base = "rv64i";
            riscv,isa-extensions = "i", "m", "a", "f", "d", "c";

            interrupt-controller {
                    #interrupt-cells = &lt;1&gt;;
                    interrupt-controller;
                    compatible = "riscv,cpu-intc";
            };
    };
};
</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 OR MIT)</span></p>

<p id="dt-comment-1"><strong>Line 78:</strong> <span> Simulator only</span></p>

<p id="dt-comment-2"><strong>Line 123:</strong> <span> RISC-V has multiple properties for cache op block sizes as the sizes</span></p>

<p id="dt-comment-3"><strong>Line 124:</strong> <span> differ between individual CBO extensions</span></p>

<p id="dt-comment-4"><strong>Line 126:</strong> <span> RISC-V requires 'timebase-frequency' in /cpus, so disallow it here</span></p>

</details>
