feat(interrupts): trigger SRI if vCPU waiting
Use the `sri-policy` option from the parititon
manifest SRI_POLICY_SEC_INT_WAITING.
If the target vCPU is in the waiting state, the
SPMC will trigger the SRI for the NWd at the next
world switch back.
Still missing the change to FFA_NOTIFICATION_INFO_GET.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I9b3e0015af5daffea3aa310e1667a1ac77d2e21d
diff --git a/src/ffa/spmc/interrupts.c b/src/ffa/spmc/interrupts.c
index 4a033e1..724ed53 100644
--- a/src/ffa/spmc/interrupts.c
+++ b/src/ffa/spmc/interrupts.c
@@ -14,6 +14,7 @@
#include "hf/api.h"
#include "hf/check.h"
#include "hf/ffa/direct_messaging.h"
+#include "hf/ffa/notifications.h"
#include "hf/ffa/vm.h"
#include "hf/hf_ipi.h"
#include "hf/vm.h"
@@ -260,8 +261,18 @@
/* Secure interrupt signaling and queuing for SP. */
switch (target_vcpu->state) {
case VCPU_STATE_WAITING:
- next = interrupt_resume_waiting(current_locked,
- target_vcpu_locked, v_intid);
+ if (!target_vcpu->vm->sri_policy.intr_while_waiting) {
+ next = interrupt_resume_waiting(
+ current_locked, target_vcpu_locked, v_intid);
+ } else {
+ dlog_verbose(
+ "%s: SP is waiting, SRI delayed due to "
+ "interrupt. Partition %x, vcpu %x, interrupt "
+ "%x\n",
+ __func__, target_vcpu->vm->id,
+ vcpu_index(target_vcpu), v_intid);
+ ffa_notifications_sri_set_delayed(target_vcpu->cpu);
+ }
break;
case VCPU_STATE_BLOCKED:
if (!target_vcpu->vm->el0_partition &&