blob: db81355b66c9ef0b430737c9d5b8f00d6bdcfc65 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From ce628de7699dd6401ddf713efaa49872e2733619 Mon Sep 17 00:00:00 2001
2From: Jaxson Han <jaxson.han@arm.com>
3Date: Tue, 25 May 2021 07:25:00 +0100
4Subject: [PATCH] aarch64: Prepare for lower EL booting
5
6Save SPSR_KERNEL into spsr_to_elx during el3_init.
7The jump_kernel will load spsr_to_elx into spsr_el3.
8
9This change will make it easier to control whether drop to lower EL
10before jumping to the kernel.
11
12Upstream-Status: Pending
13Signed-off-by: Jaxson Han <jaxson.han@arm.com>
14Reviewed-by: Andre Przywara <andre.przywara@arm.com>
15---
16 arch/aarch64/boot.S | 15 +++++++++++++--
17 1 file changed, 13 insertions(+), 2 deletions(-)
18
19diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S
20index b589744..6b45afc 100644
21--- a/arch/aarch64/boot.S
22+++ b/arch/aarch64/boot.S
23@@ -130,7 +130,16 @@ el3_init:
24 mov x0, #ZCR_EL3_LEN_MASK // SVE: Enable full vector len
25 msr ZCR_EL3, x0 // for EL2.
26
27-1:
28+ /*
29+ * Save SPSR_KERNEL into spsr_to_elx.
30+ * The jump_kernel will load spsr_to_elx into spsr_el3
31+ */
32+1: mov w0, #SPSR_KERNEL
33+ ldr x1, =spsr_to_elx
34+ str w0, [x1]
35+ b el_max_init
36+
37+el_max_init:
38 ldr x0, =COUNTER_FREQ
39 msr cntfrq_el0, x0
40
41@@ -178,7 +187,7 @@ ASM_FUNC(jump_kernel)
42 b.eq 1f
43 br x19 // Keep current EL
44
45-1: mov x4, #SPSR_KERNEL
46+1: ldr w4, spsr_to_elx
47
48 /*
49 * If bit 0 of the kernel address is set, we're entering in AArch32
50@@ -196,3 +205,5 @@ ASM_FUNC(jump_kernel)
51 .align 3
52 flag_keep_el:
53 .long 0
54+spsr_to_elx:
55+ .long 0