diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-17 04:29:17 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:13:22 -0500 |
commit | 72aff53f1fe74153eccef303ab2f79de888d248c (patch) | |
tree | a229645be99274d36bed04bed355d74ec3c0baa2 /arch/sparc64/kernel/smp.c | |
parent | 19a0d585e80e84b54bb9bf120bf0c826045dd3dd (diff) |
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/smp.c')
-rw-r--r-- | arch/sparc64/kernel/smp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 527dfd7ae210..b586345fe3b9 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -316,6 +316,8 @@ static void smp_synchronize_one_tick(int cpu) | |||
316 | spin_unlock_irqrestore(&itc_sync_lock, flags); | 316 | spin_unlock_irqrestore(&itc_sync_lock, flags); |
317 | } | 317 | } |
318 | 318 | ||
319 | extern void sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int load); | ||
320 | |||
319 | extern unsigned long sparc64_cpu_startup; | 321 | extern unsigned long sparc64_cpu_startup; |
320 | 322 | ||
321 | /* The OBP cpu startup callback truncates the 3rd arg cookie to | 323 | /* The OBP cpu startup callback truncates the 3rd arg cookie to |
@@ -339,6 +341,9 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu) | |||
339 | cpu_set(cpu, cpu_callout_map); | 341 | cpu_set(cpu, cpu_callout_map); |
340 | 342 | ||
341 | if (tlb_type == hypervisor) { | 343 | if (tlb_type == hypervisor) { |
344 | /* Alloc the mondo queues, cpu will load them. */ | ||
345 | sun4v_init_mondo_queues(0, cpu, 1, 0); | ||
346 | |||
342 | prom_startcpu_cpuid(cpu, entry, cookie); | 347 | prom_startcpu_cpuid(cpu, entry, cookie); |
343 | } else { | 348 | } else { |
344 | int cpu_node; | 349 | int cpu_node; |
@@ -352,6 +357,7 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu) | |||
352 | break; | 357 | break; |
353 | udelay(100); | 358 | udelay(100); |
354 | } | 359 | } |
360 | |||
355 | if (callin_flag) { | 361 | if (callin_flag) { |
356 | ret = 0; | 362 | ret = 0; |
357 | } else { | 363 | } else { |