Commit 33dbcf72 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] Make sure smp_processor_id works very early in boot

There's a small period early in boot where we don't know which cpu we're
running on. That's ok, except that it means we have no paca, or more
correctly that our paca pointer points somewhere random.

So that we can safely call things like smp_processor_id(), we need a paca,
so just assume we're on cpu 0. No code should _write_ to the paca before
we've set the correct one up.

We setup the proper paca after we've scanned the flat device tree in
early_setup(), so there's no need to do it again in start_here_common.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent feb76c7b
...@@ -1583,9 +1583,6 @@ _GLOBAL(__start_initialization_multiplatform) ...@@ -1583,9 +1583,6 @@ _GLOBAL(__start_initialization_multiplatform)
/* Setup some critical 970 SPRs before switching MMU off */ /* Setup some critical 970 SPRs before switching MMU off */
bl .__970_cpu_preinit bl .__970_cpu_preinit
/* cpu # */
li r24,0
/* Switch off MMU if not already */ /* Switch off MMU if not already */
LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
add r4,r4,r30 add r4,r4,r30
...@@ -1946,14 +1943,6 @@ _STATIC(start_here_common) ...@@ -1946,14 +1943,6 @@ _STATIC(start_here_common)
li r3,0 li r3,0
bl .do_cpu_ftr_fixups bl .do_cpu_ftr_fixups
LOAD_REG_IMMEDIATE(r26, boot_cpuid)
lwz r26,0(r26)
LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
add r13,r13,r24 /* for this processor. */
mtspr SPRN_SPRG3,r13
/* ptr to current */ /* ptr to current */
LOAD_REG_IMMEDIATE(r4, init_task) LOAD_REG_IMMEDIATE(r4, init_task)
std r4,PACACURRENT(r13) std r4,PACACURRENT(r13)
......
...@@ -177,6 +177,9 @@ void __init setup_paca(int cpu) ...@@ -177,6 +177,9 @@ void __init setup_paca(int cpu)
void __init early_setup(unsigned long dt_ptr) void __init early_setup(unsigned long dt_ptr)
{ {
/* Assume we're on cpu 0 for now. Don't write to the paca yet! */
setup_paca(0);
/* Enable early debugging if any specified (see udbg.h) */ /* Enable early debugging if any specified (see udbg.h) */
udbg_early_init(); udbg_early_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment