Skip to content

Commit

Permalink
ARM: 9194/1: assembler: simplify ldr_this_cpu for !SMP builds
Browse files Browse the repository at this point in the history
When CONFIG_SMP is not defined, the CPU offset is always zero, and so
we can simplify the sequence to load a per-CPU variable.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
  • Loading branch information
Ard Biesheuvel authored and Russell King (Oracle) committed May 20, 2022
1 parent 7719a68 commit 952f033
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions arch/arm/include/asm/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,12 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
/*
* ldr_va - load a 32-bit word from the virtual address of \sym
*/
.macro ldr_va, rd:req, sym:req, cond
.macro ldr_va, rd:req, sym:req, cond, tmp
.ifnb \tmp
__ldst_va ldr, \rd, \tmp, \sym, \cond
.else
__ldst_va ldr, \rd, \rd, \sym, \cond
.endif
.endm

/*
Expand Down Expand Up @@ -727,9 +731,11 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
* are permitted to overlap with 'rd' if != sp
*/
.macro ldr_this_cpu, rd:req, sym:req, t1:req, t2:req
#if __LINUX_ARM_ARCH__ >= 7 || \
!defined(CONFIG_ARM_HAS_GROUP_RELOCS) || \
(defined(MODULE) && defined(CONFIG_ARM_MODULE_PLTS))
#ifndef CONFIG_SMP
ldr_va \rd, \sym, tmp=\t1
#elif __LINUX_ARM_ARCH__ >= 7 || \
!defined(CONFIG_ARM_HAS_GROUP_RELOCS) || \
(defined(MODULE) && defined(CONFIG_ARM_MODULE_PLTS))
this_cpu_offset \t1
mov_l \t2, \sym
ldr \rd, [\t1, \t2]
Expand Down

0 comments on commit 952f033

Please sign in to comment.