The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5a8417c78f9d51bf1103353bee348eaac83e86e5
commit 5a8417c78f9d51bf1103353bee348eaac83e86e5 Author: Andrew Turner <[email protected]> AuthorDate: 2023-10-30 14:33:08 +0000 Commit: Andrew Turner <[email protected]> CommitDate: 2023-11-10 16:01:13 +0000 arm64: Check if PSCI before calling SMCCC As SMCCC depends on PSCI check if the latter is present before calling the former. This fixes an issue where we may call into SMCCC when there is no PSCI in the system causing a smccc_version assert to fail. Reported by: stevek Reviewed by: emaste, imp, stevek Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42404 --- sys/arm64/arm64/cpu_errata.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/arm64/arm64/cpu_errata.c b/sys/arm64/arm64/cpu_errata.c index fee22240bb0e..a03303d83044 100644 --- a/sys/arm64/arm64/cpu_errata.c +++ b/sys/arm64/arm64/cpu_errata.c @@ -40,6 +40,7 @@ #include <machine/cpu.h> +#include <dev/psci/psci.h> #include <dev/psci/smccc.h> typedef void (cpu_quirk_install)(void); @@ -117,6 +118,9 @@ static struct cpu_quirks cpu_quirks[] = { static void install_psci_bp_hardening(void) { + /* SMCCC depends on PSCI. If PSCI is missing so is SMCCC */ + if (!psci_present) + return; if (smccc_arch_features(SMCCC_ARCH_WORKAROUND_1) != SMCCC_RET_SUCCESS) return; @@ -140,6 +144,10 @@ install_ssbd_workaround(void) } } + /* SMCCC depends on PSCI. If PSCI is missing so is SMCCC */ + if (!psci_present) + return; + /* Enable the workaround on this CPU if it's enabled in the firmware */ if (smccc_arch_features(SMCCC_ARCH_WORKAROUND_2) != SMCCC_RET_SUCCESS) return;
