Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 1 | From 0b9a966b8a28961b078215ee7169e32a976d5e7d Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Qi Feng <qi.feng@arm.com> |
| 3 | Date: Wed, 26 May 2021 17:52:01 +0800 |
| 4 | Subject: [PATCH] Allow --enable-psci to choose between smc and hvc |
| 5 | |
| 6 | According to Armv8-R AArch64 manual [1], Armv8-R AArch64 does not |
| 7 | support smc: |
| 8 | |
| 9 | - Pseudocode for AArch64.CheckForSMCUndefOrTrap has this snippet: |
| 10 | |
| 11 | if !HaveEL(EL3) || PSTATE.EL == EL0 then |
| 12 | UNDEFINED; |
| 13 | |
| 14 | And Armv8-R AArch64 does not have EL3. |
| 15 | |
| 16 | - In the document of HCR_EL2 TSC bit: |
| 17 | If EL3 is not implemented and HCR_EL2.NV is 0, it is IMPLEMENTATION |
| 18 | DEFINED whether this bit is: |
| 19 | - RES0. |
| 20 | - Implemented with the functionality as described in HCR_EL2.TSC. |
| 21 | |
| 22 | So hvc is needed in this situation. And due to the lack of libfdt, the |
| 23 | psci method cannot be modified at runtime. |
| 24 | |
| 25 | To use smc, use --enable-psci or --enable-psci=smc. |
| 26 | To use hvc, use --enable-psci=hvc. |
| 27 | |
| 28 | [1]: https://developer.arm.com/documentation/ddi0600/latest/ |
| 29 | |
| 30 | Issue-Id: SCM-2654 |
| 31 | Upstream-Status: Pending |
| 32 | Signed-off-by: Qi Feng <qi.feng@arm.com> |
| 33 | Change-Id: Ib8afabdad2d98bc37371d165bbb6f1f9b88bfc87 |
| 34 | |
| 35 | Upstream-Status: Pending |
| 36 | Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com> |
| 37 | --- |
| 38 | Makefile.am | 10 +++++----- |
| 39 | configure.ac | 14 +++++++++----- |
| 40 | 2 files changed, 14 insertions(+), 10 deletions(-) |
| 41 | |
| 42 | diff --git a/Makefile.am b/Makefile.am |
Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 43 | index 5731a19..fc66662 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 44 | --- a/Makefile.am |
| 45 | +++ b/Makefile.am |
| 46 | @@ -50,11 +50,11 @@ endif |
| 47 | if PSCI |
| 48 | ARCH_OBJ += psci.o |
| 49 | COMMON_OBJ += psci.o |
| 50 | -PSCI_NODE := psci { \ |
| 51 | - compatible = \"arm,psci\"; \ |
| 52 | - method = \"smc\"; \ |
| 53 | - cpu_on = <$(PSCI_CPU_ON)>; \ |
| 54 | - cpu_off = <$(PSCI_CPU_OFF)>; \ |
| 55 | +PSCI_NODE := psci { \ |
| 56 | + compatible = \"arm,psci\"; \ |
| 57 | + method = \"$(PSCI_METHOD)\"; \ |
| 58 | + cpu_on = <$(PSCI_CPU_ON)>; \ |
| 59 | + cpu_off = <$(PSCI_CPU_OFF)>; \ |
| 60 | }; |
| 61 | CPU_NODES := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/addpsci.pl $(KERNEL_DTB)) |
| 62 | else |
| 63 | diff --git a/configure.ac b/configure.ac |
| 64 | index 9e3b722..53e51be 100644 |
| 65 | --- a/configure.ac |
| 66 | +++ b/configure.ac |
| 67 | @@ -83,13 +83,17 @@ AS_IF([test "x$X_IMAGE" != "x"], |
| 68 | # Allow a user to pass --enable-psci |
| 69 | AC_ARG_ENABLE([psci], |
| 70 | AS_HELP_STRING([--disable-psci], [disable the psci boot method]), |
| 71 | - [USE_PSCI=$enableval], [USE_PSCI="yes"]) |
| 72 | -AM_CONDITIONAL([PSCI], [test "x$USE_PSCI" = "xyes"]) |
| 73 | -AS_IF([test "x$USE_PSCI" = "xyes"], [], [USE_PSCI=no]) |
| 74 | - |
| 75 | -AS_IF([test "x$USE_PSCI" != "xyes" -a "x$KERNEL_ES" = "x32"], |
| 76 | + [case "${enableval}" in |
| 77 | + yes|smc) USE_PSCI=smc ;; |
| 78 | + hvc) USE_PSCI=hvc ;; |
| 79 | + *) AC_MSG_ERROR([Bad value "${enableval}" for --enable-psci. Use "smc" or "hvc"]) ;; |
| 80 | + esac], [USE_PSCI="yes"]) |
| 81 | +AM_CONDITIONAL([PSCI], [test "x$USE_PSCI" = "xyes" -o "x$USE_PSCI" = "xsmc" -o "x$USE_PSCI" = "xhvc"]) |
| 82 | + |
| 83 | +AS_IF([test "x$USE_PSCI" = "xno" -a "x$KERNEL_ES" = "x32"], |
| 84 | [AC_MSG_ERROR([With an AArch32 kernel, boot method must be PSCI.])] |
| 85 | ) |
| 86 | +AC_SUBST([PSCI_METHOD], [$USE_PSCI]) |
| 87 | |
| 88 | # Allow a user to pass --with-initrd |
| 89 | AC_ARG_WITH([initrd], |