refactor(notifications): set functions
Refactor notifications set functions from vm module to prepare for
adding framework notifications.
Change-Id: I7cf463bddbffcac7c4b8642e57854b0c9cd4bf4d
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/api.c b/src/api.c
index 2b0a352..594c9e8 100644
--- a/src/api.c
+++ b/src/api.c
@@ -3038,8 +3038,10 @@
}
/* Set notifications pending. */
- vm_notifications_set(receiver_locked, plat_ffa_is_vm_id(sender_vm_id),
- notifications, vcpu_id, is_per_vcpu);
+ vm_notifications_partition_set_pending(
+ receiver_locked, plat_ffa_is_vm_id(sender_vm_id), notifications,
+ vcpu_id, is_per_vcpu);
+
dlog_verbose("Set the notifications: %x.\n", notifications);
if ((FFA_NOTIFICATIONS_FLAG_DELAY_SRI & flags) == 0) {
diff --git a/src/vm.c b/src/vm.c
index 0b3c124..ada5d80 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -683,9 +683,10 @@
: (to_check->bindings_per_vcpu & notif) == 0U;
}
-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)
+void vm_notifications_partition_set_pending(
+ struct vm_locked vm_locked, bool is_from_vm,
+ ffa_notifications_bitmap_t notifications, ffa_vcpu_index_t vcpu_id,
+ bool is_per_vcpu)
{
CHECK(vm_locked.vm != NULL);
struct notifications *to_set =
diff --git a/src/vm_test.cc b/src/vm_test.cc
index 0ffacb9..cffe5e6 100644
--- a/src/vm_test.cc
+++ b/src/vm_test.cc
@@ -305,8 +305,8 @@
/*
* Validate get notifications bitmap for global notifications.
*/
- vm_notifications_set(current_vm_locked, is_from_vm, global, 0ull,
- false);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ global, 0ull, false);
ret = vm_notifications_partition_get_pending(current_vm_locked,
is_from_vm, 0ull);
@@ -316,8 +316,8 @@
/*
* Validate get notifications bitmap for per-vCPU notifications.
*/
- vm_notifications_set(current_vm_locked, is_from_vm, per_vcpu, vcpu_idx,
- true);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ per_vcpu, vcpu_idx, true);
ret = vm_notifications_partition_get_pending(current_vm_locked,
is_from_vm, vcpu_idx);
@@ -328,10 +328,10 @@
* Validate that getting notifications for a specific vCPU also returns
* global notifications.
*/
- vm_notifications_set(current_vm_locked, is_from_vm, per_vcpu, vcpu_idx,
- true);
- vm_notifications_set(current_vm_locked, is_from_vm, global, 0ull,
- false);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ per_vcpu, vcpu_idx, true);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ global, 0ull, false);
ret = vm_notifications_partition_get_pending(current_vm_locked,
is_from_vm, vcpu_idx);
@@ -374,8 +374,8 @@
¤t_vm->notifications.from_sp;
const bool is_from_vm = false;
- vm_notifications_set(current_vm_locked, is_from_vm, to_set, 0,
- false);
+ vm_notifications_partition_set_pending(
+ current_vm_locked, is_from_vm, to_set, 0, false);
vm_notifications_info_get_pending(
current_vm_locked, is_from_vm, ids, &ids_count,
@@ -438,8 +438,8 @@
¤t_vm->notifications.from_sp;
const bool is_from_vm = false;
- vm_notifications_set(current_vm_locked, is_from_vm, per_vcpu, 0,
- true);
+ vm_notifications_partition_set_pending(
+ current_vm_locked, is_from_vm, per_vcpu, 0, true);
vm_notifications_info_get_pending(
current_vm_locked, is_from_vm, ids, &ids_count,
@@ -505,8 +505,9 @@
notifications = ¤t_vm->notifications.from_sp;
for (unsigned int i = 0; i < vcpu_count; i++) {
- vm_notifications_set(current_vm_locked, is_from_sp,
- FFA_NOTIFICATION_MASK(i), i, true);
+ vm_notifications_partition_set_pending(
+ current_vm_locked, is_from_sp, FFA_NOTIFICATION_MASK(i),
+ i, true);
}
/*
@@ -514,7 +515,8 @@
* because global notifications only require the VM ID to be included in
* the list, at least once.
*/
- vm_notifications_set(current_vm_locked, is_from_sp, global, 0, false);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_sp,
+ global, 0, false);
vm_notifications_info_get_pending(current_vm_locked, is_from_sp, ids,
&ids_count, lists_sizes, &lists_count,
@@ -582,8 +584,9 @@
enum notifications_info_get_state current_state = INIT;
CHECK(vm_get_count() >= 2);
- vm_notifications_set(current_vm_locked, is_from_vm,
- FFA_NOTIFICATION_MASK(1), 0, true);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ FFA_NOTIFICATION_MASK(1), 0,
+ true);
/* Call function to get notifications info, with only per-vCPU set. */
vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids,
@@ -610,8 +613,9 @@
current_state = INIT;
/* Setting global notification */
- vm_notifications_set(current_vm_locked, is_from_vm,
- FFA_NOTIFICATION_MASK(2), 0, false);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ FFA_NOTIFICATION_MASK(2), 0,
+ false);
vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids,
&ids_count, lists_sizes, &lists_count,
@@ -661,8 +665,9 @@
notifications = ¤t_vm->notifications.from_sp;
/* Set global notification. */
- vm_notifications_set(current_vm_locked, is_from_vm,
- FFA_NOTIFICATION_MASK(10), 0, false);
+ vm_notifications_partition_set_pending(current_vm_locked, is_from_vm,
+ FFA_NOTIFICATION_MASK(10), 0,
+ false);
/* Get notifications info for the given notifications. */
vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids,