feat(notifications): bitmap create at vm load

Hypervisor call FFA_NOTIFICATION_BITMAP_CREATE when loading VMs, to
request SPMC to create bitmap for NWd VMs.
If Hafnium built as SPMC the referred call at load is bypassed.
Adding this to Hypervisor's initialization will allow full notifications
signaling flow with a testing set-up including Hypervisor and SPMC.

Change-Id: I14abd59202ff1246280642262984ca91801ae4bc
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/load.c b/src/load.c
index 1e6031b..e7f3085 100644
--- a/src/load.c
+++ b/src/load.c
@@ -11,6 +11,7 @@
 #include <stdbool.h>
 
 #include "hf/arch/other_world.h"
+#include "hf/arch/plat/ffa.h"
 #include "hf/arch/vm.h"
 
 #include "hf/api.h"
@@ -137,6 +138,8 @@
 	vm_locked.vm->uuid = manifest_vm->partition.uuid;
 
 	if (manifest_vm->is_ffa_partition) {
+		struct ffa_value bitmap_create_res;
+
 		/* Link rxtx buffers to mailbox */
 		if (manifest_vm->partition.rxtx.available) {
 			if (!link_rxtx_to_mailbox(stage1_locked, vm_locked,
@@ -162,6 +165,20 @@
 
 		/* TODO: Enable in accordance to VM's manifest. */
 		vm_locked.vm->notifications.enabled = true;
+
+		/* TODO: check if notifications is enabled for the given vm */
+		if (plat_ffa_notifications_bitmap_create_call(
+			    vm_locked.vm->id, vm_locked.vm->vcpu_count,
+			    &bitmap_create_res)) {
+			if (bitmap_create_res.func == FFA_ERROR_32) {
+				dlog_verbose(
+					"Failed to create notifications bitmap "
+					"to VM: %#x; error: %#x.\n",
+					vm_locked.vm->id,
+					ffa_error_code(bitmap_create_res));
+				return false;
+			}
+		}
 	}
 
 	/* Initialize architecture-specific features. */