Make arch/sparc64/kernel/trampoline.S in 2.6.27.1 lock prom_entry_lock
when calling the PROM. This prevents a race condition that I observed
causing a hang on startup on a 12-CPU E4500.
I am not subscribed to this list, so please CC me on replies.
Signed-off-by: Andrea Shepard <andrea@persephoneslair.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
+ sethi %hi(prom_entry_lock), %g2
+1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
+ membar #StoreLoad | #StoreStore
+ brnz,pn %g1, 1b
+ nop
+
/* As a hack, put &init_thread_union into %g6.
* prom_world() loads from here to restore the %asi
* register.
/* As a hack, put &init_thread_union into %g6.
* prom_world() loads from here to restore the %asi
* register.
sethi %hi(is_sun4v), %o0
lduw [%o0 + %lo(is_sun4v)], %o0
sethi %hi(is_sun4v), %o0
lduw [%o0 + %lo(is_sun4v)], %o0
nop
TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
nop
TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
call %o1
add %sp, (2047 + 128), %o0
call %o1
add %sp, (2047 + 128), %o0
-1: sethi %hi(sparc64_ttable_tl0), %o0
+2: sethi %hi(sparc64_ttable_tl0), %o0
set prom_set_trap_table_name, %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
mov 1, %g2
set prom_set_trap_table_name, %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
mov 1, %g2
call %o1
add %sp, (2047 + 128), %o0
call %o1
add %sp, (2047 + 128), %o0
+3: sethi %hi(prom_entry_lock), %g2
+ stb %g0, [%g2 + %lo(prom_entry_lock)]
+ membar #StoreStore | #StoreLoad
+
+ ldx [%l0], %g6
ldx [%g6 + TI_TASK], %g4
mov 1, %g5
ldx [%g6 + TI_TASK], %g4
mov 1, %g5