feat(memory share): retrieve request from NWd
If the SPMC is allocator of a given memory handle, it is
expected to keep track of the on going memory region operations.
In the case a VM is retrieving a memory region that is shared with
an SP, it might attempt to retrieve the memory.
The hypervisor issues a retrieve req for the SPMC to pass it
the recorded memory region descriptor, such that it can
validate the retrieve request from the VM and then
update the VM's S2 memory mapping.
The SPMC doesn't expect to receive a request whose memory handle
was allocated by the hypervisor. Return FFA_INVALID_PARAMETERS
in such case.
Change-Id: Id86069cfb263c6a2efc4202ad9e3c5e53cdf1e65
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/inc/hf/arch/plat/ffa.h b/inc/hf/arch/plat/ffa.h
index a5f1701..d8e6844 100644
--- a/inc/hf/arch/plat/ffa.h
+++ b/inc/hf/arch/plat/ffa.h
@@ -315,6 +315,10 @@
void plat_ffa_enable_virtual_interrupts(struct vcpu_locked current_locked,
struct vm_locked vm_locked);
+bool plat_ffa_intercept_direct_response(struct vcpu_locked current_locked,
+ struct vcpu **next,
+ struct ffa_value to_ret,
+ struct ffa_value *signal_interrupt);
/*
* Handles FF-A memory share calls with recipients from the other world.
*/
@@ -331,7 +335,10 @@
struct vm *to, ffa_memory_handle_t handle,
ffa_memory_region_flags_t flags, struct mpool *page_pool);
-bool plat_ffa_intercept_direct_response(struct vcpu_locked current_locked,
- struct vcpu **next,
- struct ffa_value to_ret,
- struct ffa_value *signal_interrupt);
+/**
+ * Handles the memory retrieve request if the specified memory handle belongs
+ * to the other world.
+ */
+struct ffa_value plat_ffa_other_world_mem_retrieve(
+ struct vm_locked to_locked, struct ffa_memory_region *retrieve_request,
+ uint32_t length, struct mpool *page_pool);
diff --git a/inc/hf/ffa_memory_internal.h b/inc/hf/ffa_memory_internal.h
index 2da68f1..be5897d 100644
--- a/inc/hf/ffa_memory_internal.h
+++ b/inc/hf/ffa_memory_internal.h
@@ -146,3 +146,11 @@
struct ffa_memory_region_constituent **fragments,
uint32_t *fragment_constituent_counts, uint32_t fragment_count,
uint32_t memory_to_attributes, uint32_t *to_mode);
+uint32_t ffa_memory_region_get_receiver(struct ffa_memory_region *memory_region,
+ ffa_vm_id_t receiver);
+struct ffa_value ffa_retrieve_check_update(
+ struct vm_locked to_locked, ffa_vm_id_t from_id,
+ struct ffa_memory_region_constituent **fragments,
+ uint32_t *fragment_constituent_counts, uint32_t fragment_count,
+ uint32_t memory_to_attributes, uint32_t share_func, bool clear,
+ struct mpool *page_pool);