Skip to content

Commit d739da1

Browse files
author
James Morse
committed
arm64: entry: Make the trampoline cleanup optional
Subsequent patches will add additional sets of vectors that use the same tricks as the kpti vectors to reach the full-fat vectors. The full-fat vectors contain some cleanup for kpti that is patched in by alternatives when kpti is in use. Once there are additional vectors, the cleanup will be needed in more cases. But on big/little systems, the cleanup would be harmful if no trampoline vector were in use. Instead of forcing CPUs that don't need a trampoline vector to use one, make the trampoline cleanup optional. Entry at the top of the vectors will skip the cleanup. The trampoline vectors can then skip the first instruction, triggering the cleanup to run. Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: James Morse <james.morse@arm.com>
1 parent 5bdf343 commit d739da1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

arch/arm64/kernel/entry.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@
4040
.Lventry_start\@:
4141
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
4242
.if \el == 0
43-
alternative_if ARM64_UNMAP_KERNEL_AT_EL0
43+
/*
44+
* This must be the first instruction of the EL0 vector entries. It is
45+
* skipped by the trampoline vectors, to trigger the cleanup.
46+
*/
47+
b .Lskip_tramp_vectors_cleanup\@
4448
.if \regsize == 64
4549
mrs x30, tpidrro_el0
4650
msr tpidrro_el0, xzr
4751
.else
4852
mov x30, xzr
4953
.endif
50-
alternative_else_nop_endif
54+
.Lskip_tramp_vectors_cleanup\@:
5155
.endif
5256
#endif
5357

@@ -661,7 +665,7 @@ alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
661665
prfm plil1strm, [x30, #(1b - tramp_vectors)]
662666
alternative_else_nop_endif
663667
msr vbar_el1, x30
664-
add x30, x30, #(1b - tramp_vectors)
668+
add x30, x30, #(1b - tramp_vectors + 4)
665669
isb
666670
ret
667671
.org 1b + 128 // Did we overflow the ventry slot?

0 commit comments

Comments
 (0)