All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: alexandru.elisei@arm.com, andre.przywara@arm.com,
	mark.rutland@arm.com, maz@kernel.org
Subject: [boot-wrapper PATCH 2/5] aarch32: simplify _switch_monitor
Date: Tue, 24 Aug 2021 14:48:57 +0100	[thread overview]
Message-ID: <20210824134900.34849-3-mark.rutland@arm.com> (raw)
In-Reply-To: <20210824134900.34849-1-mark.rutland@arm.com>

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>
---
 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:
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-08-24 13:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 13:48 [boot-wrapper PATCH 0/5] Misc cleanups Mark Rutland
2021-08-24 13:48 ` [boot-wrapper PATCH 1/5] Remove unused Set/Way cache helpers Mark Rutland
2021-08-24 16:49   ` Andre Przywara
2021-08-24 13:48 ` Mark Rutland [this message]
2021-08-24 16:50   ` [boot-wrapper PATCH 2/5] aarch32: simplify _switch_monitor Andre Przywara
2021-08-24 13:48 ` [boot-wrapper PATCH 3/5] GICv3: initialize without RMW Mark Rutland
2021-08-24 16:50   ` Andre Przywara
2021-08-24 13:48 ` [boot-wrapper PATCH 4/5] Rename kernel *_RESET values to *_KERNEL Mark Rutland
2021-08-24 16:50   ` Andre Przywara
2021-08-24 13:49 ` [boot-wrapper PATCH 5/5] Rename `CNTFRQ` -> `COUNTER_FREQ` Mark Rutland
2021-08-24 16:51   ` Andre Przywara
2021-08-25  9:46 ` [boot-wrapper PATCH 0/5] Misc cleanups Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824134900.34849-3-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.