linux/arch/powerpc
Kevin Hao 4db7327194 powerpc: Add option to use jump label for cpu_has_feature()
We do binary patching of asm code using CPU features, which is a
one-time operation, done during early boot. However checks of CPU
features in C code are currently done at run time, even though the set
of CPU features can never change after boot.

We can optimise this by using jump labels to implement cpu_has_feature(),
meaning checks in C code are binary patched into a single nop or branch.

For a C sequence along the lines of:

    if (cpu_has_feature(FOO))
         return 2;

The generated code before is roughly:

    ld      r9,-27640(r2)
    ld      r9,0(r9)
    lwz     r9,32(r9)
    cmpwi   cr7,r9,0
    bge     cr7, 1f
    li      r3,2
    blr
1:  ...

After (true):
    nop
    li      r3,2
    blr

After (false):
    b	1f
    li      r3,2
    blr
1:  ...

mpe: Rename MAX_CPU_FEATURES as we already have a #define with that
name, and define it simply as a constant, rather than doing tricks with
sizeof and NULL pointers. Rename the array to cpu_feature_keys. Use the
kconfig we added to guard it. Add BUILD_BUG_ON() if the feature is not a
compile time constant. Rewrite the change log.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-08-01 11:15:05 +10:00
..
boot powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
configs powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
crypto crypto: powerpc - Add POWER8 optimised crc32c 2016-07-05 23:05:19 +08:00
include powerpc: Add option to use jump label for cpu_has_feature() 2016-08-01 11:15:05 +10:00
kernel powerpc: Add option to use jump label for cpu_has_feature() 2016-08-01 11:15:05 +10:00
kvm powerpc/mm: Move hash table ops to a separate structure 2016-07-21 18:59:09 +10:00
lib powerpc: Add option to use jump label for cpu_has_feature() 2016-08-01 11:15:05 +10:00
math-emu
mm powerpc/mm: Convert early cpu/mmu feature check to use the new helpers 2016-08-01 11:15:01 +10:00
net powerpc/ebpf/jit: Implement JIT compiler for extended BPF 2016-06-24 15:17:57 +10:00
oprofile powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
perf powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
platforms powerpc: Move cpu_has_feature() to a separate file 2016-08-01 11:15:03 +10:00
scripts powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel 2016-03-07 14:53:56 +11:00
sysdev powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
xmon powerpc: Move cpu_has_feature() to a separate file 2016-08-01 11:15:03 +10:00
Kconfig powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
Kconfig.debug powerpc: Add kconfig option to use jump labels for cpu/mmu_has_feature() 2016-08-01 11:15:04 +10:00
Makefile powerpc/sparse: Pass endianness to sparse 2016-07-14 20:44:03 +10:00
relocs_check.sh powerpc: Convert relocs_check to a shell script using grep 2015-03-23 14:47:39 +11:00