Skip to content

Commit 5371513

Browse files
Marc Zyngierctmarinas
authored andcommitted
arm64: Make sure SPsel is always set
When the kernel is entered at EL2 on an ARMv8.0 system, we construct the EL1 pstate and make sure this uses the the EL1 stack pointer (we perform an exception return to EL1h). But if the kernel is either entered at EL1 or stays at EL2 (because we're on a VHE-capable system), we fail to set SPsel, and use whatever stack selection the higher exception level has choosen for us. Let's not take any chance, and make sure that SPsel is set to one before we decide the mode we're going to run in. Cc: <[email protected]> Acked-by: Mark Rutland <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent e19b205 commit 5371513

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/arm64/kernel/head.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ ENTRY(kimage_vaddr)
384384
* booted in EL1 or EL2 respectively.
385385
*/
386386
ENTRY(el2_setup)
387+
msr SPsel, #1 // We want to use SP_EL{1,2}
387388
mrs x0, CurrentEL
388389
cmp x0, #CurrentEL_EL2
389390
b.eq 1f

0 commit comments

Comments
 (0)