feat(ffa): secure interrupt management in SWd
This patch adds support for secure interrupt management while running
in secure world.
The secure interrupt is delegated to target secure partition where the
interrupt gets handled appropriately.
As detailed in the section titled "Secure Interrupt Signaling mechanism"
in the FF-A v1.1 spec, we leverage ERET and vIRQ conduits for interrupt
delegation.
In the current iteration, we only support S-EL1 partitions.
Change-Id: Ifd4d0ca3fec8f2ffef4c2d695b073a536aa97a28
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 4f75aec..e9d277c 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -971,6 +971,19 @@
struct vcpu *irq_lower(void)
{
+#if SECURE_WORLD == 1
+ struct vcpu *next = NULL;
+
+ plat_ffa_secure_interrupt(current(), &next);
+
+ /*
+ * Since we are in interrupt context, set the bit for the
+ * next vCPU directly in the register.
+ */
+ vcpu_update_virtual_interrupts(next);
+
+ return next;
+#else
/*
* Switch back to primary VM, interrupts will be handled there.
*
@@ -981,6 +994,7 @@
* TODO: Only switch when the interrupt isn't for the current VM.
*/
return api_preempt(current());
+#endif
}
struct vcpu *fiq_lower(void)
@@ -1016,17 +1030,18 @@
/* Resume current vCPU. */
return NULL;
}
-
/*
* SP does not support managed exit. It is pre-empted and execution
- * handed back to the normal world through the FFA_INTERRUPT ABI.
- * The SP can be resumed later by ffa_run. The call to irq_lower
- * and api_preempt is equivalent to calling api_switch_to_other_world
- * for current vCPU passing FFA_INTERRUPT_32.
+ * handed back to the normal world through the FFA_INTERRUPT ABI. The
+ * api_preempt() call is equivalent to calling api_switch_to_other_world
+ * for current vCPU passing FFA_INTERRUPT. The SP can be resumed later
+ * by FFA_RUN.
*/
-#endif
+ return api_preempt(current_vcpu);
+#else
return irq_lower();
+#endif
}
noreturn struct vcpu *serr_lower(void)