diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-06-30 11:29:12 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-07-18 07:29:04 -0400 |
commit | 6ebbf2ce437b33022d30badd49dc94d33ecfa498 (patch) | |
tree | bc015e35b456a28bb0e501803a454dc0c0d3291a /arch/arm/mm/cache-nop.S | |
parent | af040ffc9ba1e079ee4c0748aff64fa3d4716fa5 (diff) |
ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+
ARMv6 and greater introduced a new instruction ("bx") which can be used
to return from function calls. Recent CPUs perform better when the
"bx lr" instruction is used rather than the "mov pc, lr" instruction,
and this sequence is strongly recommended to be used by the ARM
architecture manual (section A.4.1.1).
We provide a new macro "ret" with all its variants for the condition
code which will resolve to the appropriate instruction.
Rather than doing this piecemeal, and miss some instances, change all
the "mov pc" instances to use the new macro, with the exception of
the "movs" instruction and the kprobes code. This allows us to detect
the "mov pc, lr" case and fix it up - and also gives us the possibility
of deploying this for other registers depending on the CPU selection.
Reported-by: Will Deacon <will.deacon@arm.com>
Tested-by: Stephen Warren <swarren@nvidia.com> # Tegra Jetson TK1
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr> # mioa701_bootresume.S
Tested-by: Andrew Lunn <andrew@lunn.ch> # Kirkwood
Tested-by: Shawn Guo <shawn.guo@freescale.com>
Tested-by: Tony Lindgren <tony@atomide.com> # OMAPs
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> # Armada XP, 375, 385
Acked-by: Sekhar Nori <nsekhar@ti.com> # DaVinci
Acked-by: Christoffer Dall <christoffer.dall@linaro.org> # kvm/hyp
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> # PXA3xx
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> # Xen
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> # ARMv7M
Tested-by: Simon Horman <horms+renesas@verge.net.au> # Shmobile
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/cache-nop.S')
-rw-r--r-- | arch/arm/mm/cache-nop.S | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/mm/cache-nop.S b/arch/arm/mm/cache-nop.S index 8e12ddca0031..f1cc9861031f 100644 --- a/arch/arm/mm/cache-nop.S +++ b/arch/arm/mm/cache-nop.S | |||
@@ -5,11 +5,12 @@ | |||
5 | */ | 5 | */ |
6 | #include <linux/linkage.h> | 6 | #include <linux/linkage.h> |
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <asm/assembler.h> | ||
8 | 9 | ||
9 | #include "proc-macros.S" | 10 | #include "proc-macros.S" |
10 | 11 | ||
11 | ENTRY(nop_flush_icache_all) | 12 | ENTRY(nop_flush_icache_all) |
12 | mov pc, lr | 13 | ret lr |
13 | ENDPROC(nop_flush_icache_all) | 14 | ENDPROC(nop_flush_icache_all) |
14 | 15 | ||
15 | .globl nop_flush_kern_cache_all | 16 | .globl nop_flush_kern_cache_all |
@@ -29,7 +30,7 @@ ENDPROC(nop_flush_icache_all) | |||
29 | 30 | ||
30 | ENTRY(nop_coherent_user_range) | 31 | ENTRY(nop_coherent_user_range) |
31 | mov r0, 0 | 32 | mov r0, 0 |
32 | mov pc, lr | 33 | ret lr |
33 | ENDPROC(nop_coherent_user_range) | 34 | ENDPROC(nop_coherent_user_range) |
34 | 35 | ||
35 | .globl nop_flush_kern_dcache_area | 36 | .globl nop_flush_kern_dcache_area |