feat(ipi): handle IPI for waiting case
In the case the target vCPU is in the waiting
state set the interrupt as pending on the vCPU as part
of the standard secure interrupt handling and in addition then
trigger an SRI to notify the NWd to schedule it.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I98d0024931aeb6307637c929708328674cc66b66
diff --git a/src/hf_ipi.c b/src/hf_ipi.c
index b0221a1..5b993a8 100644
--- a/src/hf_ipi.c
+++ b/src/hf_ipi.c
@@ -8,6 +8,8 @@
#include "hf/hf_ipi.h"
+#include "hf/arch/plat/ffa.h"
+
#include "hf/cpu.h"
#include "hf/plat/interrupts.h"
@@ -59,6 +61,8 @@
* IPI IRQ specific handling for the secure interrupt for each vCPU state:
* - RUNNING: Continue secure interrupt handling as normal, injecting
* a virtual interrupt to the vCPU.
+ * - WAITING: Mark the IPI as complete from the SPMC perspective and
+ * trigger an SRI so the NWd can schedule to target vCPU to run.
* - Other states are not currently supported so exit the handler.
* Returns True if the IPI SGI has been handled.
* False if further secure interrupt handling is required.
@@ -70,6 +74,15 @@
switch (target_vcpu->state) {
case VCPU_STATE_RUNNING:
return false;
+ case VCPU_STATE_WAITING:
+ /*
+ * We consider the IPI handled from an SPMC perspective
+ * so inform the interrupt controller, this means other
+ * interrupts may occur.
+ */
+ plat_interrupts_end_of_interrupt(HF_IPI_INTID);
+ plat_ffa_sri_trigger_not_delayed(target_vcpu->cpu);
+ return true;
default:
dlog_verbose(
"IPIs not currently supported for when the target_vcpu "