diff mbox series

[boot-wrapper,v3,4/8] aarch64: Prepare for EL1 booting

Message ID 20210525062509.201464-5-jaxson.han@arm.com (mailing list archive)
State New, archived
Headers show
Series Add Armv8-R AArch64 support | expand

Commit Message

Jaxson Han May 25, 2021, 6:25 a.m. UTC
When booting from EL1, add a check and skip the init of
sctlr_el2 in jump_kernel

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/aarch64/boot.S            | 6 +++++-
 arch/aarch64/include/asm/cpu.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S
index 1cdeb1b..8a0219b 100644
--- a/arch/aarch64/boot.S
+++ b/arch/aarch64/boot.S
@@ -144,10 +144,14 @@  jump_kernel:
 	ldr	x0, =SCTLR_EL1_RESET
 	msr	sctlr_el1, x0
 
+	mrs	x0, CurrentEL
+	cmp	x0, #CURRENTEL_EL2
+	b.lt	1f
+
 	ldr	x0, =SCTLR_EL2_RESET
 	msr	sctlr_el2, x0
 
-	cpuid	x0, x1
+1:	cpuid	x0, x1
 	bl	find_logical_id
 	bl	setup_stack		// Reset stack pointer
 
diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h
index ccb5397..3c1ba4b 100644
--- a/arch/aarch64/include/asm/cpu.h
+++ b/arch/aarch64/include/asm/cpu.h
@@ -11,6 +11,7 @@ 
 
 #define MPIDR_ID_BITS		0xff00ffffff
 
+#define CURRENTEL_EL2		(2 << 2)
 #define CURRENTEL_EL3		(3 << 2)
 
 /*