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_main.c b/spm/cactus/cactus_main.c
index 78bb8fc..c80abd9 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -69,14 +69,26 @@
 		}
 
 		if (ffa_func_id(ffa_ret) != FFA_MSG_SEND_DIRECT_REQ_SMC32 &&
-		    ffa_func_id(ffa_ret) != FFA_MSG_SEND_DIRECT_REQ_SMC64) {
+		    ffa_func_id(ffa_ret) != FFA_MSG_SEND_DIRECT_REQ_SMC64 &&
+		    ffa_func_id(ffa_ret) != FFA_INTERRUPT) {
 			ERROR("%s(%u) unknown func id 0x%x\n",
 				__func__, vm_id, ffa_func_id(ffa_ret));
 			break;
 		}
 
-		destination = ffa_dir_msg_dest(ffa_ret);
+		if (ffa_func_id(ffa_ret) == FFA_INTERRUPT) {
+			/*
+			 * Received FFA_INTERRUPT in waiting state.
+			 * The interrupt id is passed although this is just
+			 * informational as we're running with virtual
+			 * interrupts unmasked and the interrupt is processed
+			 * by the interrupt handler.
+			 */
+			ffa_ret = ffa_msg_wait();
+			continue;
+		}
 
+		destination = ffa_dir_msg_dest(ffa_ret);
 		if (destination != vm_id) {
 			ERROR("%s(%u) invalid vm id 0x%x\n",
 				__func__, vm_id, destination);