diff --git a/services/std_svc/spm/el3_spmc/spmc_main.c b/services/std_svc/spm/el3_spmc/spmc_main.c index c6ec30c3d..51fba5833 100644 --- a/services/std_svc/spm/el3_spmc/spmc_main.c +++ b/services/std_svc/spm/el3_spmc/spmc_main.c @@ -610,19 +610,14 @@ static uint64_t msg_wait_handler(uint32_t smc_fid, /* Resume normal world if a secure interrupt was handled. */ if (sp->ec[idx].rt_model == RT_MODEL_INTR) { - /* FFA_MSG_WAIT can only be called from the secure world. */ - unsigned int secure_state_in = SECURE; - unsigned int secure_state_out = NON_SECURE; - - cm_el1_sysregs_context_save(secure_state_in); - cm_el1_sysregs_context_restore(secure_state_out); - cm_set_next_eret_context(secure_state_out); - if (sp->runtime_el == S_EL0) { spin_unlock(&sp->rt_state_lock); } - SMC_RET0(cm_get_context(secure_state_out)); + return spmd_smc_switch_state(FFA_NORMAL_WORLD_RESUME, secure_origin, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + handle, flags); } /* Protect the runtime state of a S-EL0 SP with a lock. */ diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c index 3953b245b..4d82991a2 100644 --- a/services/std_svc/spmd/spmd_main.c +++ b/services/std_svc/spmd/spmd_main.c @@ -715,6 +715,10 @@ uint64_t spmd_smc_switch_state(uint32_t smc_fid, cm_set_next_eret_context(secure_state_out); ctx_out = cm_get_context(secure_state_out); + if (smc_fid == FFA_NORMAL_WORLD_RESUME) { + SMC_RET0(ctx_out); + } + #if SPMD_SPM_AT_SEL2 /* * If SPMC is at SEL2, save additional registers x8-x17, which may