From 4b293417d91d67e85e6f1077375f772241d5c131 Mon Sep 17 00:00:00 2001 From: Madhukar Pappireddy Date: Mon, 12 Sep 2022 11:39:20 -0500 Subject: 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 Change-Id: I808ee6c63687438d0092a53389f11bf9b3dd532d --- spm/cactus/cactus_tests/cactus_test_interrupts.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spm/cactus/cactus_tests') 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 @@ CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD) 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 @@ CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD) 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 @@ CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD) } } + 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), -- cgit v1.2.3