* [PATCH 1/3] arm64: head.S: avoid open-coded adr_l
2017-01-17 16:10 [PATCH 0/3] arm64: {adr,ldr}_l cleanup Mark Rutland
@ 2017-01-17 16:10 ` Mark Rutland
2017-01-17 16:10 ` [PATCH 2/3] arm64: efi-entry.S: " Mark Rutland
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2017-01-17 16:10 UTC (permalink / raw)
To: linux-arm-kernel
Some places in the kernel open-code sequences using ADRP for a symbol
another instruction using a :lo12: relocation for that same symbol.
These sequences are easy to get wrong, and more painful to read than is
necessary. For these reasons, it is preferable to use the
{adr,ldr,str}_l macros for these cases.
This patch makes use of adr_l these in head.S, removing an open-coded
sequence using adrp.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/head.S | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 4b1abac..9eaeceb 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -613,8 +613,7 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems
install_el2_stub:
/* Hypervisor stub */
- adrp x0, __hyp_stub_vectors
- add x0, x0, #:lo12:__hyp_stub_vectors
+ adr_l x0, __hyp_stub_vectors
msr vbar_el2, x0
/* spsr */
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] arm64: efi-entry.S: avoid open-coded adr_l
2017-01-17 16:10 [PATCH 0/3] arm64: {adr,ldr}_l cleanup Mark Rutland
2017-01-17 16:10 ` [PATCH 1/3] arm64: head.S: avoid open-coded adr_l Mark Rutland
@ 2017-01-17 16:10 ` Mark Rutland
2017-01-17 16:10 ` [PATCH 3/3] arm64: entry-ftrace.S: avoid open-coded {adr,ldr}_l Mark Rutland
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2017-01-17 16:10 UTC (permalink / raw)
To: linux-arm-kernel
Some places in the kernel open-code sequences using ADRP for a symbol
another instruction using a :lo12: relocation for that same symbol.
These sequences are easy to get wrong, and more painful to read than is
necessary. For these reasons, it is preferable to use the
{adr,ldr,str}_l macros for these cases.
This patch makes use of these in efi-entry.S, removing open-coded
sequences using adrp.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/efi-entry.S | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
index e88c064..4e6ad35 100644
--- a/arch/arm64/kernel/efi-entry.S
+++ b/arch/arm64/kernel/efi-entry.S
@@ -46,8 +46,7 @@ ENTRY(entry)
* efi_system_table_t *sys_table,
* unsigned long *image_addr) ;
*/
- adrp x8, _text
- add x8, x8, #:lo12:_text
+ adr_l x8, _text
add x2, sp, 16
str x8, [x2]
bl efi_entry
@@ -68,10 +67,8 @@ ENTRY(entry)
/*
* Calculate size of the kernel Image (same for original and copy).
*/
- adrp x1, _text
- add x1, x1, #:lo12:_text
- adrp x2, _edata
- add x2, x2, #:lo12:_edata
+ adr_l x1, _text
+ adr_l x2, _edata
sub x1, x2, x1
/*
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] arm64: entry-ftrace.S: avoid open-coded {adr,ldr}_l
2017-01-17 16:10 [PATCH 0/3] arm64: {adr,ldr}_l cleanup Mark Rutland
2017-01-17 16:10 ` [PATCH 1/3] arm64: head.S: avoid open-coded adr_l Mark Rutland
2017-01-17 16:10 ` [PATCH 2/3] arm64: efi-entry.S: " Mark Rutland
@ 2017-01-17 16:10 ` Mark Rutland
2017-01-17 16:15 ` [PATCH 0/3] arm64: {adr,ldr}_l cleanup Ard Biesheuvel
2017-01-17 17:41 ` Will Deacon
4 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2017-01-17 16:10 UTC (permalink / raw)
To: linux-arm-kernel
Some places in the kernel open-code sequences using ADRP for a symbol
another instruction using a :lo12: relocation for that same symbol.
These sequences are easy to get wrong, and more painful to read than is
necessary. For these reasons, it is preferable to use the
{adr,ldr,str}_l macros for these cases.
This patch makes use of these in entry-ftrace.S, removing open-coded
sequences using adrp. This results in a minor code change, since a
temporary register is not used when generating the address for some
symbols, but this is fine, as the value of the temporary register is not
used elsewhere.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/entry-ftrace.S | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index aef02d2..8f1905b 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -98,8 +98,7 @@
ENTRY(_mcount)
mcount_enter
- adrp x0, ftrace_trace_function
- ldr x2, [x0, #:lo12:ftrace_trace_function]
+ ldr_l x2, ftrace_trace_function
adr x0, ftrace_stub
cmp x0, x2 // if (ftrace_trace_function
b.eq skip_ftrace_call // != ftrace_stub) {
@@ -115,15 +114,12 @@ skip_ftrace_call: // return;
mcount_exit // return;
// }
skip_ftrace_call:
- adrp x1, ftrace_graph_return
- ldr x2, [x1, #:lo12:ftrace_graph_return]
+ ldr_l x2, ftrace_graph_return
cmp x0, x2 // if ((ftrace_graph_return
b.ne ftrace_graph_caller // != ftrace_stub)
- adrp x1, ftrace_graph_entry // || (ftrace_graph_entry
- adrp x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
- ldr x2, [x1, #:lo12:ftrace_graph_entry]
- add x0, x0, #:lo12:ftrace_graph_entry_stub
+ ldr_l x2, ftrace_graph_entry // || (ftrace_graph_entry
+ adr_l x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
cmp x0, x2
b.ne ftrace_graph_caller // ftrace_graph_caller();
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 0/3] arm64: {adr,ldr}_l cleanup
2017-01-17 16:10 [PATCH 0/3] arm64: {adr,ldr}_l cleanup Mark Rutland
` (2 preceding siblings ...)
2017-01-17 16:10 ` [PATCH 3/3] arm64: entry-ftrace.S: avoid open-coded {adr,ldr}_l Mark Rutland
@ 2017-01-17 16:15 ` Ard Biesheuvel
2017-01-17 17:41 ` Will Deacon
4 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-01-17 16:15 UTC (permalink / raw)
To: linux-arm-kernel
On 17 January 2017 at 16:10, Mark Rutland <mark.rutland@arm.com> wrote:
> Hi,
>
> While looking at the way we use adrp, I spotted that there are still a few
> open-coded instances of adr_l and ldr_l.
>
> These patches clean those up, making the code a little easier to follow.
>
For the series:
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Thanks,
> Mark.
>
> Mark Rutland (3):
> arm64: head.S: avoid open-coded adr_l
> arm64: efi-entry.S: avoid open-coded adr_l
> arm64: entry-ftrace.S: avoid open-coded {adr,ldr}_l
>
> arch/arm64/kernel/efi-entry.S | 9 +++------
> arch/arm64/kernel/entry-ftrace.S | 12 ++++--------
> arch/arm64/kernel/head.S | 3 +--
> 3 files changed, 8 insertions(+), 16 deletions(-)
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 0/3] arm64: {adr,ldr}_l cleanup
2017-01-17 16:10 [PATCH 0/3] arm64: {adr,ldr}_l cleanup Mark Rutland
` (3 preceding siblings ...)
2017-01-17 16:15 ` [PATCH 0/3] arm64: {adr,ldr}_l cleanup Ard Biesheuvel
@ 2017-01-17 17:41 ` Will Deacon
4 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2017-01-17 17:41 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 17, 2017 at 04:10:55PM +0000, Mark Rutland wrote:
> While looking at the way we use adrp, I spotted that there are still a few
> open-coded instances of adr_l and ldr_l.
>
> These patches clean those up, making the code a little easier to follow.
Thanks, queued for 4.11.
Will
^ permalink raw reply [flat|nested] 6+ messages in thread