Commit | Line | Data |
---|---|---|
2bc4da1d GK |
1 | ============================================================================== |
2 | NUMA binding description. | |
3 | ============================================================================== | |
4 | ||
5 | ============================================================================== | |
6 | 1 - Introduction | |
7 | ============================================================================== | |
8 | ||
9 | Systems employing a Non Uniform Memory Access (NUMA) architecture contain | |
10 | collections of hardware resources including processors, memory, and I/O buses, | |
11 | that comprise what is commonly known as a NUMA node. | |
12 | Processor accesses to memory within the local NUMA node is generally faster | |
13 | than processor accesses to memory outside of the local NUMA node. | |
14 | DT defines interfaces that allow the platform to convey NUMA node | |
15 | topology information to OS. | |
16 | ||
17 | ============================================================================== | |
18 | 2 - numa-node-id | |
19 | ============================================================================== | |
20 | ||
21 | For the purpose of identification, each NUMA node is associated with a unique | |
22 | token known as a node id. For the purpose of this binding | |
23 | a node id is a 32-bit integer. | |
24 | ||
25 | A device node is associated with a NUMA node by the presence of a | |
26 | numa-node-id property which contains the node id of the device. | |
27 | ||
28 | Example: | |
29 | /* numa node 0 */ | |
30 | numa-node-id = <0>; | |
31 | ||
32 | /* numa node 1 */ | |
33 | numa-node-id = <1>; | |
34 | ||
35 | ============================================================================== | |
36 | 3 - distance-map | |
37 | ============================================================================== | |
38 | ||
39 | The optional device tree node distance-map describes the relative | |
40 | distance (memory latency) between all numa nodes. | |
41 | ||
42 | - compatible : Should at least contain "numa-distance-map-v1". | |
43 | ||
44 | - distance-matrix | |
45 | This property defines a matrix to describe the relative distances | |
46 | between all numa nodes. | |
47 | It is represented as a list of node pairs and their relative distance. | |
48 | ||
49 | Note: | |
50 | 1. Each entry represents distance from first node to second node. | |
51 | The distances are equal in either direction. | |
52 | 2. The distance from a node to self (local distance) is represented | |
53 | with value 10 and all internode distance should be represented with | |
54 | a value greater than 10. | |
55 | 3. distance-matrix should have entries in lexicographical ascending | |
56 | order of nodes. | |
57 | 4. There must be only one device node distance-map which must | |
58 | reside in the root node. | |
59 | 5. If the distance-map node is not present, a default | |
60 | distance-matrix is used. | |
61 | ||
62 | Example: | |
63 | 4 nodes connected in mesh/ring topology as below, | |
64 | ||
65 | 0_______20______1 | |
66 | | | | |
67 | | | | |
68 | 20 20 | |
69 | | | | |
70 | | | | |
71 | |_______________| | |
72 | 3 20 2 | |
73 | ||
74 | if relative distance for each hop is 20, | |
75 | then internode distance would be, | |
76 | 0 -> 1 = 20 | |
77 | 1 -> 2 = 20 | |
78 | 2 -> 3 = 20 | |
79 | 3 -> 0 = 20 | |
80 | 0 -> 2 = 40 | |
81 | 1 -> 3 = 40 | |
82 | ||
83 | and dt presentation for this distance matrix is, | |
84 | ||
85 | distance-map { | |
86 | compatible = "numa-distance-map-v1"; | |
87 | distance-matrix = <0 0 10>, | |
88 | <0 1 20>, | |
89 | <0 2 40>, | |
90 | <0 3 20>, | |
91 | <1 0 20>, | |
92 | <1 1 10>, | |
93 | <1 2 20>, | |
94 | <1 3 40>, | |
95 | <2 0 40>, | |
96 | <2 1 20>, | |
97 | <2 2 10>, | |
98 | <2 3 20>, | |
99 | <3 0 20>, | |
100 | <3 1 40>, | |
101 | <3 2 20>, | |
102 | <3 3 10>; | |
103 | }; | |
104 | ||
105 | ============================================================================== | |
106 | 4 - Example dts | |
107 | ============================================================================== | |
108 | ||
109 | Dual socket system consists of 2 boards connected through ccn bus and | |
110 | each board having one socket/soc of 8 cpus, memory and pci bus. | |
111 | ||
112 | memory@c00000 { | |
113 | device_type = "memory"; | |
114 | reg = <0x0 0xc00000 0x0 0x80000000>; | |
115 | /* node 0 */ | |
116 | numa-node-id = <0>; | |
117 | }; | |
118 | ||
119 | memory@10000000000 { | |
120 | device_type = "memory"; | |
121 | reg = <0x100 0x0 0x0 0x80000000>; | |
122 | /* node 1 */ | |
123 | numa-node-id = <1>; | |
124 | }; | |
125 | ||
126 | cpus { | |
127 | #address-cells = <2>; | |
128 | #size-cells = <0>; | |
129 | ||
130 | cpu@0 { | |
131 | device_type = "cpu"; | |
132 | compatible = "arm,armv8"; | |
133 | reg = <0x0 0x0>; | |
134 | enable-method = "psci"; | |
135 | /* node 0 */ | |
136 | numa-node-id = <0>; | |
137 | }; | |
138 | cpu@1 { | |
139 | device_type = "cpu"; | |
140 | compatible = "arm,armv8"; | |
141 | reg = <0x0 0x1>; | |
142 | enable-method = "psci"; | |
143 | numa-node-id = <0>; | |
144 | }; | |
145 | cpu@2 { | |
146 | device_type = "cpu"; | |
147 | compatible = "arm,armv8"; | |
148 | reg = <0x0 0x2>; | |
149 | enable-method = "psci"; | |
150 | numa-node-id = <0>; | |
151 | }; | |
152 | cpu@3 { | |
153 | device_type = "cpu"; | |
154 | compatible = "arm,armv8"; | |
155 | reg = <0x0 0x3>; | |
156 | enable-method = "psci"; | |
157 | numa-node-id = <0>; | |
158 | }; | |
159 | cpu@4 { | |
160 | device_type = "cpu"; | |
161 | compatible = "arm,armv8"; | |
162 | reg = <0x0 0x4>; | |
163 | enable-method = "psci"; | |
164 | numa-node-id = <0>; | |
165 | }; | |
166 | cpu@5 { | |
167 | device_type = "cpu"; | |
168 | compatible = "arm,armv8"; | |
169 | reg = <0x0 0x5>; | |
170 | enable-method = "psci"; | |
171 | numa-node-id = <0>; | |
172 | }; | |
173 | cpu@6 { | |
174 | device_type = "cpu"; | |
175 | compatible = "arm,armv8"; | |
176 | reg = <0x0 0x6>; | |
177 | enable-method = "psci"; | |
178 | numa-node-id = <0>; | |
179 | }; | |
180 | cpu@7 { | |
181 | device_type = "cpu"; | |
182 | compatible = "arm,armv8"; | |
183 | reg = <0x0 0x7>; | |
184 | enable-method = "psci"; | |
185 | numa-node-id = <0>; | |
186 | }; | |
187 | cpu@8 { | |
188 | device_type = "cpu"; | |
189 | compatible = "arm,armv8"; | |
190 | reg = <0x0 0x8>; | |
191 | enable-method = "psci"; | |
192 | /* node 1 */ | |
193 | numa-node-id = <1>; | |
194 | }; | |
195 | cpu@9 { | |
196 | device_type = "cpu"; | |
197 | compatible = "arm,armv8"; | |
198 | reg = <0x0 0x9>; | |
199 | enable-method = "psci"; | |
200 | numa-node-id = <1>; | |
201 | }; | |
202 | cpu@a { | |
203 | device_type = "cpu"; | |
204 | compatible = "arm,armv8"; | |
205 | reg = <0x0 0xa>; | |
206 | enable-method = "psci"; | |
207 | numa-node-id = <1>; | |
208 | }; | |
209 | cpu@b { | |
210 | device_type = "cpu"; | |
211 | compatible = "arm,armv8"; | |
212 | reg = <0x0 0xb>; | |
213 | enable-method = "psci"; | |
214 | numa-node-id = <1>; | |
215 | }; | |
216 | cpu@c { | |
217 | device_type = "cpu"; | |
218 | compatible = "arm,armv8"; | |
219 | reg = <0x0 0xc>; | |
220 | enable-method = "psci"; | |
221 | numa-node-id = <1>; | |
222 | }; | |
223 | cpu@d { | |
224 | device_type = "cpu"; | |
225 | compatible = "arm,armv8"; | |
226 | reg = <0x0 0xd>; | |
227 | enable-method = "psci"; | |
228 | numa-node-id = <1>; | |
229 | }; | |
230 | cpu@e { | |
231 | device_type = "cpu"; | |
232 | compatible = "arm,armv8"; | |
233 | reg = <0x0 0xe>; | |
234 | enable-method = "psci"; | |
235 | numa-node-id = <1>; | |
236 | }; | |
237 | cpu@f { | |
238 | device_type = "cpu"; | |
239 | compatible = "arm,armv8"; | |
240 | reg = <0x0 0xf>; | |
241 | enable-method = "psci"; | |
242 | numa-node-id = <1>; | |
243 | }; | |
244 | }; | |
245 | ||
246 | pcie0: pcie0@848000000000 { | |
247 | compatible = "arm,armv8"; | |
248 | device_type = "pci"; | |
249 | bus-range = <0 255>; | |
250 | #size-cells = <2>; | |
251 | #address-cells = <3>; | |
252 | reg = <0x8480 0x00000000 0 0x10000000>; /* Configuration space */ | |
253 | ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>; | |
254 | /* node 0 */ | |
255 | numa-node-id = <0>; | |
256 | }; | |
257 | ||
258 | pcie1: pcie1@948000000000 { | |
259 | compatible = "arm,armv8"; | |
260 | device_type = "pci"; | |
261 | bus-range = <0 255>; | |
262 | #size-cells = <2>; | |
263 | #address-cells = <3>; | |
264 | reg = <0x9480 0x00000000 0 0x10000000>; /* Configuration space */ | |
265 | ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>; | |
266 | /* node 1 */ | |
267 | numa-node-id = <1>; | |
268 | }; | |
269 | ||
270 | distance-map { | |
271 | compatible = "numa-distance-map-v1"; | |
272 | distance-matrix = <0 0 10>, | |
273 | <0 1 20>, | |
274 | <1 1 10>; | |
275 | }; |