refactor(notifications): drop the SRI state
The SPMC defined a state machine to track when the SRI
had been signaled to the normal world until it has been
handled. It was considered to be handled when the SPMC
received an FFA_NOTIFICATION_INFO_GET ABI call, as it
was meant to be called whilst handling the SRI.
The intent of the state machine was to avoid having
multiple interrupts in the NWd, due to the SRI SGI
being sent concurrently in two different CPUs.
The referred state machine is dropped in this patch, given
that the worst it could happend in the described scenario
is that the last call to FFA_NOTIFICATION_INFO_GET receives
an empty list of partitions in need of CPU cycles.
Handling multiple SRI in the NWd is preferred compared to
missing the SRI being sent after a while.
This change also simplifies the implementation.
BREAKING: FF-A driver may need adjustment to cope with
multiple SRI interrupts firing at different CPUs.
Change-Id: I258ac9d303306b21c0341efbadb4fc8d3b7104a4
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/inc/hf/arch/plat/ffa.h b/inc/hf/arch/plat/ffa.h
index 6735907..5ded40e 100644
--- a/inc/hf/arch/plat/ffa.h
+++ b/inc/hf/arch/plat/ffa.h
@@ -15,44 +15,6 @@
#include "hf/vcpu.h"
#include "hf/vm.h"
-/**
- * The following enum relates to a state machine to guide the handling of the
- * Scheduler Receiver Interrupt.
- * The SRI is used to signal the receiver scheduler that there are pending
- * notifications for the receiver, and it is sent when there is a valid call to
- * FFA_NOTIFICATION_SET.
- * The FFA_NOTIFICATION_INFO_GET interface must be called in the SRI handler,
- * after which the FF-A driver should process the returned list, and request
- * the receiver scheduler to give the receiver CPU cycles to process the
- * notification.
- * The use of the following state machine allows for synchronized sending
- * and handling of the SRI, as well as avoiding the occurrence of spurious
- * SRI. A spurious SRI would be one such that upon handling a call to
- * FFA_NOTIFICATION_INFO_GET would return error FFA_NO_DATA, which is plausible
- * in an MP system.
- * The state machine also aims at resolving the delay of the SRI by setting
- * flag FFA_NOTIFICATIONS_FLAG_DELAY_SRI in the arguments of the set call. By
- * delaying, the SRI is sent in context switching to the primary endpoint.
- * The SPMC is implemented under the assumption the receiver scheduler is a
- * NWd endpoint, hence the SRI is triggered at the world switch.
- * If concurrently another notification is set that requires immediate action,
- * the SRI is triggered immediately within that same execution context.
- *
- * HANDLED is the initial state, and means a new SRI can be sent. The following
- * state transitions are possible:
- * * HANDLED => DELAYED: Setting notification, and requesting SRI delay.
- * * HANDLED => TRIGGERED: Setting notification, and not requesting SRI delay.
- * * DELAYED => TRIGGERED: SRI was delayed, and the context switch to the
- * receiver scheduler is being done.
- * * DELAYED => HANDLED: the scheduler called FFA_NOTIFICATION_INFO_GET.
- * * TRIGGERED => HANDLED: the scheduler called FFA_NOTIFICATION_INFO_GET.
- */
-enum plat_ffa_sri_state {
- HANDLED = 0,
- DELAYED,
- TRIGGERED,
-};
-
/** Returns the SPMC ID. */
struct ffa_value plat_ffa_spmc_id_get(void);
@@ -199,9 +161,6 @@
uint32_t *lists_count,
uint32_t ids_count_max);
-/** Helper to set SRI current state. */
-void plat_ffa_sri_state_set(enum plat_ffa_sri_state state);
-
/**
* Helper to send SRI and safely update `ffa_sri_state`, if there has been
* a call to FFA_NOTIFICATION_SET, and the SRI has been delayed.
@@ -216,6 +175,12 @@
void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu);
/**
+ * Track that in current CPU there was a notification set with delay SRI
+ * flag.
+ */
+void plat_ffa_sri_set_delayed(struct cpu *cpu);
+
+/**
* Initialize Schedule Receiver Interrupts needed in the context of
* notifications support.
*/
diff --git a/inc/hf/cpu.h b/inc/hf/cpu.h
index a80431d..ac1f7d5 100644
--- a/inc/hf/cpu.h
+++ b/inc/hf/cpu.h
@@ -28,6 +28,9 @@
/** Determines whether the CPU is currently on. */
bool is_on;
+
+ /* In case there is a pending SRI for the NWd. */
+ bool is_sri_delayed;
};
void cpu_module_init(const cpu_id_t *cpu_ids, size_t count);