diff options
author | Bob Breuer <breuerr@mc.net> | 2006-03-24 01:36:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-24 01:36:19 -0500 |
commit | a54123e27779049d27d21e6c8adfee73aa2c0734 (patch) | |
tree | 265849e706e4ebe3b75127ebe6e3cbfe2a78850a /arch/sparc/kernel/smp.c | |
parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) |
[SPARC]: Try to start getting SMP back into shape.
Todo items:
- IRQ_INPROGRESS flag - use sparc64 irq buckets, or generic irq_desc?
- sun4d
- re-indent large chunks of sun4m_smp.c
- some places assume sequential cpu numbering (i.e. 0,1 instead of 0,2)
Last I checked (with 2.6.14), random programs segfault with dual
HyperSPARC. And with SuperSPARC II's, it seems stable but will
eventually die from a write lock error (wrong lock owner or something).
I haven't tried the HyperSPARC + highmem combination recently, so that
may still be a problem.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/smp.c')
-rw-r--r-- | arch/sparc/kernel/smp.c | 84 |
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 | ||
46 | cpumask_t cpu_online_map = CPU_MASK_NONE; | 46 | cpumask_t cpu_online_map = CPU_MASK_NONE; |
47 | cpumask_t phys_cpu_present_map = CPU_MASK_NONE; | 47 | cpumask_t phys_cpu_present_map = CPU_MASK_NONE; |
48 | cpumask_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 */ |
58 | unsigned char bitops_spinlock = 0; | 59 | unsigned char bitops_spinlock = 0; |
59 | 60 | ||
60 | volatile unsigned long ipi_count; | ||
61 | |||
62 | volatile int smp_process_available=0; | ||
63 | volatile int smp_commenced = 0; | ||
64 | |||
65 | void __init smp_store_cpu_info(int id) | 61 | void __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 | ||
80 | void __init smp_cpus_done(unsigned int max_cpus) | 76 | void __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 | ||
84 | void cpu_panic(void) | 96 | void cpu_panic(void) |
@@ -89,17 +101,6 @@ void cpu_panic(void) | |||
89 | 101 | ||
90 | struct linux_prom_registers smp_penguin_ctable __initdata = { 0 }; | 102 | struct linux_prom_registers smp_penguin_ctable __initdata = { 0 }; |
91 | 103 | ||
92 | void __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 | |||
103 | void smp_send_reschedule(int cpu) | 104 | void 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 | ||
255 | void __init smp_prepare_cpus(unsigned int maxcpus) | 256 | void __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 | ||
259 | void __devinit smp_prepare_boot_cpu(void) | 282 | void __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 | ||
266 | int __devinit __cpu_up(unsigned int cpu) | 298 | int __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 | ||
271 | void smp_bogo(struct seq_file *m) | 313 | void smp_bogo(struct seq_file *m) |