feat(cactus): memory sharing flags in test commands

Extend the test command CACTUS_MEM_SEND_CMD:
- To include the flags for the retriever to use in transaction
descriptor to the FFA_MEM_RETRIEVE_REQ.
- Number of words cactus should write to the shared page after
retrieving it.
- Check if memory has been cleared after mapping to cactus address space
if clear memory flag was propagated in the command arguments.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I825b0f766bd7132a3488cdd17d83fce85adf4a5a
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 3bb27ed..130cfa5 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -196,10 +196,11 @@
 
 static inline smc_ret_values cactus_mem_send_cmd(
 	ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
-	ffa_memory_handle_t handle)
+	ffa_memory_handle_t handle, ffa_memory_region_flags_t retrieve_flags,
+	uint32_t word_to_write)
 {
 	return cactus_send_cmd(source, dest, CACTUS_MEM_SEND_CMD, mem_func,
-			       handle, 0, 0);
+			       handle, retrieve_flags, word_to_write);
 }
 
 static inline ffa_memory_handle_t cactus_mem_send_get_handle(smc_ret_values ret)
@@ -207,6 +208,17 @@
 	return (ffa_memory_handle_t)ret.ret5;
 }
 
+static inline ffa_memory_region_flags_t cactus_mem_send_get_retrv_flags(
+	smc_ret_values ret)
+{
+	return (ffa_memory_region_flags_t)ret.ret6;
+}
+
+static inline uint32_t cactus_mem_send_words_to_write(smc_ret_values ret)
+{
+	return (uint32_t)ret.ret7;
+}
+
 /**
  * Command to request a memory management operation. The 'mem_func' argument
  * identifies the operation that is to be performend, and 'receiver' is the id
diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h
index 4ec71fc..398d01a 100644
--- a/include/runtime_services/spm_common.h
+++ b/include/runtime_services/spm_common.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -129,7 +129,7 @@
 bool memory_retrieve(struct mailbox_buffers *mb,
 		     struct ffa_memory_region **retrieved, uint64_t handle,
 		     ffa_id_t sender, ffa_id_t receiver,
-		     uint32_t mem_func);
+		     uint32_t mem_func, ffa_memory_region_flags_t flags);
 
 /**
  * Helper to conduct a memory relinquish. The caller is usually the receiver,