feat: find vm and returned it locked
Change-Id: I05f1e21a5e60ff1e9e138e43c5e08cb6c04a455f
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/vm.c b/src/vm.c
index e321121..635b3d1 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -136,6 +136,20 @@
}
/**
+ * Returns a locked instance of the VM with the corresponding id.
+ */
+struct vm_locked vm_find_locked(ffa_vm_id_t id)
+{
+ struct vm *vm = vm_find(id);
+
+ if (vm != NULL) {
+ return vm_lock(vm);
+ }
+
+ return (struct vm_locked){.vm = NULL};
+}
+
+/**
* Returns a pointer to the VM at the specified index.
*/
struct vm *vm_find_index(uint16_t index)