aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-Alves <joao.alves@arm.com>2020-12-07 10:57:28 +0000
committerJ-Alves <joao.alves@arm.com>2021-01-20 14:44:50 +0000
commitb9085f851d37d66276e85ad05e9be1a9f4bfb99a (patch)
tree86bf81fa9377e50cc9aa040c93bab7c213f525af
parent27390fd363595890aaf9ae4634dff97cf898349e (diff)
downloadtf-a-tests-b9085f851d37d66276e85ad05e9be1a9f4bfb99a.tar.gz
Cactus: cmd for mem share tests
Previously there was no cmd id for the mem share tests in 'cactus_test_cmds.h', the func id was being reused. For consistency added the cmd id 'CACTUS_MEM_SEND_CMD'. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ia2cee00d444d2b753855f2323578df0f9bcf4fb2
-rw-r--r--spm/cactus/cactus_main.c10
-rw-r--r--spm/cactus/cactus_test_cmds.h17
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c2
3 files changed, 17 insertions, 12 deletions
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 3883fac82..de1e555b6 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -87,12 +87,10 @@ static void __dead2 message_loop(ffa_vm_id_t vm_id, struct mailbox_buffers *mb)
cactus_cmd = CACTUS_GET_CMD(ffa_ret);
switch (cactus_cmd) {
- case FFA_MEM_SHARE_SMC32:
- case FFA_MEM_LEND_SMC32:
- case FFA_MEM_DONATE_SMC32:
+ case CACTUS_MEM_SEND_CMD:
ffa_memory_management_test(
mb, vm_id, source,
- CACTUS_GET_CMD(ffa_ret),
+ CACTUS_MEM_SEND_GET_FUNC(ffa_ret),
CACTUS_MEM_SEND_GET_HANDLE(ffa_ret));
/*
@@ -133,8 +131,8 @@ static void __dead2 message_loop(ffa_vm_id_t vm_id, struct mailbox_buffers *mb)
*/
expect(handle != FFA_MEMORY_HANDLE_INVALID, true);
- ffa_ret = CACTUS_MEM_SEND_CMD(vm_id, receiver, mem_func,
- handle);
+ ffa_ret = CACTUS_MEM_SEND_CMD_SEND(vm_id, receiver,
+ mem_func, handle);
if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
ERROR("Failed to send message. error: %lx\n",
diff --git a/spm/cactus/cactus_test_cmds.h b/spm/cactus/cactus_test_cmds.h
index 0a3178339..7555b8b29 100644
--- a/spm/cactus/cactus_test_cmds.h
+++ b/spm/cactus/cactus_test_cmds.h
@@ -96,11 +96,18 @@
/**
* Command to notify cactus of a memory management operation. The cmd value
* should be the memory management smc function id.
+ *
+ * The id is the hex representation of the string "mem"
*/
-#define CACTUS_MEM_SEND_CMD(source, dest, mem_func, handle) \
- CACTUS_SEND_CMD(source, dest, mem_func, handle, 0, 0, 0)
+#define CACTUS_MEM_SEND_CMD U(0x6d656d)
+
+#define CACTUS_MEM_SEND_CMD_SEND(source, dest, mem_func, handle) \
+ CACTUS_SEND_CMD(source, dest, CACTUS_MEM_SEND_CMD, \
+ mem_func, handle, 0, 0)
+
+#define CACTUS_MEM_SEND_GET_FUNC(smc_ret) smc_ret.ret4
-#define CACTUS_MEM_SEND_GET_HANDLE(smc_ret) smc_ret.ret4
+#define CACTUS_MEM_SEND_GET_HANDLE(smc_ret) smc_ret.ret5
/**
* Command to request a memory management operation. The 'mem_func' argument
@@ -111,8 +118,8 @@
*/
#define CACTUS_REQ_MEM_SEND_CMD U(0x6d656d6f7279)
-#define CACTUS_REQ_MEM_SEND_SEND_CMD(source, dest, mem_func, receiver) \
- CACTUS_SEND_CMD(source, dest, CACTUS_REQ_MEM_SEND_CMD, mem_func, \
+#define CACTUS_REQ_MEM_SEND_SEND_CMD(source, dest, mem_func, receiver) \
+ CACTUS_SEND_CMD(source, dest, CACTUS_REQ_MEM_SEND_CMD, mem_func, \
receiver, 0, 0)
#define CACTUS_REQ_MEM_SEND_GET_MEM_FUNC(smc_ret) smc_ret.ret4
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c b/tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c
index a267b51d2..61f1aaa38 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c
@@ -77,7 +77,7 @@ static test_result_t test_memory_send_sp(uint32_t mem_func)
ptr = (uint32_t *)constituents[0].address;
- ret = CACTUS_MEM_SEND_CMD(SENDER, RECEIVER, mem_func, handle);
+ ret = CACTUS_MEM_SEND_CMD_SEND(SENDER, RECEIVER, mem_func, handle);
if (ret.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
ERROR("Failed to send message. error: %lx\n",