feat: add support for secure interrupt handling and completion
As per FF-A v1.1 spec, the conduit used by SPM to signal an interrupt
to S-EL1 Partition is vIRQ and/or ERET.
Depending on the execution state of the vCPU of the target SP,
FFA_INTERRUPT ABI and/or Interrupt ID can be used as parameters during
eret to the SP.
This patch adds support for secure interrupt handling in Cactus SP as
well as adds support for FFA_INTERRUPT ABI in the message loop.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I173b9e0af11b6fd2605145391da68dfda04a14f2
diff --git a/spm/cactus/cactus_tests/cactus_test_interrupts.c b/spm/cactus/cactus_tests/cactus_test_interrupts.c
index 5cd53d1..ced5dca 100644
--- a/spm/cactus/cactus_tests/cactus_test_interrupts.c
+++ b/spm/cactus/cactus_tests/cactus_test_interrupts.c
@@ -12,6 +12,8 @@
#include "cactus_message_loop.h"
#include "cactus_test_cmds.h"
+#include <platform.h>
+
CACTUS_CMD_HANDLER(sleep_cmd, CACTUS_SLEEP_CMD)
{
uint64_t time_lapsed;
@@ -37,12 +39,19 @@
ffa_id_t fwd_dest = cactus_get_fwd_sleep_dest(*args);
uint32_t sleep_ms = cactus_get_sleep_time(*args);
-
VERBOSE("VM%x requested %x to sleep for value %u\n",
ffa_dir_msg_source(*args), fwd_dest, sleep_ms);
ffa_ret = cactus_sleep_cmd(vm_id, fwd_dest, sleep_ms);
+ while (ffa_ret.ret0 == FFA_INTERRUPT) {
+ /* Received FFA_INTERRUPT in blocked state. */
+ VERBOSE("Processing FFA_INTERRUPT while blocked on direct response\n");
+ unsigned int my_core_pos = platform_get_core_pos(read_mpidr_el1());
+
+ ffa_ret = ffa_run(fwd_dest, my_core_pos);
+ }
+
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),