From c2b1434369292081f907c548e496f59e197eb2f1 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Thu, 9 Dec 2021 11:32:30 +0000 Subject: [PATCH] feat(spmc): add helper to obtain a partitions FF-A version Add a helper function to obtain the FF-A version of a calling partition. This is used to ensure that the SPMC maintains backwards compatibility if the partition implements a lower minor version for the same major version than the SPMC. Signed-off-by: Marc Bonnici Change-Id: I5b364a1e510a999bb0c4cacae28f23f8a42a1e3e --- services/std_svc/spm/el3_spmc/spmc_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/std_svc/spm/el3_spmc/spmc_main.c b/services/std_svc/spm/el3_spmc/spmc_main.c index 4a0853e70..33a25a262 100644 --- a/services/std_svc/spm/el3_spmc/spmc_main.c +++ b/services/std_svc/spm/el3_spmc/spmc_main.c @@ -555,6 +555,18 @@ static uint64_t ffa_version_handler(uint32_t smc_fid, FFA_VERSION_MINOR)); } +/******************************************************************************* + * Helper function to obtain the FF-A version of the calling partition. + ******************************************************************************/ +uint32_t get_partition_ffa_version(bool secure_origin) +{ + if (secure_origin) { + return spmc_get_current_sp_ctx()->ffa_version; + } else { + return spmc_get_hyp_ctx()->ffa_version; + } +} + /******************************************************************************* * This function will parse the Secure Partition Manifest. From manifest, it * will fetch details for preparing Secure partition image context and secure