From: Luca Fancellu <luca.fancellu@arm.com>
To: mark.rutland@arm.com, andre.przywara@arm.com
Cc: linux-arm-kernel@lists.infradead.org
Subject: [boot-wrapper v4 3/4] aarch64: Implement PSCI for Armv8-R
Date: Thu, 17 Oct 2024 10:55:19 +0100 [thread overview]
Message-ID: <20241017095520.939464-4-luca.fancellu@arm.com> (raw)
In-Reply-To: <20241017095520.939464-1-luca.fancellu@arm.com>
Armv8-R doesn't have EL3, so the PSCI vector needs to be
installed in VBAR_EL2 and the conduit needs to be 'hcv'
instead of 'smc'.
Implement the modifications needed when --with-bw-arch is
'aarch64-r'.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
v4 changes:
- rework cpu_init_psci_arch code to don't have #ifdef
---
Makefile.am | 2 +-
arch/aarch64/init.c | 15 +++++++++++----
configure.ac | 3 +++
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 44ea3f7e0d7b..aecda694fd6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,7 @@ ARCH_OBJ += psci.o
COMMON_OBJ += psci.o
PSCI_NODE := psci { \
compatible = \"arm,psci\"; \
- method = \"smc\"; \
+ method = \"$(PSCI_METHOD)\"; \
cpu_on = <$(PSCI_CPU_ON)>; \
cpu_off = <$(PSCI_CPU_OFF)>; \
};
diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c
index 9bbfce3aaf34..da036bb0b947 100644
--- a/arch/aarch64/init.c
+++ b/arch/aarch64/init.c
@@ -224,13 +224,20 @@ extern char psci_vectors[];
static void cpu_init_psci_arch(unsigned int cpu)
{
- if (mrs(CurrentEL) != CURRENTEL_EL3) {
- print_cpu_warn(cpu, "PSCI could not be initialized (not booted at EL3).\r\n");
+ if (!bootwrapper_is_r_class() && mrs(CurrentEL) == CURRENTEL_EL3) {
+ msr(VBAR_EL3, (unsigned long)psci_vectors);
+ isb();
return;
}
- msr(VBAR_EL3, (unsigned long)psci_vectors);
- isb();
+ if (bootwrapper_is_r_class() && mrs(CurrentEL) == CURRENTEL_EL2) {
+ msr(VBAR_EL2, (unsigned long)psci_vectors);
+ isb();
+ return;
+ }
+
+ print_cpu_warn(cpu, "PSCI could not be initialized (not booted at EL3).\r\n");
+
}
#else
static void cpu_init_psci_arch(unsigned int cpu) { }
diff --git a/configure.ac b/configure.ac
index 95e2b7f05756..a433c89bd2ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,9 @@ AC_ARG_ENABLE([psci],
[USE_PSCI=$enableval], [USE_PSCI="yes"])
AM_CONDITIONAL([PSCI], [test "x$USE_PSCI" = "xyes"])
AS_IF([test "x$USE_PSCI" = "xyes"], [], [USE_PSCI=no])
+AS_IF([test "x$USE_ARCH" = "xaarch64-r"],
+ AC_SUBST([PSCI_METHOD], [hvc]), AC_SUBST([PSCI_METHOD], [smc])
+)
AS_IF([test "x$USE_PSCI" != "xyes" -a "x$KERNEL_ES" = "x32"],
[AC_MSG_ERROR([With an AArch32 kernel, boot method must be PSCI.])]
--
2.34.1
next prev parent reply other threads:[~2024-10-17 10:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 9:55 [boot-wrapper v4 0/4] Add Armv8-R AArch64 support Luca Fancellu
2024-10-17 9:55 ` [boot-wrapper v4 1/4] Introduce --with-bw-arch for boot-wrapper compile arch Luca Fancellu
2024-10-17 9:55 ` [boot-wrapper v4 2/4] aarch64: Enable Armv8-R EL2 boot Luca Fancellu
2024-10-17 9:55 ` Luca Fancellu [this message]
2024-10-17 9:55 ` [boot-wrapper v4 4/4] aarch64: Start Xen on Armv8-R at EL2 Luca Fancellu
2024-11-26 11:58 ` Mark Rutland
2024-11-26 14:40 ` Luca Fancellu
2024-11-26 11:54 ` [boot-wrapper v4 0/4] Add Armv8-R AArch64 support 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=20241017095520.939464-4-luca.fancellu@arm.com \
--to=luca.fancellu@arm.com \
--cc=andre.przywara@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox