SPCI: Donate memory architected message.
The donate mechnism accepts a single memory region as per the spec but
restrics the number of constituents of this regions to 1.
Multiple constituents will be introduced in a later commit.
Change-Id: I7af9b80068060aedb953d3e204fa3e03c9ccc438
diff --git a/src/vm.c b/src/vm.c
index f1b79e6..fd477cd 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -102,6 +102,21 @@
}
/**
+ * Locks two VMs ensuring that the locking order is according to the locks'
+ * addresses.
+ */
+struct two_vm_locked vm_lock_both(struct vm *vm1, struct vm *vm2)
+{
+ struct two_vm_locked dual_lock;
+
+ sl_lock_both(&vm1->lock, &vm2->lock);
+ dual_lock.vm1.vm = vm1;
+ dual_lock.vm2.vm = vm2;
+
+ return dual_lock;
+}
+
+/**
* Unlocks a VM previously locked with vm_lock, and updates `locked` to reflect
* the fact that the VM is no longer locked.
*/