xref: /freebsd/sys/contrib/device-tree/Bindings/riscv/cpus.yaml (revision 84943d6f38e936ac3b7a3947ca26eeb27a39f938)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR MIT)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/riscv/cpus.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
78bab661aSEmmanuel Vadottitle: RISC-V CPUs
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Paul Walmsley <paul.walmsley@sifive.com>
11c66ec88fSEmmanuel Vadot  - Palmer Dabbelt <palmer@sifive.com>
127ef62cebSEmmanuel Vadot  - Conor Dooley <conor@kernel.org>
13c66ec88fSEmmanuel Vadot
14c66ec88fSEmmanuel Vadotdescription: |
15c66ec88fSEmmanuel Vadot  This document uses some terminology common to the RISC-V community
16c66ec88fSEmmanuel Vadot  that is not widely used, the definitions of which are listed here:
17c66ec88fSEmmanuel Vadot
18c66ec88fSEmmanuel Vadot  hart: A hardware execution context, which contains all the state
19c66ec88fSEmmanuel Vadot  mandated by the RISC-V ISA: a PC and some registers.  This
20c66ec88fSEmmanuel Vadot  terminology is designed to disambiguate software's view of execution
21c66ec88fSEmmanuel Vadot  contexts from any particular microarchitectural implementation
22c66ec88fSEmmanuel Vadot  strategy.  For example, an Intel laptop containing one socket with
23c66ec88fSEmmanuel Vadot  two cores, each of which has two hyperthreads, could be described as
24c66ec88fSEmmanuel Vadot  having four harts.
25c66ec88fSEmmanuel Vadot
26f126890aSEmmanuel VadotallOf:
27f126890aSEmmanuel Vadot  - $ref: /schemas/cpu.yaml#
28f126890aSEmmanuel Vadot  - $ref: extensions.yaml
29f126890aSEmmanuel Vadot
30c66ec88fSEmmanuel Vadotproperties:
31c66ec88fSEmmanuel Vadot  compatible:
32c66ec88fSEmmanuel Vadot    oneOf:
33c66ec88fSEmmanuel Vadot      - items:
34c66ec88fSEmmanuel Vadot          - enum:
358bab661aSEmmanuel Vadot              - andestech,ax45mp
368bab661aSEmmanuel Vadot              - canaan,k210
375def4c47SEmmanuel Vadot              - sifive,bullet0
38c66ec88fSEmmanuel Vadot              - sifive,e5
395def4c47SEmmanuel Vadot              - sifive,e7
405def4c47SEmmanuel Vadot              - sifive,e71
418bab661aSEmmanuel Vadot              - sifive,rocket0
42fac71e4eSEmmanuel Vadot              - sifive,s7
43c66ec88fSEmmanuel Vadot              - sifive,u5
448bab661aSEmmanuel Vadot              - sifive,u54
455def4c47SEmmanuel Vadot              - sifive,u7
468bab661aSEmmanuel Vadot              - sifive,u74
478bab661aSEmmanuel Vadot              - sifive,u74-mc
488bab661aSEmmanuel Vadot              - thead,c906
498bab661aSEmmanuel Vadot              - thead,c910
50*84943d6fSEmmanuel Vadot              - thead,c920
51c66ec88fSEmmanuel Vadot          - const: riscv
528cc087a1SEmmanuel Vadot      - items:
538cc087a1SEmmanuel Vadot          - enum:
548cc087a1SEmmanuel Vadot              - sifive,e51
558cc087a1SEmmanuel Vadot              - sifive,u54-mc
568cc087a1SEmmanuel Vadot          - const: sifive,rocket0
578cc087a1SEmmanuel Vadot          - const: riscv
58c66ec88fSEmmanuel Vadot      - const: riscv    # Simulator only
59c66ec88fSEmmanuel Vadot    description:
60c66ec88fSEmmanuel Vadot      Identifies that the hart uses the RISC-V instruction set
61c66ec88fSEmmanuel Vadot      and identifies the type of the hart.
62c66ec88fSEmmanuel Vadot
63c66ec88fSEmmanuel Vadot  mmu-type:
64c66ec88fSEmmanuel Vadot    description:
65c66ec88fSEmmanuel Vadot      Identifies the MMU address translation mode used on this
66c66ec88fSEmmanuel Vadot      hart.  These values originate from the RISC-V Privileged
67c66ec88fSEmmanuel Vadot      Specification document, available from
68c66ec88fSEmmanuel Vadot      https://riscv.org/specifications/
69f126890aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/string
70c66ec88fSEmmanuel Vadot    enum:
71c66ec88fSEmmanuel Vadot      - riscv,sv32
72c66ec88fSEmmanuel Vadot      - riscv,sv39
73c66ec88fSEmmanuel Vadot      - riscv,sv48
74fac71e4eSEmmanuel Vadot      - riscv,sv57
755def4c47SEmmanuel Vadot      - riscv,none
76c66ec88fSEmmanuel Vadot
77b97ee269SEmmanuel Vadot  riscv,cbom-block-size:
78b97ee269SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
79b97ee269SEmmanuel Vadot    description:
80b97ee269SEmmanuel Vadot      The blocksize in bytes for the Zicbom cache operations.
81b97ee269SEmmanuel Vadot
82fac71e4eSEmmanuel Vadot  riscv,cboz-block-size:
83fac71e4eSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
84fac71e4eSEmmanuel Vadot    description:
85fac71e4eSEmmanuel Vadot      The blocksize in bytes for the Zicboz cache operations.
86fac71e4eSEmmanuel Vadot
87f126890aSEmmanuel Vadot  # RISC-V has multiple properties for cache op block sizes as the sizes
88f126890aSEmmanuel Vadot  # differ between individual CBO extensions
89f126890aSEmmanuel Vadot  cache-op-block-size: false
90c66ec88fSEmmanuel Vadot  # RISC-V requires 'timebase-frequency' in /cpus, so disallow it here
91c66ec88fSEmmanuel Vadot  timebase-frequency: false
92c66ec88fSEmmanuel Vadot
93c66ec88fSEmmanuel Vadot  interrupt-controller:
94c66ec88fSEmmanuel Vadot    type: object
95aa1a8ff2SEmmanuel Vadot    additionalProperties: false
96c66ec88fSEmmanuel Vadot    description: Describes the CPU's local interrupt controller
97c66ec88fSEmmanuel Vadot
98c66ec88fSEmmanuel Vadot    properties:
99c66ec88fSEmmanuel Vadot      '#interrupt-cells':
100c66ec88fSEmmanuel Vadot        const: 1
101c66ec88fSEmmanuel Vadot
102c66ec88fSEmmanuel Vadot      compatible:
103c66ec88fSEmmanuel Vadot        const: riscv,cpu-intc
104c66ec88fSEmmanuel Vadot
105c66ec88fSEmmanuel Vadot      interrupt-controller: true
106c66ec88fSEmmanuel Vadot
107c66ec88fSEmmanuel Vadot    required:
108c66ec88fSEmmanuel Vadot      - '#interrupt-cells'
109c66ec88fSEmmanuel Vadot      - compatible
110c66ec88fSEmmanuel Vadot      - interrupt-controller
111c66ec88fSEmmanuel Vadot
112c9ccf3a3SEmmanuel Vadot  cpu-idle-states:
113f126890aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle-array
114c9ccf3a3SEmmanuel Vadot    items:
115c9ccf3a3SEmmanuel Vadot      maxItems: 1
116c9ccf3a3SEmmanuel Vadot    description: |
117c9ccf3a3SEmmanuel Vadot      List of phandles to idle state nodes supported
118c9ccf3a3SEmmanuel Vadot      by this hart (see ./idle-states.yaml).
119c9ccf3a3SEmmanuel Vadot
120cb7aa33aSEmmanuel Vadot  capacity-dmips-mhz:
121cb7aa33aSEmmanuel Vadot    description:
122cb7aa33aSEmmanuel Vadot      u32 value representing CPU capacity (see ../cpu/cpu-capacity.txt) in
123cb7aa33aSEmmanuel Vadot      DMIPS/MHz, relative to highest capacity-dmips-mhz
124cb7aa33aSEmmanuel Vadot      in the system.
125cb7aa33aSEmmanuel Vadot
126f126890aSEmmanuel VadotanyOf:
127f126890aSEmmanuel Vadot  - required:
128c66ec88fSEmmanuel Vadot      - riscv,isa
129f126890aSEmmanuel Vadot  - required:
130f126890aSEmmanuel Vadot      - riscv,isa-base
131f126890aSEmmanuel Vadot
132f126890aSEmmanuel Vadotdependencies:
133f126890aSEmmanuel Vadot  riscv,isa-base: [ "riscv,isa-extensions" ]
134f126890aSEmmanuel Vadot  riscv,isa-extensions: [ "riscv,isa-base" ]
135f126890aSEmmanuel Vadot
136f126890aSEmmanuel Vadotrequired:
137c66ec88fSEmmanuel Vadot  - interrupt-controller
138c66ec88fSEmmanuel Vadot
139f126890aSEmmanuel VadotunevaluatedProperties: false
1406be33864SEmmanuel Vadot
141c66ec88fSEmmanuel Vadotexamples:
142c66ec88fSEmmanuel Vadot  - |
143c66ec88fSEmmanuel Vadot    // Example 1: SiFive Freedom U540G Development Kit
144c66ec88fSEmmanuel Vadot    cpus {
145c66ec88fSEmmanuel Vadot        #address-cells = <1>;
146c66ec88fSEmmanuel Vadot        #size-cells = <0>;
147c66ec88fSEmmanuel Vadot        timebase-frequency = <1000000>;
148c66ec88fSEmmanuel Vadot        cpu@0 {
149c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
150c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
151c66ec88fSEmmanuel Vadot                device_type = "cpu";
152c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
153c66ec88fSEmmanuel Vadot                i-cache-sets = <128>;
154c66ec88fSEmmanuel Vadot                i-cache-size = <16384>;
155c66ec88fSEmmanuel Vadot                reg = <0>;
156f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
157f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "c";
158f126890aSEmmanuel Vadot
159c66ec88fSEmmanuel Vadot                cpu_intc0: interrupt-controller {
160c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
161c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
162c66ec88fSEmmanuel Vadot                        interrupt-controller;
163c66ec88fSEmmanuel Vadot                };
164c66ec88fSEmmanuel Vadot        };
165c66ec88fSEmmanuel Vadot        cpu@1 {
166c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
167c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
168c66ec88fSEmmanuel Vadot                d-cache-block-size = <64>;
169c66ec88fSEmmanuel Vadot                d-cache-sets = <64>;
170c66ec88fSEmmanuel Vadot                d-cache-size = <32768>;
171c66ec88fSEmmanuel Vadot                d-tlb-sets = <1>;
172c66ec88fSEmmanuel Vadot                d-tlb-size = <32>;
173c66ec88fSEmmanuel Vadot                device_type = "cpu";
174c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
175c66ec88fSEmmanuel Vadot                i-cache-sets = <64>;
176c66ec88fSEmmanuel Vadot                i-cache-size = <32768>;
177c66ec88fSEmmanuel Vadot                i-tlb-sets = <1>;
178c66ec88fSEmmanuel Vadot                i-tlb-size = <32>;
179c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv39";
180c66ec88fSEmmanuel Vadot                reg = <1>;
181c66ec88fSEmmanuel Vadot                tlb-split;
182f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
183f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "f", "d", "c";
184f126890aSEmmanuel Vadot
185c66ec88fSEmmanuel Vadot                cpu_intc1: interrupt-controller {
186c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
187c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
188c66ec88fSEmmanuel Vadot                        interrupt-controller;
189c66ec88fSEmmanuel Vadot                };
190c66ec88fSEmmanuel Vadot        };
191c66ec88fSEmmanuel Vadot    };
192c66ec88fSEmmanuel Vadot
193c66ec88fSEmmanuel Vadot  - |
194c66ec88fSEmmanuel Vadot    // Example 2: Spike ISA Simulator with 1 Hart
195c66ec88fSEmmanuel Vadot    cpus {
196c66ec88fSEmmanuel Vadot        #address-cells = <1>;
197c66ec88fSEmmanuel Vadot        #size-cells = <0>;
198c66ec88fSEmmanuel Vadot        cpu@0 {
199c66ec88fSEmmanuel Vadot                device_type = "cpu";
200c66ec88fSEmmanuel Vadot                reg = <0>;
201c66ec88fSEmmanuel Vadot                compatible = "riscv";
202c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv48";
203f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
204f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "f", "d", "c";
205f126890aSEmmanuel Vadot
206c66ec88fSEmmanuel Vadot                interrupt-controller {
207c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
208c66ec88fSEmmanuel Vadot                        interrupt-controller;
209c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
210c66ec88fSEmmanuel Vadot                };
211c66ec88fSEmmanuel Vadot        };
212c66ec88fSEmmanuel Vadot    };
213c66ec88fSEmmanuel Vadot...
214