Thread (12 messages) flat view 12 messages, 3 authors, 2021-08-25

Re: [boot-wrapper PATCH 2/5] aarch32: simplify _switch_monitor

From: Andre Przywara <andre.przywara@arm.com>
Date: 2021-08-24 16:51:51

On 8/24/21 2:48 PM, Mark Rutland wrote:
If we're lucky enough to have been booted into secure PL1, we can switch
to monitor mode with an exception return rather than an SMC call, which
avoids the need for boot-time vectors.

Note that while all Secure PL1 register state is accessible in Secure
SVC mode, we must switch to Monitor mode before we set SCR.NS=1.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
I don't know much about the subtle differences between smc, movs pc and 
eret, but from what I read this is indeed an easier way to get to MON.

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

Cheers,
Andre
quoted hunk ↗ jump to hunk
---
  arch/aarch32/boot.S | 19 ++++---------------
  1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/arch/aarch32/boot.S b/arch/aarch32/boot.S
index 82927de..e397cb0 100644
--- a/arch/aarch32/boot.S
+++ b/arch/aarch32/boot.S
@@ -37,9 +37,10 @@ ASM_FUNC(_start)
  	b	start_no_el3
  
  _switch_monitor:
-	ldr	r0, =boot_vectors
-	bl	setup_vector
-	smc	#0
+	adr	lr, _monitor
+	ldr	r0, =(PSR_A | PSR_I | PSR_F | PSR_MON)
+	msr	spsr, r0
+	movs	pc, lr
  
  _monitor:
  	/* Move the stack to Monitor mode*/
@@ -102,18 +103,6 @@ ASM_FUNC(jump_kernel)
  	msr	spsr_cxf, r4
  	movs	pc, lr
  
-	.section .vectors
-	.align 6
-boot_vectors:
-	b	.
-	b	.
-	b	_monitor
-	b	.
-	b	.
-	b	.
-	b	.
-	b	.
-
  	.section .data
  	.align 2
  flag_no_el3:

_______________________________________________
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