|
8 | 8 | * Copyright (C) 2000, 2001 Silicon Graphics, Inc. |
9 | 9 | * Copyright (C) 2000, 2001, 2003 Broadcom Corporation |
10 | 10 | */ |
| 11 | +#include <linux/acpi.h> |
11 | 12 | #include <linux/cpu.h> |
12 | 13 | #include <linux/cpumask.h> |
13 | 14 | #include <linux/init.h> |
@@ -37,10 +38,6 @@ EXPORT_SYMBOL(__cpu_number_map); |
37 | 38 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ |
38 | 39 | EXPORT_SYMBOL(__cpu_logical_map); |
39 | 40 |
|
40 | | -/* Number of threads (siblings) per CPU core */ |
41 | | -int smp_num_siblings = 1; |
42 | | -EXPORT_SYMBOL(smp_num_siblings); |
43 | | - |
44 | 41 | /* Representing the threads (siblings) of each logical CPU */ |
45 | 42 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; |
46 | 43 | EXPORT_SYMBOL(cpu_sibling_map); |
@@ -229,9 +226,12 @@ void __init loongson_prepare_cpus(unsigned int max_cpus) |
229 | 226 | { |
230 | 227 | int i = 0; |
231 | 228 |
|
| 229 | + parse_acpi_topology(); |
| 230 | + |
232 | 231 | for (i = 0; i < loongson_sysconf.nr_cpus; i++) { |
233 | 232 | set_cpu_present(i, true); |
234 | 233 | csr_mail_send(0, __cpu_logical_map[i], 0); |
| 234 | + cpu_data[i].global_id = __cpu_logical_map[i]; |
235 | 235 | } |
236 | 236 |
|
237 | 237 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; |
@@ -272,10 +272,10 @@ void loongson_init_secondary(void) |
272 | 272 | numa_add_cpu(cpu); |
273 | 273 | #endif |
274 | 274 | per_cpu(cpu_state, cpu) = CPU_ONLINE; |
275 | | - cpu_data[cpu].core = |
276 | | - cpu_logical_map(cpu) % loongson_sysconf.cores_per_package; |
277 | 275 | cpu_data[cpu].package = |
278 | 276 | cpu_logical_map(cpu) / loongson_sysconf.cores_per_package; |
| 277 | + cpu_data[cpu].core = pptt_enabled ? cpu_data[cpu].core : |
| 278 | + cpu_logical_map(cpu) % loongson_sysconf.cores_per_package; |
279 | 279 | } |
280 | 280 |
|
281 | 281 | void loongson_smp_finish(void) |
@@ -381,14 +381,10 @@ static inline void set_cpu_sibling_map(int cpu) |
381 | 381 |
|
382 | 382 | cpumask_set_cpu(cpu, &cpu_sibling_setup_map); |
383 | 383 |
|
384 | | - if (smp_num_siblings <= 1) |
385 | | - cpumask_set_cpu(cpu, &cpu_sibling_map[cpu]); |
386 | | - else { |
387 | | - for_each_cpu(i, &cpu_sibling_setup_map) { |
388 | | - if (cpus_are_siblings(cpu, i)) { |
389 | | - cpumask_set_cpu(i, &cpu_sibling_map[cpu]); |
390 | | - cpumask_set_cpu(cpu, &cpu_sibling_map[i]); |
391 | | - } |
| 384 | + for_each_cpu(i, &cpu_sibling_setup_map) { |
| 385 | + if (cpus_are_siblings(cpu, i)) { |
| 386 | + cpumask_set_cpu(i, &cpu_sibling_map[cpu]); |
| 387 | + cpumask_set_cpu(cpu, &cpu_sibling_map[i]); |
392 | 388 | } |
393 | 389 | } |
394 | 390 | } |
|
0 commit comments