diff options
author | Anton Blanchard <anton@samba.org> | 2006-03-25 01:25:17 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-26 22:48:48 -0500 |
commit | 4df20460a3ff0d60280738b094945c56cb5567a5 (patch) | |
tree | 39f831cf5f778b14a08b3453a8f798b2b8be8813 /arch/powerpc/kernel/setup-common.c | |
parent | b4f382a3e5e20ba867e7aa5b01189a3fd40eea2c (diff) |
[PATCH] powerpc: Allow non zero boot cpuids
We currently have a hack to flip the boot cpu and its secondary thread
to logical cpuid 0 and 1. This means the logical - physical mapping will
differ depending on which cpu is boot cpu. This is most apparent on
kexec, where we might kexec on any cpu and therefore change the mapping
from boot to boot.
The patch below does a first pass early on to work out the logical cpuid
of the boot thread. We then fix up some paca structures to match.
Ive also removed the boot_cpuid_phys variable for ppc64, to be
consistent we use get_hard_smp_processor_id(boot_cpuid) everywhere.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup-common.c')
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index c1d62bf11f29..b17630ad4ac7 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -352,12 +352,13 @@ void __init check_for_initrd(void) | |||
352 | * must be called before using this. | 352 | * must be called before using this. |
353 | * | 353 | * |
354 | * While we're here, we may as well set the "physical" cpu ids in the paca. | 354 | * While we're here, we may as well set the "physical" cpu ids in the paca. |
355 | * | ||
356 | * NOTE: This must match the parsing done in early_init_dt_scan_cpus. | ||
355 | */ | 357 | */ |
356 | void __init smp_setup_cpu_maps(void) | 358 | void __init smp_setup_cpu_maps(void) |
357 | { | 359 | { |
358 | struct device_node *dn = NULL; | 360 | struct device_node *dn = NULL; |
359 | int cpu = 0; | 361 | int cpu = 0; |
360 | int swap_cpuid = 0; | ||
361 | 362 | ||
362 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { | 363 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { |
363 | int *intserv; | 364 | int *intserv; |
@@ -376,24 +377,11 @@ void __init smp_setup_cpu_maps(void) | |||
376 | for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { | 377 | for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { |
377 | cpu_set(cpu, cpu_present_map); | 378 | cpu_set(cpu, cpu_present_map); |
378 | set_hard_smp_processor_id(cpu, intserv[j]); | 379 | set_hard_smp_processor_id(cpu, intserv[j]); |
379 | |||
380 | if (intserv[j] == boot_cpuid_phys) | ||
381 | swap_cpuid = cpu; | ||
382 | cpu_set(cpu, cpu_possible_map); | 380 | cpu_set(cpu, cpu_possible_map); |
383 | cpu++; | 381 | cpu++; |
384 | } | 382 | } |
385 | } | 383 | } |
386 | 384 | ||
387 | /* Swap CPU id 0 with boot_cpuid_phys, so we can always assume that | ||
388 | * boot cpu is logical 0. | ||
389 | */ | ||
390 | if (boot_cpuid_phys != get_hard_smp_processor_id(0)) { | ||
391 | u32 tmp; | ||
392 | tmp = get_hard_smp_processor_id(0); | ||
393 | set_hard_smp_processor_id(0, boot_cpuid_phys); | ||
394 | set_hard_smp_processor_id(swap_cpuid, tmp); | ||
395 | } | ||
396 | |||
397 | #ifdef CONFIG_PPC64 | 385 | #ifdef CONFIG_PPC64 |
398 | /* | 386 | /* |
399 | * On pSeries LPAR, we need to know how many cpus | 387 | * On pSeries LPAR, we need to know how many cpus |