diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2021-08-20 16:51:54 +0100 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2021-10-06 16:00:34 +0100 |
commit | b47ce549eb9b7b567df4b6b7f156918c50aee40c (patch) | |
tree | 2655a9a0aa7bb065138907dea7cede1f1aaca6a7 | |
parent | 72ed8b7329c2167b46d6b90fca83a476486d704d (diff) | |
download | trusted-firmware-a-b47ce549eb9b7b567df4b6b7f156918c50aee40c.tar.gz |
spmd: Add FFA_SMC_Forward
Split the functionality of spmd_smc_forward out into
a separate function that can be called by either the SPMC or
the SPMD.
If SPMC_AT_EL3 is not set then forward the SMC from the SPMD directly
instead of going through the SPMC.
Change-Id: I354fa481c56c113fde11e766879d505d321c5bba
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r-- | include/services/spmd_svc.h | 3 | ||||
-rw-r--r-- | services/std_svc/spmd/spmd_main.c | 28 | ||||
-rw-r--r-- | services/std_svc/std_svc_setup.c | 4 |
3 files changed, 28 insertions, 7 deletions
diff --git a/include/services/spmd_svc.h b/include/services/spmd_svc.h index 0930fe7067..5ffd4a3550 100644 --- a/include/services/spmd_svc.h +++ b/include/services/spmd_svc.h @@ -23,8 +23,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, #endif /* __ASSEMBLER__ */ /* Function declarations. */ - -uint64_t spm_smc_forward(uint32_t smc_fid, +uint64_t ffa_smc_forward(uint32_t smc_fid, bool secure_origin, uint64_t x1, uint64_t x2, diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c index f08c615dee..c087c2eafe 100644 --- a/services/std_svc/spmd/spmd_main.c +++ b/services/std_svc/spmd/spmd_main.c @@ -379,16 +379,16 @@ int spmd_setup(void) } /******************************************************************************* - * Forward SMC to the other security state + * Forward FFA SMCs to the other security state ******************************************************************************/ -static uint64_t spmd_smc_forward(uint32_t smc_fid, +uint64_t ffa_smc_forward(uint32_t smc_fid, bool secure_origin, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, - void *handle, void *cookie, + void *handle, uint64_t flags) { if (is_spmc_at_el3()) { @@ -427,6 +427,28 @@ static uint64_t spmd_smc_forward(uint32_t smc_fid, } /******************************************************************************* + * Forward FFA SMC to the other security state + ******************************************************************************/ +static uint64_t spmd_smc_forward(uint32_t smc_fid, + bool secure_origin, + uint64_t x1, + uint64_t x2, + uint64_t x3, + uint64_t x4, + void *handle, + void *cookie, + uint64_t flags) +{ +#if (SPMC_AT_EL3) + if (!secure_origin) { + return spmc_smc_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); + } +#endif + return ffa_smc_forward(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); + +} + +/******************************************************************************* * Return FFA_ERROR with specified error code ******************************************************************************/ static uint64_t spmd_ffa_error_return(void *handle, int error_code) diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c index f0cbd627e8..bdf40bcc1f 100644 --- a/services/std_svc/std_svc_setup.c +++ b/services/std_svc/std_svc_setup.c @@ -145,8 +145,8 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid, /* If we have an SPMC at EL3 allow handling first. * SPMC will call through to SPMD if required. */ - if (is_caller_secure(flags) == SMC_FROM_SECURE) { - return spmc_smc_handler(SECURE, smc_fid, x1, x2, x3, x4, cookie, handle, flags); + if (is_caller_secure(flags)) { + return spmc_smc_handler(smc_fid, is_caller_secure(flags), x1, x2, x3, x4, cookie, handle, flags); } #endif return spmd_smc_handler(smc_fid, x1, x2, x3, x4, cookie, |