feat(notifications): notifications set and get

Handle FF-A calls FFA_NOTIFICATION_SET and FFA_NOTIFICATION_GET.
The former is used for a sender to signal a notification to the
receiver; the latter is for the receiver to get whichever notifications
there are pending.

Change-Id: I7e9db94201d0d78ceecd599cd350eeb37a8cb1f8
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/inc/hf/api.h b/inc/hf/api.h
index be3903d..59755a4 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -106,3 +106,11 @@
 	ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
 	ffa_notifications_bitmap_t notifications, bool is_bind,
 	struct vcpu *current);
+
+struct ffa_value api_ffa_notification_set(
+	ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
+	ffa_notifications_bitmap_t notifications, struct vcpu *current);
+
+struct ffa_value api_ffa_notification_get(ffa_vm_id_t receiver_vm_id,
+					  uint16_t vcpu_id, uint32_t flags,
+					  struct vcpu *current);
diff --git a/inc/hf/arch/plat/ffa.h b/inc/hf/arch/plat/ffa.h
index 2b55f1b..bffc84d 100644
--- a/inc/hf/arch/plat/ffa.h
+++ b/inc/hf/arch/plat/ffa.h
@@ -35,6 +35,16 @@
 					  ffa_vm_id_t sender_id,
 					  ffa_vm_id_t receiver_id);
 
+bool plat_ffa_is_notification_set_valid(struct vcpu *current,
+					ffa_vm_id_t sender_id,
+					ffa_vm_id_t receiver_id);
+
+bool plat_ffa_is_notification_get_valid(struct vcpu *current,
+					ffa_vm_id_t receiver_id);
+
+bool plat_ffa_notifications_get_call(ffa_vm_id_t receiver_id, uint32_t vcpu_id,
+				     uint32_t flags, struct ffa_value *ret);
+
 /**
  * Checks whether managed exit is supported by given SP.
  */
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index 7014799..c9bbebc 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -247,3 +247,9 @@
 				      bool is_from_vm, ffa_vm_id_t sender_id,
 				      ffa_notifications_bitmap_t notifications,
 				      bool is_per_vcpu);
+void vm_notifications_set(struct vm_locked vm_locked, bool is_from_vm,
+			  ffa_notifications_bitmap_t notifications,
+			  ffa_vcpu_index_t vcpu_id, bool is_per_vcpu);
+ffa_notifications_bitmap_t vm_notifications_get_pending_and_clear(
+	struct vm_locked vm_locked, bool is_from_vm,
+	ffa_vcpu_index_t cur_vcpu_id);