Thread (18 messages) flat view 18 messages, 2 authors, 2021-05-25

Re: [boot-wrapper PATCH v2 5/8] aarch64: Prepare for lower EL booting

From: Andre Przywara <andre.przywara@arm.com>
Date: 2021-05-24 17:22:49

On Fri, 21 May 2021 18:48:04 +0800
Jaxson Han [off-list ref] wrote:

Hi,
Save SPSR_KERNEL into spsr_to_elx during el3_init.
The jump_kernel will load spsr_to_elx into spsr_el3.

This change will make it easier to control whether drop to lower EL
before jumping to the kernel.
Looks good, but this needs some adaption after fixing patch 2/8:
quoted hunk ↗ jump to hunk
Signed-off-by: Jaxson Han <redacted>
---
 arch/aarch64/boot.S | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S
index b8f9e4e..5600859 100644
--- a/arch/aarch64/boot.S
+++ b/arch/aarch64/boot.S
@@ -118,7 +118,16 @@ el3_init:
 	mov	x0, #ZCR_EL3_LEN_MASK		// SVE: Enable full vector len
 	msr	ZCR_EL3, x0			// for EL2.
 
-1:
+	/*
+	 * Save SPSR_KERNEL into spsr_to_elx.
+	 * The jump_kernel will load spsr_to_elx into spsr_el3
+	 */
+1:	mov	w0, #SPSR_KERNEL
+	ldr	x1, =spsr_to_elx
+	str	w0, [x1]
+	b	el_max_init
+
+el_max_init:
 	ldr	x0, =CNTFRQ
 	msr	cntfrq_el0, x0
 
@@ -166,7 +175,7 @@ jump_kernel:
 	b.eq	1f
 	br	x19			// Keep current EL
 
-1:	ldr	w4, #SPSR_KERNEL
+1:	ldr	w4, spsr_to_elx
This would be the place where you change the original "mov x4,
#SPSR_KERNEL" line into this one here (and not in patch 2).

With that fixed:

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre
quoted hunk ↗ jump to hunk
 
 	/*
 	 * If bit 0 of the kernel address is set, we're entering in AArch32
@@ -184,3 +193,5 @@ jump_kernel:
 	.align 3
 flag_keep_el:
 	.long 0
+spsr_to_elx:
+	.long 0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help