xref: /freebsd/sys/contrib/device-tree/Bindings/riscv/cpus.yaml (revision 8d13bc63c0e1d50bc9e47ac1f26329c999bfecf0)
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:
35*8d13bc63SEmmanuel Vadot              - amd,mbv32
368bab661aSEmmanuel Vadot              - andestech,ax45mp
378bab661aSEmmanuel Vadot              - canaan,k210
385def4c47SEmmanuel Vadot              - sifive,bullet0
39c66ec88fSEmmanuel Vadot              - sifive,e5
405def4c47SEmmanuel Vadot              - sifive,e7
415def4c47SEmmanuel Vadot              - sifive,e71
428bab661aSEmmanuel Vadot              - sifive,rocket0
43fac71e4eSEmmanuel Vadot              - sifive,s7
44c66ec88fSEmmanuel Vadot              - sifive,u5
458bab661aSEmmanuel Vadot              - sifive,u54
465def4c47SEmmanuel Vadot              - sifive,u7
478bab661aSEmmanuel Vadot              - sifive,u74
488bab661aSEmmanuel Vadot              - sifive,u74-mc
498bab661aSEmmanuel Vadot              - thead,c906
508bab661aSEmmanuel Vadot              - thead,c910
5184943d6fSEmmanuel Vadot              - thead,c920
52c66ec88fSEmmanuel Vadot          - const: riscv
538cc087a1SEmmanuel Vadot      - items:
548cc087a1SEmmanuel Vadot          - enum:
558cc087a1SEmmanuel Vadot              - sifive,e51
568cc087a1SEmmanuel Vadot              - sifive,u54-mc
578cc087a1SEmmanuel Vadot          - const: sifive,rocket0
588cc087a1SEmmanuel Vadot          - const: riscv
59c66ec88fSEmmanuel Vadot      - const: riscv    # Simulator only
60c66ec88fSEmmanuel Vadot    description:
61c66ec88fSEmmanuel Vadot      Identifies that the hart uses the RISC-V instruction set
62c66ec88fSEmmanuel Vadot      and identifies the type of the hart.
63c66ec88fSEmmanuel Vadot
64c66ec88fSEmmanuel Vadot  mmu-type:
65c66ec88fSEmmanuel Vadot    description:
66*8d13bc63SEmmanuel Vadot      Identifies the largest MMU address translation mode supported by
67*8d13bc63SEmmanuel Vadot      this hart.  These values originate from the RISC-V Privileged
68c66ec88fSEmmanuel Vadot      Specification document, available from
69c66ec88fSEmmanuel Vadot      https://riscv.org/specifications/
70f126890aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/string
71c66ec88fSEmmanuel Vadot    enum:
72c66ec88fSEmmanuel Vadot      - riscv,sv32
73c66ec88fSEmmanuel Vadot      - riscv,sv39
74c66ec88fSEmmanuel Vadot      - riscv,sv48
75fac71e4eSEmmanuel Vadot      - riscv,sv57
765def4c47SEmmanuel Vadot      - riscv,none
77c66ec88fSEmmanuel Vadot
78b97ee269SEmmanuel Vadot  riscv,cbom-block-size:
79b97ee269SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
80b97ee269SEmmanuel Vadot    description:
81b97ee269SEmmanuel Vadot      The blocksize in bytes for the Zicbom cache operations.
82b97ee269SEmmanuel Vadot
83*8d13bc63SEmmanuel Vadot  riscv,cbop-block-size:
84*8d13bc63SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
85*8d13bc63SEmmanuel Vadot    description:
86*8d13bc63SEmmanuel Vadot      The blocksize in bytes for the Zicbop cache operations.
87*8d13bc63SEmmanuel Vadot
88fac71e4eSEmmanuel Vadot  riscv,cboz-block-size:
89fac71e4eSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
90fac71e4eSEmmanuel Vadot    description:
91fac71e4eSEmmanuel Vadot      The blocksize in bytes for the Zicboz cache operations.
92fac71e4eSEmmanuel Vadot
93f126890aSEmmanuel Vadot  # RISC-V has multiple properties for cache op block sizes as the sizes
94f126890aSEmmanuel Vadot  # differ between individual CBO extensions
95f126890aSEmmanuel Vadot  cache-op-block-size: false
96c66ec88fSEmmanuel Vadot  # RISC-V requires 'timebase-frequency' in /cpus, so disallow it here
97c66ec88fSEmmanuel Vadot  timebase-frequency: false
98c66ec88fSEmmanuel Vadot
99c66ec88fSEmmanuel Vadot  interrupt-controller:
100c66ec88fSEmmanuel Vadot    type: object
101aa1a8ff2SEmmanuel Vadot    additionalProperties: false
102c66ec88fSEmmanuel Vadot    description: Describes the CPU's local interrupt controller
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot    properties:
105c66ec88fSEmmanuel Vadot      '#interrupt-cells':
106c66ec88fSEmmanuel Vadot        const: 1
107c66ec88fSEmmanuel Vadot
108c66ec88fSEmmanuel Vadot      compatible:
109c66ec88fSEmmanuel Vadot        const: riscv,cpu-intc
110c66ec88fSEmmanuel Vadot
111c66ec88fSEmmanuel Vadot      interrupt-controller: true
112c66ec88fSEmmanuel Vadot
113c66ec88fSEmmanuel Vadot    required:
114c66ec88fSEmmanuel Vadot      - '#interrupt-cells'
115c66ec88fSEmmanuel Vadot      - compatible
116c66ec88fSEmmanuel Vadot      - interrupt-controller
117c66ec88fSEmmanuel Vadot
118c9ccf3a3SEmmanuel Vadot  cpu-idle-states:
119f126890aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle-array
120c9ccf3a3SEmmanuel Vadot    items:
121c9ccf3a3SEmmanuel Vadot      maxItems: 1
122c9ccf3a3SEmmanuel Vadot    description: |
123c9ccf3a3SEmmanuel Vadot      List of phandles to idle state nodes supported
124c9ccf3a3SEmmanuel Vadot      by this hart (see ./idle-states.yaml).
125c9ccf3a3SEmmanuel Vadot
126cb7aa33aSEmmanuel Vadot  capacity-dmips-mhz:
127cb7aa33aSEmmanuel Vadot    description:
128cb7aa33aSEmmanuel Vadot      u32 value representing CPU capacity (see ../cpu/cpu-capacity.txt) in
129cb7aa33aSEmmanuel Vadot      DMIPS/MHz, relative to highest capacity-dmips-mhz
130cb7aa33aSEmmanuel Vadot      in the system.
131cb7aa33aSEmmanuel Vadot
132f126890aSEmmanuel VadotanyOf:
133f126890aSEmmanuel Vadot  - required:
134c66ec88fSEmmanuel Vadot      - riscv,isa
135f126890aSEmmanuel Vadot  - required:
136f126890aSEmmanuel Vadot      - riscv,isa-base
137f126890aSEmmanuel Vadot
138f126890aSEmmanuel Vadotdependencies:
139f126890aSEmmanuel Vadot  riscv,isa-base: [ "riscv,isa-extensions" ]
140f126890aSEmmanuel Vadot  riscv,isa-extensions: [ "riscv,isa-base" ]
141f126890aSEmmanuel Vadot
142f126890aSEmmanuel Vadotrequired:
143c66ec88fSEmmanuel Vadot  - interrupt-controller
144c66ec88fSEmmanuel Vadot
145f126890aSEmmanuel VadotunevaluatedProperties: false
1466be33864SEmmanuel Vadot
147c66ec88fSEmmanuel Vadotexamples:
148c66ec88fSEmmanuel Vadot  - |
149c66ec88fSEmmanuel Vadot    // Example 1: SiFive Freedom U540G Development Kit
150c66ec88fSEmmanuel Vadot    cpus {
151c66ec88fSEmmanuel Vadot        #address-cells = <1>;
152c66ec88fSEmmanuel Vadot        #size-cells = <0>;
153c66ec88fSEmmanuel Vadot        timebase-frequency = <1000000>;
154c66ec88fSEmmanuel Vadot        cpu@0 {
155c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
156c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
157c66ec88fSEmmanuel Vadot                device_type = "cpu";
158c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
159c66ec88fSEmmanuel Vadot                i-cache-sets = <128>;
160c66ec88fSEmmanuel Vadot                i-cache-size = <16384>;
161c66ec88fSEmmanuel Vadot                reg = <0>;
162f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
163f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "c";
164f126890aSEmmanuel Vadot
165c66ec88fSEmmanuel Vadot                cpu_intc0: interrupt-controller {
166c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
167c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
168c66ec88fSEmmanuel Vadot                        interrupt-controller;
169c66ec88fSEmmanuel Vadot                };
170c66ec88fSEmmanuel Vadot        };
171c66ec88fSEmmanuel Vadot        cpu@1 {
172c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
173c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
174c66ec88fSEmmanuel Vadot                d-cache-block-size = <64>;
175c66ec88fSEmmanuel Vadot                d-cache-sets = <64>;
176c66ec88fSEmmanuel Vadot                d-cache-size = <32768>;
177c66ec88fSEmmanuel Vadot                d-tlb-sets = <1>;
178c66ec88fSEmmanuel Vadot                d-tlb-size = <32>;
179c66ec88fSEmmanuel Vadot                device_type = "cpu";
180c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
181c66ec88fSEmmanuel Vadot                i-cache-sets = <64>;
182c66ec88fSEmmanuel Vadot                i-cache-size = <32768>;
183c66ec88fSEmmanuel Vadot                i-tlb-sets = <1>;
184c66ec88fSEmmanuel Vadot                i-tlb-size = <32>;
185c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv39";
186c66ec88fSEmmanuel Vadot                reg = <1>;
187c66ec88fSEmmanuel Vadot                tlb-split;
188f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
189f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "f", "d", "c";
190f126890aSEmmanuel Vadot
191c66ec88fSEmmanuel Vadot                cpu_intc1: interrupt-controller {
192c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
193c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
194c66ec88fSEmmanuel Vadot                        interrupt-controller;
195c66ec88fSEmmanuel Vadot                };
196c66ec88fSEmmanuel Vadot        };
197c66ec88fSEmmanuel Vadot    };
198c66ec88fSEmmanuel Vadot
199c66ec88fSEmmanuel Vadot  - |
200c66ec88fSEmmanuel Vadot    // Example 2: Spike ISA Simulator with 1 Hart
201c66ec88fSEmmanuel Vadot    cpus {
202c66ec88fSEmmanuel Vadot        #address-cells = <1>;
203c66ec88fSEmmanuel Vadot        #size-cells = <0>;
204c66ec88fSEmmanuel Vadot        cpu@0 {
205c66ec88fSEmmanuel Vadot                device_type = "cpu";
206c66ec88fSEmmanuel Vadot                reg = <0>;
207c66ec88fSEmmanuel Vadot                compatible = "riscv";
208c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv48";
209f126890aSEmmanuel Vadot                riscv,isa-base = "rv64i";
210f126890aSEmmanuel Vadot                riscv,isa-extensions = "i", "m", "a", "f", "d", "c";
211f126890aSEmmanuel Vadot
212c66ec88fSEmmanuel Vadot                interrupt-controller {
213c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
214c66ec88fSEmmanuel Vadot                        interrupt-controller;
215c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
216c66ec88fSEmmanuel Vadot                };
217c66ec88fSEmmanuel Vadot        };
218c66ec88fSEmmanuel Vadot    };
219c66ec88fSEmmanuel Vadot...
220