diff options
author | davidcunado-arm <david.cunado@arm.com> | 2017-10-11 13:56:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 13:56:38 +0100 |
commit | 7efc390d349f36b01765b020e6e0429cf9d428e3 (patch) | |
tree | 2974a1eebc313caa4d3378500b6f17e381f2e3a7 | |
parent | 0f49d4968b8a8d1037ce20b7d8372c0055e816d2 (diff) | |
parent | ab609e1a76399969f8318360ea3fff30687c9638 (diff) | |
download | trusted-firmware-a-7efc390d349f36b01765b020e6e0429cf9d428e3.tar.gz |
Merge pull request #1100 from ajs-sun/master
trusty: save/restore FPU registers in world switch
-rw-r--r-- | services/spd/trusty/trusty.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/spd/trusty/trusty.c b/services/spd/trusty/trusty.c index e386f71c67..ecbcfaeabc 100644 --- a/services/spd/trusty/trusty.c +++ b/services/spd/trusty/trusty.c @@ -99,6 +99,16 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0, ret.r1 = r1; ret.r0 = r0; + /* + * To avoid the additional overhead in PSCI flow, skip FP context + * saving/restoring in case of CPU suspend and resume, asssuming that + * when it's needed the PSCI caller has preserved FP context before + * going here. + */ +#if CTX_INCLUDE_FPREGS + if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME) + fpregs_context_save(get_fpregs_ctx(cm_get_context(security_state))); +#endif cm_el1_sysregs_context_save(security_state); ctx->saved_security_state = security_state; @@ -107,6 +117,11 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0, assert(ctx->saved_security_state == !security_state); cm_el1_sysregs_context_restore(security_state); +#if CTX_INCLUDE_FPREGS + if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME) + fpregs_context_restore(get_fpregs_ctx(cm_get_context(security_state))); +#endif + cm_set_next_eret_context(security_state); return ret; |