sparc64: Use pause instruction when available.
In atomic backoff and cpu_relax(), use the pause instruction found on SPARC-T4 and later. It makes the cpu strand unselectable for the given number of cycles, unless an intervening disrupting trap occurs. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -316,6 +316,25 @@ static void __init popc_patch(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init pause_patch(void)
|
||||
{
|
||||
struct pause_patch_entry *p;
|
||||
|
||||
p = &__pause_patch;
|
||||
while (p < &__pause_patch_end) {
|
||||
unsigned long i, addr = p->addr;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
*(unsigned int *) (addr + (i * 4)) = p->insns[i];
|
||||
wmb();
|
||||
__asm__ __volatile__("flush %0"
|
||||
: : "r" (addr + (i * 4)));
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void __init boot_cpu_id_too_large(int cpu)
|
||||
{
|
||||
@@ -528,6 +547,8 @@ static void __init init_sparc64_elf_hwcap(void)
|
||||
|
||||
if (sparc64_elf_hwcap & AV_SPARC_POPC)
|
||||
popc_patch();
|
||||
if (sparc64_elf_hwcap & AV_SPARC_PAUSE)
|
||||
pause_patch();
|
||||
}
|
||||
|
||||
void __init setup_arch(char **cmdline_p)
|
||||
|
Reference in New Issue
Block a user