| 1 |
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-clause |
| 2 |
# Copyright 2013,2023 Arm, Ltd. |
| 3 |
# |
| 4 |
# Based on cpu-topology.txt binding from Linux kernel |
| 5 |
%YAML 1.2 |
| 6 |
--- |
| 7 |
$id: http://devicetree.org/schemas/cpu-map.yaml# |
| 8 |
$schema: http://devicetree.org/meta-schemas/core.yaml# |
| 9 |
|
| 10 |
title: CPU Topology nodes |
| 11 |
|
| 12 |
maintainers: |
| 13 |
- [email protected] |
| 14 |
|
| 15 |
description: | |
| 16 |
In a SMP system, the hierarchy of CPUs is defined through three entities that |
| 17 |
are used to describe the layout of physical CPUs in the system: |
| 18 |
|
| 19 |
- socket |
| 20 |
- cluster |
| 21 |
- core |
| 22 |
- thread |
| 23 |
|
| 24 |
The bottom hierarchy level sits at core or thread level depending on whether |
| 25 |
symmetric multi-threading (SMT) is supported or not. |
| 26 |
|
| 27 |
For instance in a system where CPUs support SMT, "cpu" nodes represent all |
| 28 |
threads existing in the system and map to the hierarchy level "thread" above. |
| 29 |
In systems where SMT is not supported "cpu" nodes represent all cores present |
| 30 |
in the system and map to the hierarchy level "core" above. |
| 31 |
|
| 32 |
CPU topology bindings allow one to associate cpu nodes with hierarchical groups |
| 33 |
corresponding to the system hierarchy; syntactically they are defined as device |
| 34 |
tree nodes. |
| 35 |
|
| 36 |
Currently, only ARM/RISC-V intend to use this cpu topology binding but it may be |
| 37 |
used for any other architecture as well. |
| 38 |
|
| 39 |
The cpu nodes, as per bindings defined in [4], represent the devices that |
| 40 |
correspond to physical CPUs and are to be mapped to the hierarchy levels. |
| 41 |
|
| 42 |
A topology description containing phandles to cpu nodes that are not compliant |
| 43 |
with bindings standardized in [4] is therefore considered invalid. |
| 44 |
|
| 45 |
=========================================== |
| 46 |
2 - cpu-map node |
| 47 |
=========================================== |
| 48 |
|
| 49 |
The ARM/RISC-V CPU topology is defined within the cpu-map node, which is a direct |
| 50 |
child of the cpus node and provides a container where the actual topology |
| 51 |
nodes are listed. |
| 52 |
|
| 53 |
The cpu-map node can only contain 4 types of child nodes: |
| 54 |
|
| 55 |
- socket node |
| 56 |
- cluster node |
| 57 |
- core node |
| 58 |
- thread node |
| 59 |
|
| 60 |
The nodes describing the CPU topology (socket/cluster/core/thread) can |
| 61 |
only be defined within the cpu-map node and every core/thread in the |
| 62 |
system must be defined within the topology. Any other configuration is |
| 63 |
invalid and therefore must be ignored. |
| 64 |
|
| 65 |
=========================================== |
| 66 |
2.1 - cpu-map child nodes naming convention |
| 67 |
=========================================== |
| 68 |
|
| 69 |
cpu-map child nodes must follow a naming convention where the node name |
| 70 |
must be "socketN", "clusterN", "coreN", "threadN" depending on the node type |
| 71 |
(ie socket/cluster/core/thread) (where N = {0, 1, ...} is the node number; nodes |
| 72 |
which are siblings within a single common parent node must be given a unique and |
| 73 |
sequential N value, starting from 0). |
| 74 |
cpu-map child nodes which do not share a common parent node can have the same |
| 75 |
name (ie same number N as other cpu-map child nodes at different device tree |
| 76 |
levels) since name uniqueness will be guaranteed by the device tree hierarchy. |
| 77 |
|
| 78 |
=========================================== |
| 79 |
[1] ARM Linux kernel documentation |
| 80 |
Documentation/devicetree/bindings/arm/cpus.yaml |
| 81 |
[2] Devicetree NUMA binding description |
| 82 |
Documentation/devicetree/bindings/numa.txt |
| 83 |
[3] RISC-V Linux kernel documentation |
| 84 |
Documentation/devicetree/bindings/riscv/cpus.yaml |
| 85 |
[4] https://www.devicetree.org/specifications/ |
| 86 |
|
| 87 |
$defs: |
| 88 |
cluster: |
| 89 |
type: object |
| 90 |
oneOf: |
| 91 |
- additionalProperties: false |
| 92 |
patternProperties: |
| 93 |
'^cluster[0-9]+$': |
| 94 |
$ref: '#/$defs/cluster' |
| 95 |
- additionalProperties: false |
| 96 |
patternProperties: |
| 97 |
'^core[0-9]+$': |
| 98 |
$ref: '#/$defs/core' |
| 99 |
|
| 100 |
core: |
| 101 |
type: object |
| 102 |
oneOf: |
| 103 |
- additionalProperties: false |
| 104 |
patternProperties: |
| 105 |
'^thread[0-9]+$': |
| 106 |
$ref: '#/$defs/core' |
| 107 |
- additionalProperties: false |
| 108 |
properties: |
| 109 |
cpu: |
| 110 |
$ref: /schemas/types.yaml#/definitions/phandle |
| 111 |
required: |
| 112 |
- cpu |
| 113 |
|
| 114 |
properties: |
| 115 |
$nodename: |
| 116 |
const: cpu-map |
| 117 |
|
| 118 |
patternProperties: |
| 119 |
'^(socket|cluster)[0-9]+$': |
| 120 |
$ref: '#/$defs/cluster' |
| 121 |
description: | |
| 122 |
The cpu-map node's child nodes can be: |
| 123 |
|
| 124 |
- one or more cluster nodes or |
| 125 |
- one or more socket nodes in a multi-socket system. A system can |
| 126 |
contain single or multiple physical socket. |
| 127 |
The association of sockets and NUMA nodes is beyond the scope of this |
| 128 |
binding, please refer [2] for NUMA bindings. |
| 129 |
|
| 130 |
additionalProperties: false |
| 131 |
|
| 132 |
examples: |
| 133 |
- | |
| 134 |
# 16-cpu system, two clusters of clusters in a single physical socket |
| 135 |
cpu-map { |
| 136 |
socket0 { |
| 137 |
cluster0 { |
| 138 |
cluster0 { |
| 139 |
core0 { |
| 140 |
thread0 { |
| 141 |
cpu = <&CPU0>; |
| 142 |
}; |
| 143 |
thread1 { |
| 144 |
cpu = <&CPU1>; |
| 145 |
}; |
| 146 |
}; |
| 147 |
|
| 148 |
core1 { |
| 149 |
thread0 { |
| 150 |
cpu = <&CPU2>; |
| 151 |
}; |
| 152 |
thread1 { |
| 153 |
cpu = <&CPU3>; |
| 154 |
}; |
| 155 |
}; |
| 156 |
}; |
| 157 |
|
| 158 |
cluster1 { |
| 159 |
core0 { |
| 160 |
thread0 { |
| 161 |
cpu = <&CPU4>; |
| 162 |
}; |
| 163 |
thread1 { |
| 164 |
cpu = <&CPU5>; |
| 165 |
}; |
| 166 |
}; |
| 167 |
|
| 168 |
core1 { |
| 169 |
thread0 { |
| 170 |
cpu = <&CPU6>; |
| 171 |
}; |
| 172 |
thread1 { |
| 173 |
cpu = <&CPU7>; |
| 174 |
}; |
| 175 |
}; |
| 176 |
}; |
| 177 |
}; |
| 178 |
|
| 179 |
cluster1 { |
| 180 |
cluster0 { |
| 181 |
core0 { |
| 182 |
thread0 { |
| 183 |
cpu = <&CPU8>; |
| 184 |
}; |
| 185 |
thread1 { |
| 186 |
cpu = <&CPU9>; |
| 187 |
}; |
| 188 |
}; |
| 189 |
core1 { |
| 190 |
thread0 { |
| 191 |
cpu = <&CPU10>; |
| 192 |
}; |
| 193 |
thread1 { |
| 194 |
cpu = <&CPU11>; |
| 195 |
}; |
| 196 |
}; |
| 197 |
}; |
| 198 |
|
| 199 |
cluster1 { |
| 200 |
core0 { |
| 201 |
thread0 { |
| 202 |
cpu = <&CPU12>; |
| 203 |
}; |
| 204 |
thread1 { |
| 205 |
cpu = <&CPU13>; |
| 206 |
}; |
| 207 |
}; |
| 208 |
core1 { |
| 209 |
thread0 { |
| 210 |
cpu = <&CPU14>; |
| 211 |
}; |
| 212 |
thread1 { |
| 213 |
cpu = <&CPU15>; |
| 214 |
}; |
| 215 |
}; |
| 216 |
}; |
| 217 |
}; |
| 218 |
}; |
| 219 |
}; |
| 220 |
|
| 221 |
- | |
| 222 |
# 2 Clusters of 4 cores each with no SMT |
| 223 |
cpu-map { |
| 224 |
cluster0 { |
| 225 |
core0 { |
| 226 |
cpu = <&CPU0>; |
| 227 |
}; |
| 228 |
core1 { |
| 229 |
cpu = <&CPU1>; |
| 230 |
}; |
| 231 |
core2 { |
| 232 |
cpu = <&CPU2>; |
| 233 |
}; |
| 234 |
core3 { |
| 235 |
cpu = <&CPU3>; |
| 236 |
}; |
| 237 |
}; |
| 238 |
|
| 239 |
cluster1 { |
| 240 |
core0 { |
| 241 |
cpu = <&CPU4>; |
| 242 |
}; |
| 243 |
core1 { |
| 244 |
cpu = <&CPU5>; |
| 245 |
}; |
| 246 |
core2 { |
| 247 |
cpu = <&CPU6>; |
| 248 |
}; |
| 249 |
core3 { |
| 250 |
cpu = <&CPU7>; |
| 251 |
}; |
| 252 |
}; |
| 253 |
}; |
| 254 |
|
| 255 |
... |