test(interrupts): hint fwd destination SP could be interrupted
TFTF can send a hint to the destination SP to expect that the
forwarded sleep command could be preempted by a non-secure interrupt.
This can make the tests exercising SP's response to non-secure
interrupt robust by allowing the destination SP to check if the
forward destination SP has indeed been preempted.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I808ee6c63687438d0092a53389f11bf9b3dd532d
diff --git a/spm/cactus/cactus_tests/cactus_test_interrupts.c b/spm/cactus/cactus_tests/cactus_test_interrupts.c
index 13a5e59..c438050 100644
--- a/spm/cactus/cactus_tests/cactus_test_interrupts.c
+++ b/spm/cactus/cactus_tests/cactus_test_interrupts.c
@@ -48,6 +48,8 @@
ffa_id_t vm_id = ffa_dir_msg_dest(*args);
ffa_id_t fwd_dest = cactus_get_fwd_sleep_dest(*args);
uint32_t sleep_ms = cactus_get_sleep_time(*args);
+ bool hint_interrupted = cactus_get_fwd_sleep_interrupted_hint(*args);
+ bool fwd_dest_interrupted;
VERBOSE("VM%x requested %x to sleep for value %u\n",
ffa_dir_msg_source(*args), fwd_dest, sleep_ms);
@@ -62,6 +64,7 @@
while ((ffa_func_id(ffa_ret) == FFA_INTERRUPT) ||
is_expected_cactus_response(ffa_ret, MANAGED_EXIT_INTERRUPT_ID,
0)) {
+ fwd_dest_interrupted = true;
if (ffa_func_id(ffa_ret) == FFA_INTERRUPT) {
/* Received FFA_INTERRUPT in blocked state. */
@@ -84,6 +87,13 @@
}
}
+ if (hint_interrupted && !fwd_dest_interrupted) {
+ ERROR("Forwaded destination of the sleep command was not"
+ " interrupted as anticipated\n");
+ return cactus_error_resp(vm_id, ffa_dir_msg_source(*args),
+ CACTUS_ERROR_TEST);
+ }
+
if (!is_ffa_direct_response(ffa_ret)) {
ERROR("Encountered error in CACTUS_FWD_SLEEP_CMD response\n");
return cactus_error_resp(vm_id, ffa_dir_msg_source(*args),