feat: check if a partition is discoverable during its lifetime
This patch adds provision to check if a partition is discoverable during
its lifetime through FFA_PARTITION_INFO_GET interface. A partition
becomes undiscoverable if all its execution contexts have moved to NULL
state.
Change-Id: I99adfbc7eccaaf1dc3cf13a68fcff8f5c86fad02
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/api.c b/src/api.c
index 705834c..4032655 100644
--- a/src/api.c
+++ b/src/api.c
@@ -550,6 +550,10 @@
for (ffa_vm_count_t vm_idx = 0; vm_idx < vm_get_count(); vm_idx++) {
struct vm *vm = vm_find_index(vm_idx);
+ if (!vm_is_discoverable(vm)) {
+ continue;
+ }
+
for (size_t uuid_idx = 0; uuid_idx < PARTITION_MAX_UUIDS;
uuid_idx++) {
struct ffa_uuid uuid = vm->uuids[uuid_idx];
diff --git a/src/vm.c b/src/vm.c
index 446f6cf..9dd9fe9 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1490,3 +1490,11 @@
return ret;
}
+
+/**
+ * If a VM is not in NULL state, then it is discoverable.
+ */
+bool vm_is_discoverable(struct vm *vm)
+{
+ return vm_read_state(vm) != VM_STATE_NULL;
+}