From 46872e01f5efb555fef8367595b59e5d2f75cec0 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Thu, 25 Nov 2021 15:54:52 +0000 Subject: [PATCH] feat(spmc): add support for FFA_SPM_ID_GET Enable a Secure Partition to query the ID assigned to the SPMC. The SPMD will take care of any calls from the normal world therefore we should not need to handle this case in the SPMC. Signed-off-by: Marc Bonnici Change-Id: I97903e920e928df385addbb2d383f24e602bf2db --- services/std_svc/spm/el3_spmc/spmc_main.c | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/services/std_svc/spm/el3_spmc/spmc_main.c b/services/std_svc/spm/el3_spmc/spmc_main.c index b4ca5ffa2..342f55c0f 100644 --- a/services/std_svc/spm/el3_spmc/spmc_main.c +++ b/services/std_svc/spm/el3_spmc/spmc_main.c @@ -1022,6 +1022,7 @@ static uint64_t ffa_features_handler(uint32_t smc_fid, case FFA_ERROR: case FFA_SUCCESS_SMC32: case FFA_INTERRUPT: + case FFA_SPM_ID_GET: case FFA_ID_GET: case FFA_FEATURES: case FFA_VERSION: @@ -1083,6 +1084,30 @@ static uint64_t ffa_id_get_handler(uint32_t smc_fid, } } +/* + * Enable an SP to query the ID assigned to the SPMC. + */ +static uint64_t ffa_spm_id_get_handler(uint32_t smc_fid, + bool secure_origin, + uint64_t x1, + uint64_t x2, + uint64_t x3, + uint64_t x4, + void *cookie, + void *handle, + uint64_t flags) +{ + assert(x1 == 0UL); + assert(x2 == 0UL); + assert(x3 == 0UL); + assert(x4 == 0UL); + assert(SMC_GET_GP(handle, CTX_GPREG_X5) == 0UL); + assert(SMC_GET_GP(handle, CTX_GPREG_X6) == 0UL); + assert(SMC_GET_GP(handle, CTX_GPREG_X7) == 0UL); + + SMC_RET3(handle, FFA_SUCCESS_SMC32, 0x0, FFA_SPMC_ID); +} + static uint64_t ffa_run_handler(uint32_t smc_fid, bool secure_origin, uint64_t x1, @@ -1718,6 +1743,10 @@ uint64_t spmc_smc_handler(uint32_t smc_fid, return ffa_version_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); + case FFA_SPM_ID_GET: + return ffa_spm_id_get_handler(smc_fid, secure_origin, x1, x2, + x3, x4, cookie, handle, flags); + case FFA_ID_GET: return ffa_id_get_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags);