summaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/setup_64.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-08-02 20:23:34 -0700
committerDavid S. Miller <davem@davemloft.net>2011-08-02 21:28:53 -0700
commit56d205cc5c0a3032a605121d4253e111193bf923 (patch)
tree1e37a74fd6df18ec35a9d6a1f70eca2e649e4afb /arch/sparc/kernel/setup_64.c
parentea5e7447ea9d555558e0f13798f5143dd51a915a (diff)
sparc: Use popc when possible for ffs/__ffs/ffz.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/setup_64.c')
-rw-r--r--arch/sparc/kernel/setup_64.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 26d114187e1..3e9daea1653 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -275,24 +275,34 @@ void __init sun4v_patch(void)
static void __init popc_patch(void)
{
struct popc_3insn_patch_entry *p3;
+ struct popc_6insn_patch_entry *p6;
p3 = &__popc_3insn_patch;
while (p3 < &__popc_3insn_patch_end) {
- unsigned long addr = p3->addr;
+ unsigned long i, addr = p3->addr;
- *(unsigned int *) (addr + 0) = p3->insns[0];
- wmb();
- __asm__ __volatile__("flush %0" : : "r" (addr + 0));
+ for (i = 0; i < 3; i++) {
+ *(unsigned int *) (addr + (i * 4)) = p3->insns[i];
+ wmb();
+ __asm__ __volatile__("flush %0"
+ : : "r" (addr + (i * 4)));
+ }
- *(unsigned int *) (addr + 4) = p3->insns[1];
- wmb();
- __asm__ __volatile__("flush %0" : : "r" (addr + 4));
+ p3++;
+ }
- *(unsigned int *) (addr + 8) = p3->insns[2];
- wmb();
- __asm__ __volatile__("flush %0" : : "r" (addr + 4));
+ p6 = &__popc_6insn_patch;
+ while (p6 < &__popc_6insn_patch_end) {
+ unsigned long i, addr = p6->addr;
- p3++;
+ for (i = 0; i < 6; i++) {
+ *(unsigned int *) (addr + (i * 4)) = p6->insns[i];
+ wmb();
+ __asm__ __volatile__("flush %0"
+ : : "r" (addr + (i * 4)));
+ }
+
+ p6++;
}
}