refactor: handling of FFA_INTERRUPT ABI

This is the first patch attempting to simplify further
the handling of secure interrupts.

The ABI FFA_INTERRUPT should be invoked at the non-secure
FF-A instance, when the NWd is preempted by a secure interrupt.

In case the target SP is not ready to handle the interrupt
the function plat_ffa_handle_secure_interrupt could
return FFA_NORMAL_WORLD_RESUME.

The referred function is also used in the handler of irqs,
and in such case the ffa_value is not relevant.

So in attempt to simplify things further, the return ABI
FFA_NORMAL_WORLD_RESUME is moved explicitly to the handling
of FFA_INTERRUPT:
- If an SP is dispatched at the handling of FFA_INTERRUPT,
the NWd will eventually receive the ABI resultant from the
call used by the SP to go back to waiting state. In other words
the FFA_NORMAL_WORLD_RESUME ABI will be overwritten.
- If the SP is not dispatched then the FFA_NORMAL_WORLD_RESUME
ABI used for the SPMD to dispatch the NWd.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I1efc003bd2c7baeffcae0a59dc2429d2ffb151fa
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 231d374..390b555 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -715,7 +715,20 @@
 			*args = ffa_error(FFA_DENIED);
 			return true;
 		}
-		*args = plat_ffa_handle_secure_interrupt(current, next);
+
+		plat_ffa_handle_secure_interrupt(current, next);
+
+		/*
+		 * If the next vCPU belongs to an SP, the next time the NWd
+		 * gets resumed these values will be overwritten by the ABI
+		 * that used to handover execution back to the NWd.
+		 * If the NWd is to be resumed from here, then it will
+		 * receive the FFA_NORMAL_WORLD_RESUME ABI which is to signal
+		 * that an interrupt has occured, thought it wasn't handled.
+		 * This happens when the target vCPU was in preempted state,
+		 * and the SP couldn't not be resumed to handle the interrupt.
+		 */
+		*args = (struct ffa_value){.func = FFA_NORMAL_WORLD_RESUME};
 		return true;
 	case FFA_CONSOLE_LOG_32:
 	case FFA_CONSOLE_LOG_64: