Implement SPCI pull model for memory sharing.
Bug: 132420445
Change-Id: Iac21d7949bc54da13a4f25a317f5e83b2727638c
diff --git a/inc/hf/api.h b/inc/hf/api.h
index c5ebe2a..d6de2cb 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -65,3 +65,11 @@
uint32_t fragment_length, uint32_t length,
uint32_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_relinquish(struct vcpu *current);
+struct spci_value api_spci_mem_reclaim(uint32_t handle, uint32_t flags,
+ struct vcpu *current);
diff --git a/inc/hf/mm.h b/inc/hf/mm.h
index 43d4c79..6fb9296 100644
--- a/inc/hf/mm.h
+++ b/inc/hf/mm.h
@@ -79,6 +79,8 @@
/* clang-format on */
+#define MM_PPOOL_ENTRY_SIZE sizeof(struct mm_page_table)
+
struct mm_page_table {
alignas(PAGE_SIZE) pte_t entries[MM_PTE_PER_PAGE];
};
diff --git a/inc/hf/spci_memory.h b/inc/hf/spci_memory.h
index fc21e09..023a8ce 100644
--- a/inc/hf/spci_memory.h
+++ b/inc/hf/spci_memory.h
@@ -21,9 +21,19 @@
#include "vmapi/hf/spci.h"
-struct spci_value spci_memory_send(struct vm_locked to_locked,
- struct vm_locked from_locked,
+struct spci_value spci_memory_send(struct vm *to, struct vm_locked from_locked,
struct spci_memory_region *memory_region,
uint32_t memory_share_size,
uint32_t share_func,
struct mpool *page_pool);
+struct spci_value spci_memory_retrieve(
+ struct vm_locked to_locked,
+ struct spci_memory_retrieve_request *retrieve_request,
+ uint32_t retrieve_request_size, struct mpool *page_pool);
+struct spci_value spci_memory_relinquish(
+ struct vm_locked from_locked,
+ struct spci_mem_relinquish *relinquish_request,
+ struct mpool *page_pool);
+struct spci_value spci_memory_reclaim(struct vm_locked to_locked,
+ spci_memory_handle_t handle, bool clear,
+ struct mpool *page_pool);