test(tftf): test FPU state registers context is preserved in RL/SE/NS
Test that FPU/SIMD state are preserved during a randomly context switch
between secure/non-secure/realm(R-EL1)worlds.
FPU/SIMD state consist of the 32 SIMD vectors, FPCR and FPSR registers,
the test runs for 1000 iterations with random combination of:
SECURE_FILL_FPU, SECURE_READ_FPU, REALM_FILL_FPU, REALM_READ_FPU,
NONSECURE_FILL_FPU, NONSECURE_READ_FPU commands,to test all possible
situations of synchronous context switch between worlds, while the
content of those registers is being used.
Signed-off-by: Nabil Kahlouche <nabil.kahlouche@arm.com>
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: I6da5fd334777000111924bb1239b77123a3dcea6
diff --git a/realm/realm_payload_main.c b/realm/realm_payload_main.c
index 414c329..c6665b4 100644
--- a/realm/realm_payload_main.c
+++ b/realm/realm_payload_main.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <debug.h>
+#include <fpu.h>
#include <host_realm_helper.h>
#include <host_shared_data.h>
#include "realm_def.h"
@@ -15,6 +16,7 @@
#include <realm_tests.h>
#include <tftf_lib.h>
+static fpu_reg_state_t fpu_temp_rl;
/*
* This function reads sleep time in ms from shared buffer and spins PE
* in a loop for that time period.
@@ -85,6 +87,13 @@
case REALM_PMU_INTERRUPT:
test_succeed = test_pmuv3_overflow_interrupt();
break;
+ case REALM_REQ_FPU_FILL_CMD:
+ fpu_state_fill_regs_and_template(&fpu_temp_rl);
+ test_succeed = true;
+ break;
+ case REALM_REQ_FPU_CMP_CMD:
+ test_succeed = fpu_state_compare_template(&fpu_temp_rl);
+ break;
default:
realm_printf("%s() invalid cmd %u\n", __func__, cmd);
break;