feat(notifications): state structures and initialization
Defined the structures to keep track of Notifications state within
hafnium:
- 'struct notifications' keeps track of notification bindings, and
respective states (referring to 'struct notifications_state').
- 'struct notifications_state' keeps track of pending notifications and
those retrieved by the scheduler using FFA_NOTIFICATIONS_INFO_GET.
- Initialization of notifications structure, to allow for the
implementation of the notifications related FF-A calls.
The SPMC is responsible for maintaining the state of VM's notifications
from SPs. Reused 'struct vm' to represent NWd VMs, for simplicity and
scalability.
Change-Id: Id222aa0f6a11a29009668cfbae4edc067afd9130
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/vm.c b/src/vm.c
index 1c67166..e321121 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -11,6 +11,7 @@
#include "hf/api.h"
#include "hf/check.h"
#include "hf/cpu.h"
+#include "hf/dlog.h"
#include "hf/ffa.h"
#include "hf/layout.h"
#include "hf/plat/iommu.h"
@@ -77,6 +78,13 @@
vcpu_init(vm_get_vcpu(vm, i), vm);
}
+ /* Basic initialization of the notifications structure. */
+ vm_notifications_init_bindings(&vm->notifications.from_sp);
+ vm_notifications_init_bindings(&vm->notifications.from_vm);
+
+ /* TODO: Enable in accordance to VM's manifest. */
+ vm->notifications.enabled = true;
+
return vm;
}
@@ -361,3 +369,13 @@
vm->next_boot = current;
}
+
+/*
+ * Initializes the notifications structure.
+ */
+void vm_notifications_init_bindings(struct notifications *notifications)
+{
+ for (uint32_t i = 0U; i < MAX_FFA_NOTIFICATIONS; i++) {
+ notifications->bindings_sender_id[i] = HF_INVALID_VM_ID;
+ }
+}