diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2021-08-31 17:57:04 +0100 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2021-10-07 12:34:59 +0100 |
commit | e811de2de9fc1b70cf14cf091e9ccbfc9b5a5e80 (patch) | |
tree | 38c742aeb1c57096d7de2abbdc715c46dccf8a5b | |
parent | 1eb638dcd10a150e80af83c7ea030b321a5261a9 (diff) | |
download | trusted-firmware-a-e811de2de9fc1b70cf14cf091e9ccbfc9b5a5e80.tar.gz |
spmc: Add FFA_RUN handler
Change-Id: I3e8a3fa3ec9b03830055d2fbd6124b8ff1ed4103
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r-- | include/services/ffa_svc.h | 2 | ||||
-rw-r--r-- | services/std_svc/spm/spmc/spmc_main.c | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/services/ffa_svc.h b/include/services/ffa_svc.h index 0df03f8544..d3e5f4aa06 100644 --- a/include/services/ffa_svc.h +++ b/include/services/ffa_svc.h @@ -62,6 +62,8 @@ ((src_dst_ids >> 16) & FFA_PARTITION_ID_MASK) #define FFA_RECEIVER(src_dst_ids) \ (src_dst_ids & FFA_PARTITION_ID_MASK) +#define FFA_RUN_TARGET(src_dst_ids) \ + ((src_dst_ids >> 16) & FFA_PARTITION_ID_MASK) /* Get FFA fastcall std FID from function number */ diff --git a/services/std_svc/spm/spmc/spmc_main.c b/services/std_svc/spm/spmc/spmc_main.c index 0d90b24c9e..b57ca234a1 100644 --- a/services/std_svc/spm/spmc/spmc_main.c +++ b/services/std_svc/spm/spmc/spmc_main.c @@ -780,6 +780,7 @@ static uint64_t ffa_features_handler(uint32_t smc_fid, case FFA_PARTITION_INFO_GET: case FFA_RXTX_MAP_SMC64: case FFA_RXTX_UNMAP: + case FFA_MSG_RUN: case FFA_MSG_WAIT: SMC_RET1(handle, FFA_SUCCESS_SMC32); @@ -835,6 +836,32 @@ static uint64_t ffa_id_get_handler(uint32_t smc_fid, SMC_RET3(handle, FFA_SUCCESS_SMC32, 0x0, ctx->sp_id); } +static uint64_t ffa_run_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) +{ + + /* Can only be called from the normal world. */ + if (secure_origin) { + spmc_ffa_error_return(handle, FFA_ERROR_INVALID_PARAMETER); + } + + /* Cannot run "primary" partition. */ + if (FFA_RUN_TARGET(x1) == NWLD_CTX_ID) { + spmc_ffa_error_return(handle, FFA_ERROR_INVALID_PARAMETER); + } + + /* TODO: Add verification are we running on the correct vcpu. */ + + return spmc_smc_return(smc_fid, secure_origin, FFA_RUN_TARGET(x1), 0, 0, 0, handle, cookie, flags); +} + /******************************************************************************* * SPMC Helper Functions ******************************************************************************/ @@ -956,6 +983,8 @@ uint64_t spmc_smc_handler(uint32_t smc_fid, /* Else forward to SPMD. */ return spmd_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle, flags); + case FFA_MSG_RUN: + return ffa_run_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); default: WARN("Not Supported 0x%x (0x%llx, 0x%llx, 0x%llx, 0x%llx) FFA Request ID\n", smc_fid, x1, x2, x3, x4); break; |