Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: assembler: add set_this_cpu_offset

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210520115031.18509-3-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Mark Rutland and committed by
Will Deacon
e176e267 50355532

+15 -15
+13 -5
arch/arm64/include/asm/assembler.h
··· 232 232 * @dst: destination register 233 233 */ 234 234 #if defined(__KVM_NVHE_HYPERVISOR__) || defined(__KVM_VHE_HYPERVISOR__) 235 - .macro this_cpu_offset, dst 235 + .macro get_this_cpu_offset, dst 236 236 mrs \dst, tpidr_el2 237 237 .endm 238 238 #else 239 - .macro this_cpu_offset, dst 239 + .macro get_this_cpu_offset, dst 240 240 alternative_if_not ARM64_HAS_VIRT_HOST_EXTN 241 241 mrs \dst, tpidr_el1 242 242 alternative_else 243 243 mrs \dst, tpidr_el2 244 + alternative_endif 245 + .endm 246 + 247 + .macro set_this_cpu_offset, src 248 + alternative_if_not ARM64_HAS_VIRT_HOST_EXTN 249 + msr tpidr_el1, \src 250 + alternative_else 251 + msr tpidr_el2, \src 244 252 alternative_endif 245 253 .endm 246 254 #endif ··· 261 253 .macro adr_this_cpu, dst, sym, tmp 262 254 adrp \tmp, \sym 263 255 add \dst, \tmp, #:lo12:\sym 264 - this_cpu_offset \tmp 256 + get_this_cpu_offset \tmp 265 257 add \dst, \dst, \tmp 266 258 .endm 267 259 ··· 272 264 */ 273 265 .macro ldr_this_cpu dst, sym, tmp 274 266 adr_l \dst, \sym 275 - this_cpu_offset \tmp 267 + get_this_cpu_offset \tmp 276 268 ldr \dst, [\dst, \tmp] 277 269 .endm 278 270 ··· 753 745 cbz \tmp, \lbl 754 746 #endif 755 747 adr_l \tmp, irq_stat + IRQ_CPUSTAT_SOFTIRQ_PENDING 756 - this_cpu_offset \tmp2 748 + get_this_cpu_offset \tmp2 757 749 ldr w\tmp, [\tmp, \tmp2] 758 750 cbnz w\tmp, \lbl // yield on pending softirq in task context 759 751 .Lnoyield_\@:
+2 -10
arch/arm64/mm/proc.S
··· 83 83 mrs x9, mdscr_el1 84 84 mrs x10, oslsr_el1 85 85 mrs x11, sctlr_el1 86 - alternative_if_not ARM64_HAS_VIRT_HOST_EXTN 87 - mrs x12, tpidr_el1 88 - alternative_else 89 - mrs x12, tpidr_el2 90 - alternative_endif 86 + get_this_cpu_offset x12 91 87 mrs x13, sp_el0 92 88 stp x2, x3, [x0] 93 89 stp x4, x5, [x0, #16] ··· 141 145 msr mdscr_el1, x10 142 146 143 147 msr sctlr_el1, x12 144 - alternative_if_not ARM64_HAS_VIRT_HOST_EXTN 145 - msr tpidr_el1, x13 146 - alternative_else 147 - msr tpidr_el2, x13 148 - alternative_endif 148 + set_this_cpu_offset x13 149 149 msr sp_el0, x14 150 150 /* 151 151 * Restore oslsr_el1 by writing oslar_el1