feat(notifications): set successful return value on NPI injection
FFA_RUN run-time model v1.1 expects transition from waiting to running
state by ERET(FFA_RUN) (FF-A v1.1 EAC0_RC0 chapter 7.2).
When injecting Notification Pending Interrupt (NPI) the return value
was not explicitly set, keeping the placeholder set by previous
FFA_MSG_WAIT call. That placeholder is an FFA_ERROR(FFA_INTERRUPTED),
meaningful if the waiting partition is waken up by an unexpected
interrupt.
Change-Id: Icb70bf41662f1c4763e55c79a136f605d739c65a
Signed-off-by: Federico Recanati <federico.recanati@arm.com>
diff --git a/src/api.c b/src/api.c
index 35ae4c2..b4055ed 100644
--- a/src/api.c
+++ b/src/api.c
@@ -823,6 +823,20 @@
if (!vm_locked.vm->el0_partition &&
plat_ffa_inject_notification_pending_interrupt(
vcpu_locked, current, vm_locked)) {
+ /* TODO: setting a return value to override
+ * the placeholder (FFA_ERROR(INTERRUPTED))
+ * set by FFA_MSG_WAIT. FF-A v1.1 allows
+ * FFA_MSG_WAIT to successfully return even if
+ * it didn't receive a message. TFTF tests are
+ * still expecting an FFA_ERROR instead,
+ * should be fixed?
+ */
+ arch_regs_set_retval(
+ &vcpu->regs,
+ (struct ffa_value){.func = FFA_RUN_32,
+ // TODO: does it make sense
+ // to set vCPU/receiver?
+ .arg1 = 0});
break;
}