aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Breuer <breuerr@mc.net>2006-06-20 03:30:31 -0400
committerDavid S. Miller <davem@davemloft.net>2006-06-20 03:30:31 -0400
commit7202fb496af235506a3c6fea836fe4c9957f730e (patch)
tree44e5338a62fe866da0f9bac2f9bfb75226e4ca32
parenta8cbdcea341ac2f404ee81aa1c19d54aaa0416b4 (diff)
[SPARC]: Setup cpu_possible_map
Setup cpu_possible_map so the secondary cpus will get started. Signed-off-by: Bob Breuer <breuerr@mc.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc/kernel/smp.c30
-rw-r--r--include/asm-sparc/smp.h8
3 files changed, 31 insertions, 9 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)
267void __init smp_prepare_cpus(unsigned int max_cpus) 267void __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 */
293void __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
293void __devinit smp_prepare_boot_cpu(void) 307void __devinit smp_prepare_boot_cpu(void)
294{ 308{
295 int cpuid = hard_smp_processor_id(); 309 int cpuid = hard_smp_processor_id();
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 98c46e3fbe8a..c1a289327a79 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -146,6 +146,8 @@ static inline int hard_smp_processor_id(void)
146#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier 146#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
147#define prof_counter(__cpu) cpu_data(__cpu).counter 147#define prof_counter(__cpu) cpu_data(__cpu).counter
148 148
149void smp_setup_cpu_possible_map(void);
150
149#endif /* !(__ASSEMBLY__) */ 151#endif /* !(__ASSEMBLY__) */
150 152
151/* Sparc specific messages. */ 153/* Sparc specific messages. */
@@ -162,7 +164,11 @@ static inline int hard_smp_processor_id(void)
162#define MBOX_IDLECPU2 0xFD 164#define MBOX_IDLECPU2 0xFD
163#define MBOX_STOPCPU2 0xFE 165#define MBOX_STOPCPU2 0xFE
164 166
165#endif /* SMP */ 167#else /* SMP */
168
169#define smp_setup_cpu_possible_map() do { } while (0)
170
171#endif /* !(SMP) */
166 172
167#define NO_PROC_ID 0xFF 173#define NO_PROC_ID 0xFF
168 174