mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-24 05:54:08 +00:00
refactor(spmd): call cm_get_context once
As observed by tracing instruction execution the SMC_RET18 macro in spmd_smc_switch_state calls cm_get_context, however the compiler expands it to multiple individual non-inlined calls to this same function. Store the result of cm_get_context into a local variable and use it in the macro such that this function is only called once. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: Ib4fa63aced2f07c67c057f54fef3780c85e91df7
This commit is contained in:
parent
c8cea3b8a8
commit
107e3cc0cb
1 changed files with 4 additions and 2 deletions
|
@ -662,6 +662,7 @@ uint64_t spmd_smc_switch_state(uint32_t smc_fid,
|
|||
{
|
||||
unsigned int secure_state_in = (secure_origin) ? SECURE : NON_SECURE;
|
||||
unsigned int secure_state_out = (!secure_origin) ? SECURE : NON_SECURE;
|
||||
void *ctx_out;
|
||||
|
||||
#if SPMD_SPM_AT_SEL2
|
||||
if ((secure_state_out == SECURE) && (is_sve_hint_set(flags) == true)) {
|
||||
|
@ -688,6 +689,7 @@ uint64_t spmd_smc_switch_state(uint32_t smc_fid,
|
|||
#endif
|
||||
cm_set_next_eret_context(secure_state_out);
|
||||
|
||||
ctx_out = cm_get_context(secure_state_out);
|
||||
#if SPMD_SPM_AT_SEL2
|
||||
/*
|
||||
* If SPMC is at SEL2, save additional registers x8-x17, which may
|
||||
|
@ -700,7 +702,7 @@ uint64_t spmd_smc_switch_state(uint32_t smc_fid,
|
|||
* preserved, so the SPMD passes through these registers and expects the
|
||||
* SPMC to save and restore (potentially also modify) them.
|
||||
*/
|
||||
SMC_RET18(cm_get_context(secure_state_out), smc_fid, x1, x2, x3, x4,
|
||||
SMC_RET18(ctx_out, smc_fid, x1, x2, x3, x4,
|
||||
SMC_GET_GP(handle, CTX_GPREG_X5),
|
||||
SMC_GET_GP(handle, CTX_GPREG_X6),
|
||||
SMC_GET_GP(handle, CTX_GPREG_X7),
|
||||
|
@ -717,7 +719,7 @@ uint64_t spmd_smc_switch_state(uint32_t smc_fid,
|
|||
);
|
||||
|
||||
#else
|
||||
SMC_RET8(cm_get_context(secure_state_out), smc_fid, x1, x2, x3, x4,
|
||||
SMC_RET8(ctx_out, smc_fid, x1, x2, x3, x4,
|
||||
SMC_GET_GP(handle, CTX_GPREG_X5),
|
||||
SMC_GET_GP(handle, CTX_GPREG_X6),
|
||||
SMC_GET_GP(handle, CTX_GPREG_X7));
|
||||
|
|
Loading…
Add table
Reference in a new issue