Commit cb03c917 authored by Arve Hjønnevåg's avatar Arve Hjønnevåg
Browse files

trusty: Add fpu/simd support



The original patch has been partly merged. This adds the missing
pieces.

Change-Id: I77fd434feab396ff05d9b8e0c1761e4dd588a701
Signed-off-by: default avatarArve Hjønnevåg <arve@android.com>
parent 61496151
...@@ -105,10 +105,8 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0, ...@@ -105,10 +105,8 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0,
* when it's needed the PSCI caller has preserved FP context before * when it's needed the PSCI caller has preserved FP context before
* going here. * going here.
*/ */
#if CTX_INCLUDE_FPREGS
if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME) if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME)
fpregs_context_save(get_fpregs_ctx(cm_get_context(security_state))); fpregs_context_save(get_fpregs_ctx(cm_get_context(security_state)));
#endif
cm_el1_sysregs_context_save(security_state); cm_el1_sysregs_context_save(security_state);
ctx->saved_security_state = security_state; ctx->saved_security_state = security_state;
...@@ -117,10 +115,8 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0, ...@@ -117,10 +115,8 @@ static struct args trusty_context_switch(uint32_t security_state, uint64_t r0,
assert(ctx->saved_security_state == !security_state); assert(ctx->saved_security_state == !security_state);
cm_el1_sysregs_context_restore(security_state); cm_el1_sysregs_context_restore(security_state);
#if CTX_INCLUDE_FPREGS
if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME) if (r0 != SMC_FC_CPU_SUSPEND && r0 != SMC_FC_CPU_RESUME)
fpregs_context_restore(get_fpregs_ctx(cm_get_context(security_state))); fpregs_context_restore(get_fpregs_ctx(cm_get_context(security_state)));
#endif
cm_set_next_eret_context(security_state); cm_set_next_eret_context(security_state);
...@@ -299,6 +295,7 @@ static int32_t trusty_init(void) ...@@ -299,6 +295,7 @@ static int32_t trusty_init(void)
ep_info = bl31_plat_get_next_image_ep_info(SECURE); ep_info = bl31_plat_get_next_image_ep_info(SECURE);
assert(ep_info); assert(ep_info);
fpregs_context_save(get_fpregs_ctx(cm_get_context(NON_SECURE)));
cm_el1_sysregs_context_save(NON_SECURE); cm_el1_sysregs_context_save(NON_SECURE);
cm_set_context(&ctx->cpu_ctx, SECURE); cm_set_context(&ctx->cpu_ctx, SECURE);
...@@ -315,6 +312,7 @@ static int32_t trusty_init(void) ...@@ -315,6 +312,7 @@ static int32_t trusty_init(void)
} }
cm_el1_sysregs_context_restore(SECURE); cm_el1_sysregs_context_restore(SECURE);
fpregs_context_restore(get_fpregs_ctx(cm_get_context(SECURE)));
cm_set_next_eret_context(SECURE); cm_set_next_eret_context(SECURE);
ctx->saved_security_state = ~0; /* initial saved state is invalid */ ctx->saved_security_state = ~0; /* initial saved state is invalid */
...@@ -323,6 +321,7 @@ static int32_t trusty_init(void) ...@@ -323,6 +321,7 @@ static int32_t trusty_init(void)
trusty_context_switch_helper(&ctx->saved_sp, &zero_args); trusty_context_switch_helper(&ctx->saved_sp, &zero_args);
cm_el1_sysregs_context_restore(NON_SECURE); cm_el1_sysregs_context_restore(NON_SECURE);
fpregs_context_restore(get_fpregs_ctx(cm_get_context(NON_SECURE)));
cm_set_next_eret_context(NON_SECURE); cm_set_next_eret_context(NON_SECURE);
return 0; return 0;
......
...@@ -14,3 +14,5 @@ SPD_SOURCES += services/spd/trusty/generic-arm64-smcall.c ...@@ -14,3 +14,5 @@ SPD_SOURCES += services/spd/trusty/generic-arm64-smcall.c
endif endif
NEED_BL32 := yes NEED_BL32 := yes
CTX_INCLUDE_FPREGS := 1
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