diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-14 02:09:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-14 16:31:38 -0400 |
commit | c68e5d39a502d01421cbc70d25c377e9215facef (patch) | |
tree | 9135a68681381d94a929b57a28a1878df0134ff7 /arch/sparc/kernel/sun4d_smp.c | |
parent | 5d83d66635bb1642f3c6a3690c28ff4afdf1ae5f (diff) |
sparc32: Implement hard_smp_processor_id() via instruction patching.
This is the last non-trivial user of btfixup.
Like sparc64, use a special patch section to resolve the various
implementations of how to read the current CPU's ID when we don't
have current_thread_info()->cpu necessarily available.
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'arch/sparc/kernel/sun4d_smp.c')
-rw-r--r-- | arch/sparc/kernel/sun4d_smp.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index f17fd287bf7d..38ca0aac2ef2 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -52,7 +52,7 @@ static inline void show_leds(int cpuid) | |||
52 | 52 | ||
53 | void __cpuinit smp4d_callin(void) | 53 | void __cpuinit smp4d_callin(void) |
54 | { | 54 | { |
55 | int cpuid = hard_smp4d_processor_id(); | 55 | int cpuid = hard_smp_processor_id(); |
56 | unsigned long flags; | 56 | unsigned long flags; |
57 | 57 | ||
58 | /* Show we are alive */ | 58 | /* Show we are alive */ |
@@ -354,7 +354,7 @@ static void smp4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, | |||
354 | /* Running cross calls. */ | 354 | /* Running cross calls. */ |
355 | void smp4d_cross_call_irq(void) | 355 | void smp4d_cross_call_irq(void) |
356 | { | 356 | { |
357 | int i = hard_smp4d_processor_id(); | 357 | int i = hard_smp_processor_id(); |
358 | 358 | ||
359 | ccall_info.processors_in[i] = 1; | 359 | ccall_info.processors_in[i] = 1; |
360 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, | 360 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, |
@@ -365,7 +365,7 @@ void smp4d_cross_call_irq(void) | |||
365 | void smp4d_percpu_timer_interrupt(struct pt_regs *regs) | 365 | void smp4d_percpu_timer_interrupt(struct pt_regs *regs) |
366 | { | 366 | { |
367 | struct pt_regs *old_regs; | 367 | struct pt_regs *old_regs; |
368 | int cpu = hard_smp4d_processor_id(); | 368 | int cpu = hard_smp_processor_id(); |
369 | struct clock_event_device *ce; | 369 | struct clock_event_device *ce; |
370 | static int cpu_tick[NR_CPUS]; | 370 | static int cpu_tick[NR_CPUS]; |
371 | static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; | 371 | static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; |
@@ -391,24 +391,6 @@ void smp4d_percpu_timer_interrupt(struct pt_regs *regs) | |||
391 | set_irq_regs(old_regs); | 391 | set_irq_regs(old_regs); |
392 | } | 392 | } |
393 | 393 | ||
394 | void __init smp4d_blackbox_id(unsigned *addr) | ||
395 | { | ||
396 | int rd = *addr & 0x3e000000; | ||
397 | |||
398 | addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */ | ||
399 | addr[1] = 0x01000000; /* nop */ | ||
400 | addr[2] = 0x01000000; /* nop */ | ||
401 | } | ||
402 | |||
403 | void __init smp4d_blackbox_current(unsigned *addr) | ||
404 | { | ||
405 | int rd = *addr & 0x3e000000; | ||
406 | |||
407 | addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */ | ||
408 | addr[2] = 0x81282002 | rd | (rd >> 11); /* sll reg, 2, reg */ | ||
409 | addr[4] = 0x01000000; /* nop */ | ||
410 | } | ||
411 | |||
412 | void __init sun4d_init_smp(void) | 394 | void __init sun4d_init_smp(void) |
413 | { | 395 | { |
414 | int i; | 396 | int i; |
@@ -417,10 +399,7 @@ void __init sun4d_init_smp(void) | |||
417 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); | 399 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); |
418 | 400 | ||
419 | /* And set btfixup... */ | 401 | /* And set btfixup... */ |
420 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4d_blackbox_id); | ||
421 | BTFIXUPSET_BLACKBOX(load_current, smp4d_blackbox_current); | ||
422 | BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM); | 402 | BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM); |
423 | BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4d_processor_id, BTFIXUPCALL_NORM); | ||
424 | BTFIXUPSET_CALL(smp_ipi_resched, smp4d_ipi_resched, BTFIXUPCALL_NORM); | 403 | BTFIXUPSET_CALL(smp_ipi_resched, smp4d_ipi_resched, BTFIXUPCALL_NORM); |
425 | BTFIXUPSET_CALL(smp_ipi_single, smp4d_ipi_single, BTFIXUPCALL_NORM); | 404 | BTFIXUPSET_CALL(smp_ipi_single, smp4d_ipi_single, BTFIXUPCALL_NORM); |
426 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4d_ipi_mask_one, BTFIXUPCALL_NORM); | 405 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4d_ipi_mask_one, BTFIXUPCALL_NORM); |