feat(ffa): resume execution after interrupt completion

This patch adds plat_ffa_normal_world_resume() function that invokes
FFA_NORMAL_WORLD_RESUME ABI to request SPMD to resume execution
of normal world on current PE.

This patch also adds plat_ffa_preempted_vcpu_resume() helper function
that resumes a SP on current PE if SP was pre-empted by a secure
interrupt.

Moreover, this patch also performs many CHECKS related to secure
interrupt handling.

Change-Id: Ia7d5bd5b2ca4bdf1a29b73031ca6efc8563aaf36
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index cad9392..2e3b4b2 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -535,6 +535,25 @@
 		if (sp_boot_next(current, next, args)) {
 			return true;
 		}
+
+		/* Refer FF-A v1.1 Beta0 section 7.4 bullet 2. */
+		if (current->processing_secure_interrupt) {
+			CHECK(current->state = VCPU_STATE_WAITING);
+
+			/* Secure interrupt pre-empted normal world. */
+			if (current->preempted_vcpu->vm->id ==
+			    HF_OTHER_WORLD_ID) {
+				*args = plat_ffa_normal_world_resume(current,
+								     next);
+			} else {
+				/*
+				 * Secure interrupt pre-empted an SP. Resume it.
+				 */
+				*args = plat_ffa_preempted_vcpu_resume(current,
+								       next);
+			}
+			return true;
+		}
 #endif
 		*args = api_ffa_msg_recv(true, current, next);
 		return true;