fix(interrupts): check for pending interrupts during direct response

A secure interrupt might trigger while the target SP is currently
running to send a direct response. SPMC would then inject virtual
interrupt to vCPU of target SP and resume it.
However, it is possible that the S-EL1 SP could have its interrupts
masked and hence might not handle the virtual interrupt before
sending direct response message. In such a scenario, SPMC must
return an error with code FFA_INTERRUPTED to inform the S-EL1 SP of
a pending interrupt and allow it to be handled before sending the
direct response.

Change-Id: I8a4517a929799f29e9eba01dab0fd9b8b538b2db
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/api.c b/src/api.c
index 461fdd3..2c6fa76 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2706,6 +2706,10 @@
 		return ffa_error(FFA_DENIED);
 	}
 
+	if (plat_ffa_is_direct_response_interrupted(current)) {
+		return ffa_error(FFA_INTERRUPTED);
+	}
+
 	assert(next_state == VCPU_STATE_WAITING);
 	current_locked = vcpu_lock(current);