SPM: Tidying FF-A Memory Sharing tests
Moving code about memory sharing tests to comply with recent changes:
- Placed helper functions that can be used by TFTF and Cactus in files
spm_common.c/h.
- Removed 'ffa_memory_sharing_test' and added its body to handler of
test command CACTUS_MEM_SEND_CMD.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I58af9b475730d171306581741becbb0665e1859d
diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h
index b090002..74a2b27 100644
--- a/include/runtime_services/spm_common.h
+++ b/include/runtime_services/spm_common.h
@@ -82,4 +82,30 @@
unsigned int get_ffa_feature_test_target(const struct ffa_features_test **test_target);
+/**
+ * Helper to conduct a memory retrieve. This is to be called by the receiver
+ * of a memory share operation.
+ */
+bool memory_retrieve(struct mailbox_buffers *mb,
+ struct ffa_memory_region **retrieved, uint64_t handle,
+ ffa_vm_id_t sender, ffa_vm_id_t receiver,
+ uint32_t mem_func);
+
+/**
+ * Helper to conduct a memory relinquish. The caller is usually the receiver,
+ * after it being done with the memory shared, identified by the 'handle'.
+ */
+bool memory_relinquish(struct ffa_mem_relinquish *m, uint64_t handle,
+ ffa_vm_id_t id);
+
+ffa_memory_handle_t memory_send(
+ struct ffa_memory_region *memory_region, uint32_t mem_func,
+ uint32_t fragment_length, uint32_t total_length);
+
+ffa_memory_handle_t memory_init_and_send(
+ struct ffa_memory_region *memory_region, size_t memory_region_max_size,
+ ffa_vm_id_t sender, ffa_vm_id_t receiver,
+ const struct ffa_memory_region_constituent* constituents,
+ uint32_t constituents_count, uint32_t mem_func);
+
#endif /* SPM_COMMON_H */