trusty: Add fpu/simd support

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

Change-Id: I77fd434feab396ff05d9b8e0c1761e4dd588a701
Signed-off-by: Arve Hjønnevåg <arve@android.com>
diff --git a/services/spd/trusty/trusty.c b/services/spd/trusty/trusty.c
index 08767bb..6e80b7b 100644
--- a/services/spd/trusty/trusty.c
+++ b/services/spd/trusty/trusty.c
@@ -105,10 +105,8 @@
 	 * 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;
@@ -117,10 +115,8 @@
 	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);
 
@@ -299,6 +295,7 @@
 	ep_info = bl31_plat_get_next_image_ep_info(SECURE);
 	assert(ep_info);
 
+	fpregs_context_save(get_fpregs_ctx(cm_get_context(NON_SECURE)));
 	cm_el1_sysregs_context_save(NON_SECURE);
 
 	cm_set_context(&ctx->cpu_ctx, SECURE);
@@ -315,6 +312,7 @@
 	}
 
 	cm_el1_sysregs_context_restore(SECURE);
+	fpregs_context_restore(get_fpregs_ctx(cm_get_context(SECURE)));
 	cm_set_next_eret_context(SECURE);
 
 	ctx->saved_security_state = ~0; /* initial saved state is invalid */
@@ -323,6 +321,7 @@
 	trusty_context_switch_helper(&ctx->saved_sp, &zero_args);
 
 	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);
 
 	return 0;
diff --git a/services/spd/trusty/trusty.mk b/services/spd/trusty/trusty.mk
index 2e51bd5..a571fa2 100644
--- a/services/spd/trusty/trusty.mk
+++ b/services/spd/trusty/trusty.mk
@@ -14,3 +14,5 @@
 endif
 
 NEED_BL32		:=	yes
+
+CTX_INCLUDE_FPREGS	:=	1