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/mach-mvebu | |
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/mach-mvebu')
-rw-r--r-- | arch/arm/mach-mvebu/coherency_ll.S | 10 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/headsmp-a9.S | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S index 510c29e079ca..f5d881b5d0f7 100644 --- a/arch/arm/mach-mvebu/coherency_ll.S +++ b/arch/arm/mach-mvebu/coherency_ll.S | |||
@@ -46,7 +46,7 @@ ENTRY(ll_get_coherency_base) | |||
46 | ldr r1, =coherency_base | 46 | ldr r1, =coherency_base |
47 | ldr r1, [r1] | 47 | ldr r1, [r1] |
48 | 2: | 48 | 2: |
49 | mov pc, lr | 49 | ret lr |
50 | ENDPROC(ll_get_coherency_base) | 50 | ENDPROC(ll_get_coherency_base) |
51 | 51 | ||
52 | /* | 52 | /* |
@@ -63,7 +63,7 @@ ENTRY(ll_get_coherency_cpumask) | |||
63 | mov r2, #(1 << 24) | 63 | mov r2, #(1 << 24) |
64 | lsl r3, r2, r3 | 64 | lsl r3, r2, r3 |
65 | ARM_BE8(rev r3, r3) | 65 | ARM_BE8(rev r3, r3) |
66 | mov pc, lr | 66 | ret lr |
67 | ENDPROC(ll_get_coherency_cpumask) | 67 | ENDPROC(ll_get_coherency_cpumask) |
68 | 68 | ||
69 | /* | 69 | /* |
@@ -94,7 +94,7 @@ ENTRY(ll_add_cpu_to_smp_group) | |||
94 | strex r1, r2, [r0] | 94 | strex r1, r2, [r0] |
95 | cmp r1, #0 | 95 | cmp r1, #0 |
96 | bne 1b | 96 | bne 1b |
97 | mov pc, lr | 97 | ret lr |
98 | ENDPROC(ll_add_cpu_to_smp_group) | 98 | ENDPROC(ll_add_cpu_to_smp_group) |
99 | 99 | ||
100 | ENTRY(ll_enable_coherency) | 100 | ENTRY(ll_enable_coherency) |
@@ -118,7 +118,7 @@ ENTRY(ll_enable_coherency) | |||
118 | bne 1b | 118 | bne 1b |
119 | dsb | 119 | dsb |
120 | mov r0, #0 | 120 | mov r0, #0 |
121 | mov pc, lr | 121 | ret lr |
122 | ENDPROC(ll_enable_coherency) | 122 | ENDPROC(ll_enable_coherency) |
123 | 123 | ||
124 | ENTRY(ll_disable_coherency) | 124 | ENTRY(ll_disable_coherency) |
@@ -141,7 +141,7 @@ ENTRY(ll_disable_coherency) | |||
141 | cmp r1, #0 | 141 | cmp r1, #0 |
142 | bne 1b | 142 | bne 1b |
143 | dsb | 143 | dsb |
144 | mov pc, lr | 144 | ret lr |
145 | ENDPROC(ll_disable_coherency) | 145 | ENDPROC(ll_disable_coherency) |
146 | 146 | ||
147 | .align 2 | 147 | .align 2 |
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S index 5925366bc03c..7c91ddb6f1f7 100644 --- a/arch/arm/mach-mvebu/headsmp-a9.S +++ b/arch/arm/mach-mvebu/headsmp-a9.S | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <asm/assembler.h> | ||
17 | 18 | ||
18 | __CPUINIT | 19 | __CPUINIT |
19 | #define CPU_RESUME_ADDR_REG 0xf10182d4 | 20 | #define CPU_RESUME_ADDR_REG 0xf10182d4 |
@@ -24,7 +25,7 @@ | |||
24 | armada_375_smp_cpu1_enable_code_start: | 25 | armada_375_smp_cpu1_enable_code_start: |
25 | ldr r0, [pc, #4] | 26 | ldr r0, [pc, #4] |
26 | ldr r1, [r0] | 27 | ldr r1, [r0] |
27 | mov pc, r1 | 28 | ret r1 |
28 | .word CPU_RESUME_ADDR_REG | 29 | .word CPU_RESUME_ADDR_REG |
29 | armada_375_smp_cpu1_enable_code_end: | 30 | armada_375_smp_cpu1_enable_code_end: |
30 | 31 | ||