Add typedef for SPCI cookie.

Bug: 132420445
Change-Id: Ic0a8269dae33100036d4a937adf3c02ab28809dc
diff --git a/inc/hf/api.h b/inc/hf/api.h
index d6de2cb..9de3928 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -63,13 +63,11 @@
 struct spci_value api_spci_mem_send(uint32_t share_func, ipaddr_t address,
 				    uint32_t page_count,
 				    uint32_t fragment_length, uint32_t length,
-				    uint32_t cookie, struct vcpu *current,
+				    spci_cookie_t cookie, struct vcpu *current,
 				    struct vcpu **next);
-struct spci_value api_spci_mem_retrieve_req(ipaddr_t address,
-					    uint32_t page_count,
-					    uint32_t fragment_length,
-					    uint32_t length, uint32_t cookie,
-					    struct vcpu *current);
+struct spci_value api_spci_mem_retrieve_req(
+	ipaddr_t address, uint32_t page_count, uint32_t fragment_length,
+	uint32_t length, spci_cookie_t cookie, struct vcpu *current);
 struct spci_value api_spci_mem_relinquish(struct vcpu *current);
 struct spci_value api_spci_mem_reclaim(uint32_t handle, uint32_t flags,
 				       struct vcpu *current);
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index f3557b6..5642683 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -133,7 +133,7 @@
 
 static inline struct spci_value spci_mem_donate(uint32_t fragment_length,
 						uint32_t length,
-						uint32_t cookie)
+						spci_cookie_t cookie)
 {
 	return spci_call((struct spci_value){.func = SPCI_MEM_DONATE_32,
 					     .arg3 = fragment_length,
@@ -142,7 +142,8 @@
 }
 
 static inline struct spci_value spci_mem_lend(uint32_t fragment_length,
-					      uint32_t length, uint32_t cookie)
+					      uint32_t length,
+					      spci_cookie_t cookie)
 {
 	return spci_call((struct spci_value){.func = SPCI_MEM_LEND_32,
 					     .arg3 = fragment_length,
@@ -151,7 +152,8 @@
 }
 
 static inline struct spci_value spci_mem_share(uint32_t fragment_length,
-					       uint32_t length, uint32_t cookie)
+					       uint32_t length,
+					       spci_cookie_t cookie)
 {
 	return spci_call((struct spci_value){.func = SPCI_MEM_SHARE_32,
 					     .arg3 = fragment_length,
@@ -161,7 +163,7 @@
 
 static inline struct spci_value spci_mem_retrieve_req(uint32_t fragment_length,
 						      uint32_t length,
-						      uint32_t cookie)
+						      spci_cookie_t cookie)
 {
 	return spci_call((struct spci_value){.func = SPCI_MEM_RETRIEVE_REQ_32,
 					     .arg3 = fragment_length,
diff --git a/inc/vmapi/hf/spci.h b/inc/vmapi/hf/spci.h
index 0422415..9c10acf 100644
--- a/inc/vmapi/hf/spci.h
+++ b/inc/vmapi/hf/spci.h
@@ -169,9 +169,20 @@
 
 /** The ID of a VM. These are assigned sequentially starting with an offset. */
 typedef uint16_t spci_vm_id_t;
+
+/**
+ * A globally-unique ID assigned by the hypervisor for a region of memory being
+ * sent between VMs.
+ */
 typedef uint32_t spci_memory_handle_t;
 
 /**
+ * A unique-per-VM ID used to associate fragments of a memory sharing message,
+ * assigned by the sender of the message.
+ */
+typedef uint32_t spci_cookie_t;
+
+/**
  * A count of VMs. This has the same range as the VM IDs but we give it a
  * different name to make the different semantics clear.
  */
diff --git a/src/api.c b/src/api.c
index 981fd5d..8f8272e 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1451,7 +1451,7 @@
 struct spci_value api_spci_mem_send(uint32_t share_func, ipaddr_t address,
 				    uint32_t page_count,
 				    uint32_t fragment_length, uint32_t length,
-				    uint32_t cookie, struct vcpu *current,
+				    spci_cookie_t cookie, struct vcpu *current,
 				    struct vcpu **next)
 {
 	struct vm *from = current->vm;
@@ -1588,11 +1588,9 @@
 	return ret;
 }
 
-struct spci_value api_spci_mem_retrieve_req(ipaddr_t address,
-					    uint32_t page_count,
-					    uint32_t fragment_length,
-					    uint32_t length, uint32_t cookie,
-					    struct vcpu *current)
+struct spci_value api_spci_mem_retrieve_req(
+	ipaddr_t address, uint32_t page_count, uint32_t fragment_length,
+	uint32_t length, spci_cookie_t cookie, struct vcpu *current)
 {
 	struct vm *to = current->vm;
 	struct vm_locked to_locked;