fix(interrupts): implicit secure interrupt completion signal

Per FF-A v1.1-Beta0 spec section 8.3, an SP can use multiple
mechanisms to signal completion of secure interrupt handling. SP
can invoke explicit FF-A ABIs, namely FFA_MSG_WAIT and FFA_RUN,
when in WAITING/BLOCKED state respectively, but has to perform
implicit signal completion mechanism by dropping the priority
of the virtual secure interrupt when SPMC signaled the virtual
interrupt in other execution context states such as RUNNING
and PREEMPTED.

This patch introduces a new variable that helps SPMC to keep a track
of such mechanism and perform appropriate bookkeeping.

It removes the existing limitation:
SPMC signals virtual interrupt to an SP in PREEMPTED state(such as
when processing a direct message request but got preempted by a
Self S-Int) and resumed the SP vCPU but SPMC temporarily held the
priority thereby not allowing secure physical interrupts to be
delivered to CPU interface till the SP sent a corresponding direct
message response. Ideally, SPMC should have considered the para-
virtualized de-activation(and priority drop) HVC call as an implicit
signal completion mechanism and relax the priority threshold.

Change-Id: I7fd16d4621a26839de1ce54b9a3535224a473051
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 6fe3179..c71894d 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -580,6 +580,14 @@
 		if (current->processing_secure_interrupt) {
 			CHECK(current->state == VCPU_STATE_WAITING);
 
+			/*
+			 * This flag should not have been set by SPMC when it
+			 * signaled the virtual interrupt to the SP while SP was
+			 * in WAITING or BLOCKED states. Refer the embedded
+			 * comment in vcpu.h file for further description.
+			 */
+			assert(!current->implicit_completion_signal);
+
 			/* Secure interrupt pre-empted normal world. */
 			if (current->preempted_vcpu->vm->id ==
 			    HF_OTHER_WORLD_ID) {