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: andre.przywara@arm.com, Jaxson.Han@arm.com, mark.rutland@arm.com,
	Wei.Chen@arm.com
Subject: [bootwrapper PATCH 01/13] Document entry requirements
Date: Tue, 11 Jan 2022 13:06:41 +0000	[thread overview]
Message-ID: <20220111130653.2331827-2-mark.rutland@arm.com> (raw)
In-Reply-To: <20220111130653.2331827-1-mark.rutland@arm.com>

Currently the boot-wrapper only supports some combinations of exception
levels, with other combinations not being supported.

While we generally expect the boot-wrapper to be entered at the highest
implemented exception level, the AArch32 boot-wrapper has a comment
implying it supports being entered with something else owning EL3. As
this would require such EL3 firmware to always be in sync with the
boot-wrapper's requirements, which change over time, we don't actually
support such a configuration.

Some CPU state (such as CNTFRQ/CNTFRQ_EL0) needs to be initialized at
the highest implemented exception level, but today the boot-wrapper only
does so when entered at EL3 / Secure-PL1. Thus, today the only
completely supported configurations are EL3 / Secure-PL1, and entering
in other configurations is not entirely supported.

The aarch64 `jump_kernel` function always writes to SCTLR_EL2, which is
UNDEFINED at EL1. Hence, the aarch64 boot-wrapper does not support being
entered at EL1.

The aarch32 code assumes that any non-hyp mode is Secure PL1, and
attempt to switch to monitor mode. If entered on a system without the
security extensions, where the highest privileged mode is Non-secure
PL1, this will not work. Hence the aarch32 boot-wrapper does not support
being entered at Non-secure PL1.

Actually supporting all of these configurations requires restructuring
much of the boot-wrapper. For now, document the supported configurations
in each architecture's boot.S, and remove the misleading comment from
arch/aarch32/boot.S. Subsequent patches will improve the support and add
support for additional configurations.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
---
 arch/aarch32/boot.S | 14 ++++++++++++++
 arch/aarch32/psci.S |  5 -----
 arch/aarch64/boot.S | 13 +++++++++++++
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/arch/aarch32/boot.S b/arch/aarch32/boot.S
index 4add338..00c432d 100644
--- a/arch/aarch32/boot.S
+++ b/arch/aarch32/boot.S
@@ -16,6 +16,20 @@
 	.arch_extension virt
 
 	.section .init
+
+	/*
+	 * The boot-wrapper must be entered from the reset vector at the
+	 * highest implemented exception level. The boot-wrapper only supports
+	 * being entered in the following modes:
+	 *
+	 * - PL1 / EL3 (Secure) Supervisor mode
+	 *   Entering in this mode is strongly recommended.
+	 *   PL2 must be implemented.
+	 *
+	 * - PL2 / EL2 (Non-secure) Hypervisor mode
+	 *   Entering in this mode is partially supported.
+	 *   PSCI is not supported when entered in this mode.
+	 */
 ASM_FUNC(_start)
 	/* Stack initialisation */
 	cpuid	r0, r1
diff --git a/arch/aarch32/psci.S b/arch/aarch32/psci.S
index dc7aeb7..e0d2972 100644
--- a/arch/aarch32/psci.S
+++ b/arch/aarch32/psci.S
@@ -44,11 +44,6 @@ ASM_FUNC(start_el3)
 	/* pass through */
 
 ASM_FUNC(start_no_el3)
-	/*
-	 * For no-el3, we assume that firmware launched the boot-wrapper in
-	 * non-secure EL2 or EL1. We assume it has its own PSCI implementation
-	 * sitting at EL3, and that this path is only taken by primary CPU.
-	 */
 	cpuid	r0, r1
 	blx	find_logical_id
 	b	psci_first_spin
diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S
index 27ba449..900b9f8 100644
--- a/arch/aarch64/boot.S
+++ b/arch/aarch64/boot.S
@@ -12,6 +12,19 @@
 
 	.section .init
 
+	/*
+	 * The boot-wrapper must be entered from the reset vector at the
+	 * highest implemented exception level. The boot-wrapper only supports
+	 * being entered at the following exception levels:
+	 *
+	 * - EL3 (Secure)
+	 *   Entering at EL3 is strongly recommended.
+	 *   EL2 must be implemented.
+	 *
+	 * - EL2 (Non-secure)
+	 *   Entering at EL2 is partially supported.
+	 *   PSCI is not supported when entered in this exception level.
+	 */
 ASM_FUNC(_start)
 	cpuid	x0, x1
 	bl	find_logical_id
-- 
2.30.2


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

  reply	other threads:[~2022-01-11 13:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 13:06 [bootwrapper PATCH 00/13] Cleanups and improvements Mark Rutland
2022-01-11 13:06 ` Mark Rutland [this message]
2022-01-11 13:06 ` [bootwrapper PATCH 02/13] Add bit-field macros Mark Rutland
2022-01-11 14:40   ` Andre Przywara
2022-01-12 14:16     ` Mark Rutland
2022-01-14 18:13       ` Andre Przywara
2022-01-11 13:06 ` [bootwrapper PATCH 03/13] aarch64: add system register accessors Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 04/13] aarch32: add coprocessor accessors Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 05/13] aarch64: add mov_64 macro Mark Rutland
2022-01-11 14:41   ` Andre Przywara
2022-01-12 14:18     ` Mark Rutland
2022-01-14 15:37       ` Andre Przywara
2022-01-11 13:06 ` [bootwrapper PATCH 06/13] aarch64: initialize SCTLR_ELx for the boot-wrapper Mark Rutland
2022-01-11 14:38   ` Robin Murphy
2022-01-12 14:34     ` Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 07/13] Rework common init C code Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 08/13] Announce boot-wrapper mode / exception level Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 09/13] aarch64: move the bulk of EL3 initialization to C Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 10/13] aarch32: move the bulk of Secure PL1 " Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 11/13] Announce locations of memory objects Mark Rutland
2022-01-14 10:48   ` Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 12/13] Rework bootmethod initialization Mark Rutland
2022-01-11 13:06 ` [bootwrapper PATCH 13/13] Unify start_el3 & start_no_el3 Mark Rutland
2022-01-11 14:39   ` Robin Murphy
2022-01-12 14:37     ` Mark Rutland

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=20220111130653.2331827-2-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=Jaxson.Han@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.