aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/smp.c')
-rw-r--r--arch/sparc/kernel/smp.c84
1 files changed, 63 insertions, 21 deletions
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c
index ea5682ce7031..2be812115197 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp.c
@@ -45,6 +45,7 @@ volatile int __cpu_logical_map[NR_CPUS];
45 45
46cpumask_t cpu_online_map = CPU_MASK_NONE; 46cpumask_t cpu_online_map = CPU_MASK_NONE;
47cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 47cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
48cpumask_t smp_commenced_mask = CPU_MASK_NONE;
48 49
49/* The only guaranteed locking primitive available on all Sparc 50/* The only guaranteed locking primitive available on all Sparc
50 * processors is 'ldstub [%reg + immediate], %dest_reg' which atomically 51 * processors is 'ldstub [%reg + immediate], %dest_reg' which atomically
@@ -57,11 +58,6 @@ cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
57/* Used to make bitops atomic */ 58/* Used to make bitops atomic */
58unsigned char bitops_spinlock = 0; 59unsigned char bitops_spinlock = 0;
59 60
60volatile unsigned long ipi_count;
61
62volatile int smp_process_available=0;
63volatile int smp_commenced = 0;
64
65void __init smp_store_cpu_info(int id) 61void __init smp_store_cpu_info(int id)
66{ 62{
67 int cpu_node; 63 int cpu_node;
@@ -79,6 +75,22 @@ void __init smp_store_cpu_info(int id)
79 75
80void __init smp_cpus_done(unsigned int max_cpus) 76void __init smp_cpus_done(unsigned int max_cpus)
81{ 77{
78 extern void smp4m_smp_done(void);
79 unsigned long bogosum = 0;
80 int cpu, num;
81
82 for (cpu = 0, num = 0; cpu < NR_CPUS; cpu++)
83 if (cpu_online(cpu)) {
84 num++;
85 bogosum += cpu_data(cpu).udelay_val;
86 }
87
88 printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
89 num, bogosum/(500000/HZ),
90 (bogosum/(5000/HZ))%100);
91
92 BUG_ON(sparc_cpu_model != sun4m);
93 smp4m_smp_done();
82} 94}
83 95
84void cpu_panic(void) 96void cpu_panic(void)
@@ -89,17 +101,6 @@ void cpu_panic(void)
89 101
90struct linux_prom_registers smp_penguin_ctable __initdata = { 0 }; 102struct linux_prom_registers smp_penguin_ctable __initdata = { 0 };
91 103
92void __init smp_boot_cpus(void)
93{
94 extern void smp4m_boot_cpus(void);
95 extern void smp4d_boot_cpus(void);
96
97 if (sparc_cpu_model == sun4m)
98 smp4m_boot_cpus();
99 else
100 smp4d_boot_cpus();
101}
102
103void smp_send_reschedule(int cpu) 104void smp_send_reschedule(int cpu)
104{ 105{
105 /* See sparc64 */ 106 /* See sparc64 */
@@ -252,20 +253,61 @@ int setup_profiling_timer(unsigned int multiplier)
252 return 0; 253 return 0;
253} 254}
254 255
255void __init smp_prepare_cpus(unsigned int maxcpus) 256void __init smp_prepare_cpus(unsigned int max_cpus)
256{ 257{
258 extern void smp4m_boot_cpus(void);
259 int i, cpuid, ncpus, extra;
260
261 BUG_ON(sparc_cpu_model != sun4m);
262 printk("Entering SMP Mode...\n");
263
264 ncpus = 1;
265 extra = 0;
266 for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) {
267 if (cpuid == boot_cpu_id)
268 continue;
269 if (cpuid < NR_CPUS && ncpus++ < max_cpus)
270 cpu_set(cpuid, phys_cpu_present_map);
271 else
272 extra++;
273 }
274 if (max_cpus >= NR_CPUS && extra)
275 printk("Warning: NR_CPUS is too low to start all cpus\n");
276
277 smp_store_cpu_info(boot_cpu_id);
278
279 smp4m_boot_cpus();
257} 280}
258 281
259void __devinit smp_prepare_boot_cpu(void) 282void __devinit smp_prepare_boot_cpu(void)
260{ 283{
261 current_thread_info()->cpu = hard_smp_processor_id(); 284 int cpuid = hard_smp_processor_id();
262 cpu_set(smp_processor_id(), cpu_online_map); 285
263 cpu_set(smp_processor_id(), phys_cpu_present_map); 286 if (cpuid >= NR_CPUS) {
287 prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
288 prom_halt();
289 }
290 if (cpuid != 0)
291 printk("boot cpu id != 0, this could work but is untested\n");
292
293 current_thread_info()->cpu = cpuid;
294 cpu_set(cpuid, cpu_online_map);
295 cpu_set(cpuid, phys_cpu_present_map);
264} 296}
265 297
266int __devinit __cpu_up(unsigned int cpu) 298int __devinit __cpu_up(unsigned int cpu)
267{ 299{
268 panic("smp doesn't work\n"); 300 extern int smp4m_boot_one_cpu(int);
301 int ret;
302
303 ret = smp4m_boot_one_cpu(cpu);
304
305 if (!ret) {
306 cpu_set(cpu, smp_commenced_mask);
307 while (!cpu_online(cpu))
308 mb();
309 }
310 return ret;
269} 311}
270 312
271void smp_bogo(struct seq_file *m) 313void smp_bogo(struct seq_file *m)