xref: /freebsd/sys/contrib/device-tree/Bindings/riscv/cpus.yaml (revision 6be3386466ab79a84b48429ae66244f21526d3df)
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
7c66ec88fSEmmanuel Vadottitle: RISC-V bindings for 'cpus' DT nodes
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Paul Walmsley <paul.walmsley@sifive.com>
11c66ec88fSEmmanuel Vadot  - Palmer Dabbelt <palmer@sifive.com>
12c66ec88fSEmmanuel Vadot
13c66ec88fSEmmanuel Vadotdescription: |
14c66ec88fSEmmanuel Vadot  This document uses some terminology common to the RISC-V community
15c66ec88fSEmmanuel Vadot  that is not widely used, the definitions of which are listed here:
16c66ec88fSEmmanuel Vadot
17c66ec88fSEmmanuel Vadot  hart: A hardware execution context, which contains all the state
18c66ec88fSEmmanuel Vadot  mandated by the RISC-V ISA: a PC and some registers.  This
19c66ec88fSEmmanuel Vadot  terminology is designed to disambiguate software's view of execution
20c66ec88fSEmmanuel Vadot  contexts from any particular microarchitectural implementation
21c66ec88fSEmmanuel Vadot  strategy.  For example, an Intel laptop containing one socket with
22c66ec88fSEmmanuel Vadot  two cores, each of which has two hyperthreads, could be described as
23c66ec88fSEmmanuel Vadot  having four harts.
24c66ec88fSEmmanuel Vadot
25c66ec88fSEmmanuel Vadotproperties:
26c66ec88fSEmmanuel Vadot  compatible:
27c66ec88fSEmmanuel Vadot    oneOf:
28c66ec88fSEmmanuel Vadot      - items:
29c66ec88fSEmmanuel Vadot          - enum:
30c66ec88fSEmmanuel Vadot              - sifive,rocket0
31c66ec88fSEmmanuel Vadot              - sifive,e5
32c66ec88fSEmmanuel Vadot              - sifive,e51
33c66ec88fSEmmanuel Vadot              - sifive,u54-mc
34c66ec88fSEmmanuel Vadot              - sifive,u54
35c66ec88fSEmmanuel Vadot              - sifive,u5
36c66ec88fSEmmanuel Vadot          - const: riscv
37c66ec88fSEmmanuel Vadot      - const: riscv    # Simulator only
38c66ec88fSEmmanuel Vadot    description:
39c66ec88fSEmmanuel Vadot      Identifies that the hart uses the RISC-V instruction set
40c66ec88fSEmmanuel Vadot      and identifies the type of the hart.
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel Vadot  mmu-type:
43c66ec88fSEmmanuel Vadot    description:
44c66ec88fSEmmanuel Vadot      Identifies the MMU address translation mode used on this
45c66ec88fSEmmanuel Vadot      hart.  These values originate from the RISC-V Privileged
46c66ec88fSEmmanuel Vadot      Specification document, available from
47c66ec88fSEmmanuel Vadot      https://riscv.org/specifications/
48c66ec88fSEmmanuel Vadot    $ref: "/schemas/types.yaml#/definitions/string"
49c66ec88fSEmmanuel Vadot    enum:
50c66ec88fSEmmanuel Vadot      - riscv,sv32
51c66ec88fSEmmanuel Vadot      - riscv,sv39
52c66ec88fSEmmanuel Vadot      - riscv,sv48
53c66ec88fSEmmanuel Vadot
54c66ec88fSEmmanuel Vadot  riscv,isa:
55c66ec88fSEmmanuel Vadot    description:
56c66ec88fSEmmanuel Vadot      Identifies the specific RISC-V instruction set architecture
57c66ec88fSEmmanuel Vadot      supported by the hart.  These are documented in the RISC-V
58c66ec88fSEmmanuel Vadot      User-Level ISA document, available from
59c66ec88fSEmmanuel Vadot      https://riscv.org/specifications/
60c66ec88fSEmmanuel Vadot
61c66ec88fSEmmanuel Vadot      While the isa strings in ISA specification are case
62c66ec88fSEmmanuel Vadot      insensitive, letters in the riscv,isa string must be all
63c66ec88fSEmmanuel Vadot      lowercase to simplify parsing.
64c66ec88fSEmmanuel Vadot    $ref: "/schemas/types.yaml#/definitions/string"
65c66ec88fSEmmanuel Vadot    enum:
66c66ec88fSEmmanuel Vadot      - rv64imac
67c66ec88fSEmmanuel Vadot      - rv64imafdc
68c66ec88fSEmmanuel Vadot
69c66ec88fSEmmanuel Vadot  # RISC-V requires 'timebase-frequency' in /cpus, so disallow it here
70c66ec88fSEmmanuel Vadot  timebase-frequency: false
71c66ec88fSEmmanuel Vadot
72c66ec88fSEmmanuel Vadot  interrupt-controller:
73c66ec88fSEmmanuel Vadot    type: object
74c66ec88fSEmmanuel Vadot    description: Describes the CPU's local interrupt controller
75c66ec88fSEmmanuel Vadot
76c66ec88fSEmmanuel Vadot    properties:
77c66ec88fSEmmanuel Vadot      '#interrupt-cells':
78c66ec88fSEmmanuel Vadot        const: 1
79c66ec88fSEmmanuel Vadot
80c66ec88fSEmmanuel Vadot      compatible:
81c66ec88fSEmmanuel Vadot        const: riscv,cpu-intc
82c66ec88fSEmmanuel Vadot
83c66ec88fSEmmanuel Vadot      interrupt-controller: true
84c66ec88fSEmmanuel Vadot
85c66ec88fSEmmanuel Vadot    required:
86c66ec88fSEmmanuel Vadot      - '#interrupt-cells'
87c66ec88fSEmmanuel Vadot      - compatible
88c66ec88fSEmmanuel Vadot      - interrupt-controller
89c66ec88fSEmmanuel Vadot
90c66ec88fSEmmanuel Vadotrequired:
91c66ec88fSEmmanuel Vadot  - riscv,isa
92c66ec88fSEmmanuel Vadot  - interrupt-controller
93c66ec88fSEmmanuel Vadot
94*6be33864SEmmanuel VadotadditionalProperties: true
95*6be33864SEmmanuel Vadot
96c66ec88fSEmmanuel Vadotexamples:
97c66ec88fSEmmanuel Vadot  - |
98c66ec88fSEmmanuel Vadot    // Example 1: SiFive Freedom U540G Development Kit
99c66ec88fSEmmanuel Vadot    cpus {
100c66ec88fSEmmanuel Vadot        #address-cells = <1>;
101c66ec88fSEmmanuel Vadot        #size-cells = <0>;
102c66ec88fSEmmanuel Vadot        timebase-frequency = <1000000>;
103c66ec88fSEmmanuel Vadot        cpu@0 {
104c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
105c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
106c66ec88fSEmmanuel Vadot                device_type = "cpu";
107c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
108c66ec88fSEmmanuel Vadot                i-cache-sets = <128>;
109c66ec88fSEmmanuel Vadot                i-cache-size = <16384>;
110c66ec88fSEmmanuel Vadot                reg = <0>;
111c66ec88fSEmmanuel Vadot                riscv,isa = "rv64imac";
112c66ec88fSEmmanuel Vadot                cpu_intc0: interrupt-controller {
113c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
114c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
115c66ec88fSEmmanuel Vadot                        interrupt-controller;
116c66ec88fSEmmanuel Vadot                };
117c66ec88fSEmmanuel Vadot        };
118c66ec88fSEmmanuel Vadot        cpu@1 {
119c66ec88fSEmmanuel Vadot                clock-frequency = <0>;
120c66ec88fSEmmanuel Vadot                compatible = "sifive,rocket0", "riscv";
121c66ec88fSEmmanuel Vadot                d-cache-block-size = <64>;
122c66ec88fSEmmanuel Vadot                d-cache-sets = <64>;
123c66ec88fSEmmanuel Vadot                d-cache-size = <32768>;
124c66ec88fSEmmanuel Vadot                d-tlb-sets = <1>;
125c66ec88fSEmmanuel Vadot                d-tlb-size = <32>;
126c66ec88fSEmmanuel Vadot                device_type = "cpu";
127c66ec88fSEmmanuel Vadot                i-cache-block-size = <64>;
128c66ec88fSEmmanuel Vadot                i-cache-sets = <64>;
129c66ec88fSEmmanuel Vadot                i-cache-size = <32768>;
130c66ec88fSEmmanuel Vadot                i-tlb-sets = <1>;
131c66ec88fSEmmanuel Vadot                i-tlb-size = <32>;
132c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv39";
133c66ec88fSEmmanuel Vadot                reg = <1>;
134c66ec88fSEmmanuel Vadot                riscv,isa = "rv64imafdc";
135c66ec88fSEmmanuel Vadot                tlb-split;
136c66ec88fSEmmanuel Vadot                cpu_intc1: interrupt-controller {
137c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
138c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
139c66ec88fSEmmanuel Vadot                        interrupt-controller;
140c66ec88fSEmmanuel Vadot                };
141c66ec88fSEmmanuel Vadot        };
142c66ec88fSEmmanuel Vadot    };
143c66ec88fSEmmanuel Vadot
144c66ec88fSEmmanuel Vadot  - |
145c66ec88fSEmmanuel Vadot    // Example 2: Spike ISA Simulator with 1 Hart
146c66ec88fSEmmanuel Vadot    cpus {
147c66ec88fSEmmanuel Vadot        #address-cells = <1>;
148c66ec88fSEmmanuel Vadot        #size-cells = <0>;
149c66ec88fSEmmanuel Vadot        cpu@0 {
150c66ec88fSEmmanuel Vadot                device_type = "cpu";
151c66ec88fSEmmanuel Vadot                reg = <0>;
152c66ec88fSEmmanuel Vadot                compatible = "riscv";
153c66ec88fSEmmanuel Vadot                riscv,isa = "rv64imafdc";
154c66ec88fSEmmanuel Vadot                mmu-type = "riscv,sv48";
155c66ec88fSEmmanuel Vadot                interrupt-controller {
156c66ec88fSEmmanuel Vadot                        #interrupt-cells = <1>;
157c66ec88fSEmmanuel Vadot                        interrupt-controller;
158c66ec88fSEmmanuel Vadot                        compatible = "riscv,cpu-intc";
159c66ec88fSEmmanuel Vadot                };
160c66ec88fSEmmanuel Vadot        };
161c66ec88fSEmmanuel Vadot    };
162c66ec88fSEmmanuel Vadot...
163