Commit e46b2fd2 authored by J-Alves's avatar J-Alves Committed by Olivier Deprez
Browse files

SPM: Fix error codes size in SPMD handler



FF-A specification states that error codes should be typed int32_t.
SPMD's uses uint64_t for return values, which if assigned with a signed
type would have sign extension, and change the size of the return from
32-bit to 64-bit.
Signed-off-by: default avatarJ-Alves <joao.alves@arm.com>
Change-Id: I288ab2ffec8330a2fe1f21df14e22c34bd83ced3
parent 2e0e51f4
...@@ -369,8 +369,8 @@ static uint64_t spmd_smc_forward(uint32_t smc_fid, ...@@ -369,8 +369,8 @@ static uint64_t spmd_smc_forward(uint32_t smc_fid,
******************************************************************************/ ******************************************************************************/
static uint64_t spmd_ffa_error_return(void *handle, int error_code) static uint64_t spmd_ffa_error_return(void *handle, int error_code)
{ {
SMC_RET8(handle, FFA_ERROR, SMC_RET8(handle, (uint32_t) FFA_ERROR,
FFA_TARGET_INFO_MBZ, error_code, FFA_TARGET_INFO_MBZ, (uint32_t)error_code,
FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ, FFA_PARAM_MBZ); FFA_PARAM_MBZ, FFA_PARAM_MBZ);
} }
...@@ -465,14 +465,16 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, ...@@ -465,14 +465,16 @@ uint64_t spmd_smc_handler(uint32_t smc_fid,
(ctx->state == SPMC_STATE_RESET)) { (ctx->state == SPMC_STATE_RESET)) {
ret = FFA_ERROR_NOT_SUPPORTED; ret = FFA_ERROR_NOT_SUPPORTED;
} else if (!secure_origin) { } else if (!secure_origin) {
ret = MAKE_FFA_VERSION(spmc_attrs.major_version, spmc_attrs.minor_version); ret = MAKE_FFA_VERSION(spmc_attrs.major_version,
spmc_attrs.minor_version);
} else { } else {
ret = MAKE_FFA_VERSION(FFA_VERSION_MAJOR, FFA_VERSION_MINOR); ret = MAKE_FFA_VERSION(FFA_VERSION_MAJOR,
FFA_VERSION_MINOR);
} }
SMC_RET8(handle, ret, FFA_TARGET_INFO_MBZ, FFA_TARGET_INFO_MBZ, SMC_RET8(handle, (uint32_t)ret, FFA_TARGET_INFO_MBZ,
FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_TARGET_INFO_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ, FFA_PARAM_MBZ); FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ);
break; /* not reached */ break; /* not reached */
case FFA_FEATURES: case FFA_FEATURES:
...@@ -487,7 +489,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, ...@@ -487,7 +489,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid,
*/ */
if (!is_ffa_fid(x1)) { if (!is_ffa_fid(x1)) {
return spmd_ffa_error_return(handle, return spmd_ffa_error_return(handle,
FFA_ERROR_NOT_SUPPORTED); FFA_ERROR_NOT_SUPPORTED);
} }
/* Forward SMC from Normal world to the SPM Core */ /* Forward SMC from Normal world to the SPM Core */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment