diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/smp.c | 30 |
2 files changed, 24 insertions, 8 deletions
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c index 8531a8e15832..2cbf282f0d00 100644 --- a/arch/sparc/kernel/setup.c +++ b/arch/sparc/kernel/setup.c | |||
@@ -349,6 +349,8 @@ void __init setup_arch(char **cmdline_p) | |||
349 | init_mm.context = (unsigned long) NO_CONTEXT; | 349 | init_mm.context = (unsigned long) NO_CONTEXT; |
350 | init_task.thread.kregs = &fake_swapper_regs; | 350 | init_task.thread.kregs = &fake_swapper_regs; |
351 | 351 | ||
352 | smp_setup_cpu_possible_map(); | ||
353 | |||
352 | paging_init(); | 354 | paging_init(); |
353 | } | 355 | } |
354 | 356 | ||
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c index 40b42c88e6a7..d0ccb8ad1d54 100644 --- a/arch/sparc/kernel/smp.c +++ b/arch/sparc/kernel/smp.c | |||
@@ -267,22 +267,18 @@ int setup_profiling_timer(unsigned int multiplier) | |||
267 | void __init smp_prepare_cpus(unsigned int max_cpus) | 267 | void __init smp_prepare_cpus(unsigned int max_cpus) |
268 | { | 268 | { |
269 | extern void smp4m_boot_cpus(void); | 269 | extern void smp4m_boot_cpus(void); |
270 | int i, cpuid, ncpus, extra; | 270 | int i, cpuid, extra; |
271 | 271 | ||
272 | BUG_ON(sparc_cpu_model != sun4m); | 272 | BUG_ON(sparc_cpu_model != sun4m); |
273 | printk("Entering SMP Mode...\n"); | 273 | printk("Entering SMP Mode...\n"); |
274 | 274 | ||
275 | ncpus = 1; | ||
276 | extra = 0; | 275 | extra = 0; |
277 | for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) { | 276 | for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) { |
278 | if (cpuid == boot_cpu_id) | 277 | if (cpuid >= NR_CPUS) |
279 | continue; | ||
280 | if (cpuid < NR_CPUS && ncpus++ < max_cpus) | ||
281 | cpu_set(cpuid, phys_cpu_present_map); | ||
282 | else | ||
283 | extra++; | 278 | extra++; |
284 | } | 279 | } |
285 | if (max_cpus >= NR_CPUS && extra) | 280 | /* i = number of cpus */ |
281 | if (extra && max_cpus > i - extra) | ||
286 | printk("Warning: NR_CPUS is too low to start all cpus\n"); | 282 | printk("Warning: NR_CPUS is too low to start all cpus\n"); |
287 | 283 | ||
288 | smp_store_cpu_info(boot_cpu_id); | 284 | smp_store_cpu_info(boot_cpu_id); |
@@ -290,6 +286,24 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
290 | smp4m_boot_cpus(); | 286 | smp4m_boot_cpus(); |
291 | } | 287 | } |
292 | 288 | ||
289 | /* Set this up early so that things like the scheduler can init | ||
290 | * properly. We use the same cpu mask for both the present and | ||
291 | * possible cpu map. | ||
292 | */ | ||
293 | void __init smp_setup_cpu_possible_map(void) | ||
294 | { | ||
295 | int instance, mid; | ||
296 | |||
297 | instance = 0; | ||
298 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
299 | if (mid < NR_CPUS) { | ||
300 | cpu_set(mid, phys_cpu_present_map); | ||
301 | cpu_set(mid, cpu_present_map); | ||
302 | } | ||
303 | instance++; | ||
304 | } | ||
305 | } | ||
306 | |||
293 | void __devinit smp_prepare_boot_cpu(void) | 307 | void __devinit smp_prepare_boot_cpu(void) |
294 | { | 308 | { |
295 | int cpuid = hard_smp_processor_id(); | 309 | int cpuid = hard_smp_processor_id(); |