SPCI: memory relinquish.

The relinquish mechnism implementation accepts a single memory region
with a single constituent.
Multiple memory region and constituent support will be introduced in
a later commit.

Change-Id: I9588ae597fd56336da135522b74e4a42e4514042
diff --git a/inc/vmapi/hf/spci.h b/inc/vmapi/hf/spci.h
index 99664ed..a6d9c68 100644
--- a/inc/vmapi/hf/spci.h
+++ b/inc/vmapi/hf/spci.h
@@ -48,6 +48,7 @@
 
 /* Architected memory sharing message IDs. */
 enum spci_memory_share {
+	SPCI_MEMORY_RELINQUISH = 0x1,
 	SPCI_MEMORY_DONATE = 0x2,
 };
 
@@ -288,3 +289,26 @@
 	spci_memory_region_add(message, handle, region_constituents,
 			       num_elements);
 }
+
+/**
+ * Construct the SPCI memory region relinquish message.
+ * A set of memory regions can be given back to the owner.
+ */
+static inline void spci_memory_relinquish(
+	struct spci_message *message, spci_vm_id_t target_vm_id,
+	spci_vm_id_t source_vm_id,
+	struct spci_memory_region_constituent *region_constituents,
+	uint64_t num_elements, uint32_t handle)
+{
+	int32_t message_length;
+
+	message_length = sizeof(struct spci_architected_message_header);
+
+	/* Fill in the details on the common message header. */
+	spci_architected_message_init(message, message_length, target_vm_id,
+				      source_vm_id, SPCI_MEMORY_RELINQUISH);
+
+	/* Create single memory region. */
+	spci_memory_region_add(message, handle, region_constituents,
+			       num_elements);
+}