Before issuing an SMC, detect whether SMCCC is available through this conduit. On platforms that do not implement EL3 nor EL2, the SMC instruction is UNDEFINED. SMCCC advises probing the SMCCC availability by first looking for a PSCI node in DT (or in ACPI, but we expect a realm to boot with DT at the moment). Since RMM requires using the SMC conduit for both PSCI and RSI, we rely on the PSCI method property to ensure SMC is available. We could also check that the SMCCC version is at least 1.2 as required by RMM, but no platform requires this extra step at the moment, and we can't use the SMCCC helpers this early in boot. Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> --- arch/arm64/kernel/rsi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c index 898952d135b0..21fc261a1d26 100644 --- a/arch/arm64/kernel/rsi.c +++ b/arch/arm64/kernel/rsi.c @@ -7,6 +7,7 @@ #include <linux/memblock.h> #include <linux/swiotlb.h> #include <linux/cc_platform.h> +#include <linux/psci.h> #include <asm/rsi.h> @@ -82,6 +83,12 @@ void __init arm64_rsi_setup_memory(void) void __init arm64_rsi_init(void) { + /* + * If PSCI isn't using SMC, RMM isn't present. Don't try to execute an + * SMC as it could be UNDEFINED. + */ + if (!psci_early_test_conduit(SMCCC_CONDUIT_SMC)) + return; if (!rsi_version_matches()) return; if (rsi_get_realm_config(&config)) -- 2.45.2 --/N5098jZq9Eqa4T2--