git: b9b148609abd - stable/13 - arm64: Check if PSCI before calling SMCCC
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Feb 2024 16:45:04 UTC
The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b9b148609abde98b6cf4470f0486ec65137c7282 commit b9b148609abde98b6cf4470f0486ec65137c7282 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2023-10-30 14:33:08 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-02-19 12:44:19 +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 (cherry picked from commit 5a8417c78f9d51bf1103353bee348eaac83e86e5) --- 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;