blob: 607b2354adb5452dfa19adf8e7f394d7448cf291 [file] [log] [blame]
Vincent Guittotc9018aa2011-08-08 13:21:59 +01001/*
2 * arch/arm/kernel/topology.c
3 *
4 * Copyright (C) 2011 Linaro Limited.
5 * Written by: Vincent Guittot
6 *
7 * based on arch/sh/kernel/topology.c
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14#include <linux/cpu.h>
15#include <linux/cpumask.h>
Arnd Bergmann92bdd3f2013-05-31 22:49:22 +010016#include <linux/export.h>
Vincent Guittotc9018aa2011-08-08 13:21:59 +010017#include <linux/init.h>
18#include <linux/percpu.h>
19#include <linux/node.h>
20#include <linux/nodemask.h>
Vincent Guittot339ca092012-07-10 14:13:12 +010021#include <linux/of.h>
Vincent Guittotc9018aa2011-08-08 13:21:59 +010022#include <linux/sched.h>
Vincent Guittot339ca092012-07-10 14:13:12 +010023#include <linux/slab.h>
Vincent Guittotc9018aa2011-08-08 13:21:59 +010024
25#include <asm/cputype.h>
26#include <asm/topology.h>
27
Vincent Guittot130d9aa2012-07-10 14:08:40 +010028/*
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040029 * cpu capacity scale management
Vincent Guittot130d9aa2012-07-10 14:08:40 +010030 */
31
32/*
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040033 * cpu capacity table
Vincent Guittot130d9aa2012-07-10 14:08:40 +010034 * This per cpu data structure describes the relative capacity of each core.
35 * On a heteregenous system, cores don't have the same computation capacity
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040036 * and we reflect that difference in the cpu_capacity field so the scheduler
37 * can take this difference into account during load balance. A per cpu
38 * structure is preferred because each CPU updates its own cpu_capacity field
39 * during the load balance except for idle cores. One idle core is selected
40 * to run the rebalance_domains for all idle cores and the cpu_capacity can be
41 * updated during this sequence.
Vincent Guittot130d9aa2012-07-10 14:08:40 +010042 */
Juri Lellid78e13a2016-01-07 16:27:33 +010043static DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
Vincent Guittot130d9aa2012-07-10 14:08:40 +010044
Morten Rasmussen25cea242015-04-14 16:25:31 +010045unsigned long scale_cpu_capacity(struct sched_domain *sd, int cpu)
Vincent Guittot130d9aa2012-07-10 14:08:40 +010046{
Dietmar Eggemann568913e2015-09-23 17:59:55 +010047#if CONFIG_CPU_FREQ
48 unsigned long max_freq_scale = cpufreq_scale_max_freq_capacity(cpu);
49
50 return per_cpu(cpu_scale, cpu) * max_freq_scale >> SCHED_CAPACITY_SHIFT;
51#else
Vincent Guittot130d9aa2012-07-10 14:08:40 +010052 return per_cpu(cpu_scale, cpu);
Dietmar Eggemann568913e2015-09-23 17:59:55 +010053#endif
Vincent Guittot130d9aa2012-07-10 14:08:40 +010054}
55
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040056static void set_capacity_scale(unsigned int cpu, unsigned long capacity)
Vincent Guittot130d9aa2012-07-10 14:08:40 +010057{
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040058 per_cpu(cpu_scale, cpu) = capacity;
Vincent Guittot130d9aa2012-07-10 14:08:40 +010059}
60
Vincent Guittot339ca092012-07-10 14:13:12 +010061#ifdef CONFIG_OF
62struct cpu_efficiency {
63 const char *compatible;
64 unsigned long efficiency;
65};
66
67/*
68 * Table of relative efficiency of each processors
69 * The efficiency value must fit in 20bit and the final
70 * cpu_scale value must be in the range
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040071 * 0 < cpu_scale < 3*SCHED_CAPACITY_SCALE/2
Vincent Guittot339ca092012-07-10 14:13:12 +010072 * in order to return at most 1 when DIV_ROUND_CLOSEST
73 * is used to compute the capacity of a CPU.
74 * Processors that are not defined in the table,
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040075 * use the default SCHED_CAPACITY_SCALE value for cpu_scale.
Vincent Guittot339ca092012-07-10 14:13:12 +010076 */
Mark Brown145bc292013-12-10 12:10:17 +010077static const struct cpu_efficiency table_efficiency[] = {
Vincent Guittot339ca092012-07-10 14:13:12 +010078 {"arm,cortex-a15", 3891},
79 {"arm,cortex-a7", 2048},
80 {NULL, },
81};
82
Mark Brown145bc292013-12-10 12:10:17 +010083static unsigned long *__cpu_capacity;
Sudeep KarkadaNagesha816a8de2013-06-17 14:20:00 +010084#define cpu_capacity(cpu) __cpu_capacity[cpu]
Vincent Guittot339ca092012-07-10 14:13:12 +010085
Mark Brown145bc292013-12-10 12:10:17 +010086static unsigned long middle_capacity = 1;
Vincent Guittot339ca092012-07-10 14:13:12 +010087
88/*
89 * Iterate all CPUs' descriptor in DT and compute the efficiency
90 * (as per table_efficiency). Also calculate a middle efficiency
91 * as close as possible to (max{eff_i} - min{eff_i}) / 2
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -040092 * This is later used to scale the cpu_capacity field such that an
93 * 'average' CPU is of middle capacity. Also see the comments near
94 * table_efficiency[] and update_cpu_capacity().
Vincent Guittot339ca092012-07-10 14:13:12 +010095 */
96static void __init parse_dt_topology(void)
97{
Mark Brown145bc292013-12-10 12:10:17 +010098 const struct cpu_efficiency *cpu_eff;
Vincent Guittot339ca092012-07-10 14:13:12 +010099 struct device_node *cn = NULL;
Mark Brown44ae9032014-03-20 15:16:54 +0100100 unsigned long min_capacity = ULONG_MAX;
Vincent Guittot339ca092012-07-10 14:13:12 +0100101 unsigned long max_capacity = 0;
102 unsigned long capacity = 0;
Mark Brown44ae9032014-03-20 15:16:54 +0100103 int cpu = 0;
Vincent Guittot339ca092012-07-10 14:13:12 +0100104
Mark Brown44ae9032014-03-20 15:16:54 +0100105 __cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
106 GFP_NOWAIT);
Vincent Guittot339ca092012-07-10 14:13:12 +0100107
Sudeep KarkadaNagesha816a8de2013-06-17 14:20:00 +0100108 for_each_possible_cpu(cpu) {
109 const u32 *rate;
Vincent Guittot339ca092012-07-10 14:13:12 +0100110 int len;
111
Sudeep KarkadaNagesha816a8de2013-06-17 14:20:00 +0100112 /* too early to use cpu->of_node */
113 cn = of_get_cpu_node(cpu, NULL);
114 if (!cn) {
115 pr_err("missing device node for CPU %d\n", cpu);
116 continue;
117 }
Vincent Guittot339ca092012-07-10 14:13:12 +0100118
119 for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++)
120 if (of_device_is_compatible(cn, cpu_eff->compatible))
121 break;
122
123 if (cpu_eff->compatible == NULL)
124 continue;
125
126 rate = of_get_property(cn, "clock-frequency", &len);
127 if (!rate || len != 4) {
128 pr_err("%s missing clock-frequency property\n",
129 cn->full_name);
130 continue;
131 }
132
Vincent Guittot339ca092012-07-10 14:13:12 +0100133 capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency;
134
135 /* Save min capacity of the system */
136 if (capacity < min_capacity)
137 min_capacity = capacity;
138
139 /* Save max capacity of the system */
140 if (capacity > max_capacity)
141 max_capacity = capacity;
142
Sudeep KarkadaNagesha816a8de2013-06-17 14:20:00 +0100143 cpu_capacity(cpu) = capacity;
Vincent Guittot339ca092012-07-10 14:13:12 +0100144 }
145
Vincent Guittot339ca092012-07-10 14:13:12 +0100146 /* If min and max capacities are equals, we bypass the update of the
147 * cpu_scale because all CPUs have the same capacity. Otherwise, we
148 * compute a middle_capacity factor that will ensure that the capacity
149 * of an 'average' CPU of the system will be as close as possible to
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400150 * SCHED_CAPACITY_SCALE, which is the default value, but with the
Vincent Guittot339ca092012-07-10 14:13:12 +0100151 * constraint explained near table_efficiency[].
152 */
Sudeep KarkadaNagesha816a8de2013-06-17 14:20:00 +0100153 if (4*max_capacity < (3*(max_capacity + min_capacity)))
Vincent Guittot339ca092012-07-10 14:13:12 +0100154 middle_capacity = (min_capacity + max_capacity)
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400155 >> (SCHED_CAPACITY_SHIFT+1);
Vincent Guittot339ca092012-07-10 14:13:12 +0100156 else
157 middle_capacity = ((max_capacity / 3)
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400158 >> (SCHED_CAPACITY_SHIFT-1)) + 1;
Vincent Guittot339ca092012-07-10 14:13:12 +0100159
160}
161
Dietmar Eggemannb4ca4bc2015-07-10 13:57:19 +0100162static const struct sched_group_energy * const cpu_core_energy(int cpu);
163
Vincent Guittot339ca092012-07-10 14:13:12 +0100164/*
165 * Look for a customed capacity of a CPU in the cpu_capacity table during the
166 * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the
167 * function returns directly for SMP system.
168 */
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400169static void update_cpu_capacity(unsigned int cpu)
Vincent Guittot339ca092012-07-10 14:13:12 +0100170{
Dietmar Eggemannb4ca4bc2015-07-10 13:57:19 +0100171 unsigned long capacity = SCHED_CAPACITY_SCALE;
Vincent Guittot339ca092012-07-10 14:13:12 +0100172
Dietmar Eggemannb4ca4bc2015-07-10 13:57:19 +0100173 if (cpu_core_energy(cpu)) {
174 int max_cap_idx = cpu_core_energy(cpu)->nr_cap_states - 1;
175 capacity = cpu_core_energy(cpu)->cap_states[max_cap_idx].cap;
176 }
177
178 set_capacity_scale(cpu, capacity);
Vincent Guittot339ca092012-07-10 14:13:12 +0100179
Russell King4ed89f22014-10-28 11:26:42 +0000180 pr_info("CPU%u: update cpu_capacity %lu\n",
Vincent Guittotd3bfca12014-08-26 13:06:48 +0200181 cpu, arch_scale_cpu_capacity(NULL, cpu));
Vincent Guittot339ca092012-07-10 14:13:12 +0100182}
183
184#else
185static inline void parse_dt_topology(void) {}
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400186static inline void update_cpu_capacity(unsigned int cpuid) {}
Vincent Guittot339ca092012-07-10 14:13:12 +0100187#endif
188
Lorenzo Pieralisidca463da2012-11-15 17:30:32 +0000189 /*
Vincent Guittot130d9aa2012-07-10 14:08:40 +0100190 * cpu topology table
191 */
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100192struct cputopo_arm cpu_topology[NR_CPUS];
Arnd Bergmann92bdd3f2013-05-31 22:49:22 +0100193EXPORT_SYMBOL_GPL(cpu_topology);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100194
Vincent Guittot4cbd6b12011-11-29 15:50:20 +0100195const struct cpumask *cpu_coregroup_mask(int cpu)
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100196{
197 return &cpu_topology[cpu].core_sibling;
198}
199
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200200/*
201 * The current assumption is that we can power gate each core independently.
202 * This will be superseded by DT binding once available.
203 */
204const struct cpumask *cpu_corepower_mask(int cpu)
205{
206 return &cpu_topology[cpu].thread_sibling;
207}
208
Mark Brown145bc292013-12-10 12:10:17 +0100209static void update_siblings_masks(unsigned int cpuid)
Vincent Guittotcb75dac2012-07-10 14:11:11 +0100210{
211 struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
212 int cpu;
213
214 /* update core and thread sibling masks */
215 for_each_possible_cpu(cpu) {
216 cpu_topo = &cpu_topology[cpu];
217
218 if (cpuid_topo->socket_id != cpu_topo->socket_id)
219 continue;
220
221 cpumask_set_cpu(cpuid, &cpu_topo->core_sibling);
222 if (cpu != cpuid)
223 cpumask_set_cpu(cpu, &cpuid_topo->core_sibling);
224
225 if (cpuid_topo->core_id != cpu_topo->core_id)
226 continue;
227
228 cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling);
229 if (cpu != cpuid)
230 cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling);
231 }
232 smp_wmb();
233}
234
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100235/*
236 * store_cpu_topology is called at boot when only one cpu is running
237 * and with the mutex cpu_hotplug.lock locked, when several cpus have booted,
238 * which prevents simultaneous write access to cpu_topology array
239 */
240void store_cpu_topology(unsigned int cpuid)
241{
242 struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid];
243 unsigned int mpidr;
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100244
245 /* If the cpu topology has been already set, just return */
246 if (cpuid_topo->core_id != -1)
247 return;
248
249 mpidr = read_cpuid_mpidr();
250
251 /* create cpu topology mapping */
252 if ((mpidr & MPIDR_SMP_BITMASK) == MPIDR_SMP_VALUE) {
253 /*
254 * This is a multiprocessor system
255 * multiprocessor format & multiprocessor mode field are set
256 */
257
258 if (mpidr & MPIDR_MT_BITMASK) {
259 /* core performance interdependency */
Lorenzo Pieralisi71db5bf2012-11-16 15:24:06 +0000260 cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
261 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
262 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 2);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100263 } else {
264 /* largely independent cores */
265 cpuid_topo->thread_id = -1;
Lorenzo Pieralisi71db5bf2012-11-16 15:24:06 +0000266 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
267 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100268 }
269 } else {
270 /*
271 * This is an uniprocessor system
272 * we are in multiprocessor format but uniprocessor system
273 * or in the old uniprocessor format
274 */
275 cpuid_topo->thread_id = -1;
276 cpuid_topo->core_id = 0;
277 cpuid_topo->socket_id = -1;
278 }
279
Vincent Guittotcb75dac2012-07-10 14:11:11 +0100280 update_siblings_masks(cpuid);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100281
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400282 update_cpu_capacity(cpuid);
Vincent Guittot339ca092012-07-10 14:13:12 +0100283
Russell King4ed89f22014-10-28 11:26:42 +0000284 pr_info("CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n",
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100285 cpuid, cpu_topology[cpuid].thread_id,
286 cpu_topology[cpuid].core_id,
287 cpu_topology[cpuid].socket_id, mpidr);
288}
289
Dietmar Eggemann61100bd2014-11-14 17:16:41 +0000290/*
291 * ARM TC2 specific energy cost model data. There are no unit requirements for
292 * the data. Data can be normalized to any reference point, but the
293 * normalization must be consistent. That is, one bogo-joule/watt must be the
294 * same quantity for all data, but we don't care what it is.
295 */
296static struct idle_state idle_states_cluster_a7[] = {
297 { .power = 25 }, /* arch_cpu_idle() (active idle) = WFI */
298 { .power = 25 }, /* WFI */
299 { .power = 10 }, /* cluster-sleep-l */
300 };
301
302static struct idle_state idle_states_cluster_a15[] = {
303 { .power = 70 }, /* arch_cpu_idle() (active idle) = WFI */
304 { .power = 70 }, /* WFI */
305 { .power = 25 }, /* cluster-sleep-b */
306 };
307
308static struct capacity_state cap_states_cluster_a7[] = {
309 /* Cluster only power */
310 { .cap = 150, .power = 2967, }, /* 350 MHz */
311 { .cap = 172, .power = 2792, }, /* 400 MHz */
312 { .cap = 215, .power = 2810, }, /* 500 MHz */
313 { .cap = 258, .power = 2815, }, /* 600 MHz */
314 { .cap = 301, .power = 2919, }, /* 700 MHz */
315 { .cap = 344, .power = 2847, }, /* 800 MHz */
316 { .cap = 387, .power = 3917, }, /* 900 MHz */
317 { .cap = 430, .power = 4905, }, /* 1000 MHz */
318 };
319
320static struct capacity_state cap_states_cluster_a15[] = {
321 /* Cluster only power */
322 { .cap = 426, .power = 7920, }, /* 500 MHz */
323 { .cap = 512, .power = 8165, }, /* 600 MHz */
324 { .cap = 597, .power = 8172, }, /* 700 MHz */
325 { .cap = 682, .power = 8195, }, /* 800 MHz */
326 { .cap = 768, .power = 8265, }, /* 900 MHz */
327 { .cap = 853, .power = 8446, }, /* 1000 MHz */
328 { .cap = 938, .power = 11426, }, /* 1100 MHz */
329 { .cap = 1024, .power = 15200, }, /* 1200 MHz */
330 };
331
332static struct sched_group_energy energy_cluster_a7 = {
333 .nr_idle_states = ARRAY_SIZE(idle_states_cluster_a7),
334 .idle_states = idle_states_cluster_a7,
335 .nr_cap_states = ARRAY_SIZE(cap_states_cluster_a7),
336 .cap_states = cap_states_cluster_a7,
337};
338
339static struct sched_group_energy energy_cluster_a15 = {
340 .nr_idle_states = ARRAY_SIZE(idle_states_cluster_a15),
341 .idle_states = idle_states_cluster_a15,
342 .nr_cap_states = ARRAY_SIZE(cap_states_cluster_a15),
343 .cap_states = cap_states_cluster_a15,
344};
345
346static struct idle_state idle_states_core_a7[] = {
347 { .power = 0 }, /* arch_cpu_idle (active idle) = WFI */
348 { .power = 0 }, /* WFI */
349 { .power = 0 }, /* cluster-sleep-l */
350 };
351
352static struct idle_state idle_states_core_a15[] = {
353 { .power = 0 }, /* arch_cpu_idle (active idle) = WFI */
354 { .power = 0 }, /* WFI */
355 { .power = 0 }, /* cluster-sleep-b */
356 };
357
358static struct capacity_state cap_states_core_a7[] = {
359 /* Power per cpu */
360 { .cap = 150, .power = 187, }, /* 350 MHz */
361 { .cap = 172, .power = 275, }, /* 400 MHz */
362 { .cap = 215, .power = 334, }, /* 500 MHz */
363 { .cap = 258, .power = 407, }, /* 600 MHz */
364 { .cap = 301, .power = 447, }, /* 700 MHz */
365 { .cap = 344, .power = 549, }, /* 800 MHz */
366 { .cap = 387, .power = 761, }, /* 900 MHz */
367 { .cap = 430, .power = 1024, }, /* 1000 MHz */
368 };
369
370static struct capacity_state cap_states_core_a15[] = {
371 /* Power per cpu */
372 { .cap = 426, .power = 2021, }, /* 500 MHz */
373 { .cap = 512, .power = 2312, }, /* 600 MHz */
374 { .cap = 597, .power = 2756, }, /* 700 MHz */
375 { .cap = 682, .power = 3125, }, /* 800 MHz */
376 { .cap = 768, .power = 3524, }, /* 900 MHz */
377 { .cap = 853, .power = 3846, }, /* 1000 MHz */
378 { .cap = 938, .power = 5177, }, /* 1100 MHz */
379 { .cap = 1024, .power = 6997, }, /* 1200 MHz */
380 };
381
382static struct sched_group_energy energy_core_a7 = {
383 .nr_idle_states = ARRAY_SIZE(idle_states_core_a7),
384 .idle_states = idle_states_core_a7,
385 .nr_cap_states = ARRAY_SIZE(cap_states_core_a7),
386 .cap_states = cap_states_core_a7,
387};
388
389static struct sched_group_energy energy_core_a15 = {
390 .nr_idle_states = ARRAY_SIZE(idle_states_core_a15),
391 .idle_states = idle_states_core_a15,
392 .nr_cap_states = ARRAY_SIZE(cap_states_core_a15),
393 .cap_states = cap_states_core_a15,
394};
395
396/* sd energy functions */
397static inline
398const struct sched_group_energy * const cpu_cluster_energy(int cpu)
399{
400 return cpu_topology[cpu].socket_id ? &energy_cluster_a7 :
401 &energy_cluster_a15;
402}
403
404static inline
405const struct sched_group_energy * const cpu_core_energy(int cpu)
406{
407 return cpu_topology[cpu].socket_id ? &energy_core_a7 :
408 &energy_core_a15;
409}
410
Guenter Roeckb6220ad2014-06-24 18:05:29 -0700411static inline int cpu_corepower_flags(void)
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200412{
Morten Rasmussen858d7182015-01-13 13:50:46 +0000413 return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN | \
414 SD_SHARE_CAP_STATES;
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200415}
416
417static struct sched_domain_topology_level arm_topology[] = {
418#ifdef CONFIG_SCHED_MC
Dietmar Eggemann61100bd2014-11-14 17:16:41 +0000419 { cpu_coregroup_mask, cpu_corepower_flags, cpu_core_energy, SD_INIT_NAME(MC) },
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200420#endif
Dietmar Eggemann61100bd2014-11-14 17:16:41 +0000421 { cpu_cpu_mask, NULL, cpu_cluster_energy, SD_INIT_NAME(DIE) },
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200422 { NULL, },
423};
424
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100425/*
426 * init_cpu_topology is called at boot when only one cpu is running
427 * which prevent simultaneous write access to cpu_topology array
428 */
Venkatraman Sathiyamoorthyf7e416e2012-08-03 07:58:33 +0100429void __init init_cpu_topology(void)
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100430{
431 unsigned int cpu;
432
Nicolas Pitreca8ce3d2014-05-26 18:19:39 -0400433 /* init core mask and capacity */
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100434 for_each_possible_cpu(cpu) {
435 struct cputopo_arm *cpu_topo = &(cpu_topology[cpu]);
436
437 cpu_topo->thread_id = -1;
438 cpu_topo->core_id = -1;
439 cpu_topo->socket_id = -1;
440 cpumask_clear(&cpu_topo->core_sibling);
441 cpumask_clear(&cpu_topo->thread_sibling);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100442 }
443 smp_wmb();
Vincent Guittot339ca092012-07-10 14:13:12 +0100444
445 parse_dt_topology();
Vincent Guittotfb2aa852014-04-11 11:44:41 +0200446
447 /* Set scheduler topology descriptor */
448 set_sched_topology(arm_topology);
Vincent Guittotc9018aa2011-08-08 13:21:59 +0100449}