aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-Alves <joao.alves@arm.com>2021-02-19 18:31:06 +0000
committerJ-Alves <joao.alves@arm.com>2021-03-12 14:28:22 +0000
commitecd307465ef642a8ab9f2bfcc56c2580e6d66a86 (patch)
treeea1c7d5368fc5aeb1c3a5e5619aa2d9042fae4f1
parent92f15beaf6cdb30157aee2afa5ea00f0446d69fc (diff)
downloadtf-a-tests-ecd307465ef642a8ab9f2bfcc56c2580e6d66a86.tar.gz
FF-A: Tidying direct messaging API definitions
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ia04cde158510824086624c1d725f2a6eb68a4702
-rw-r--r--include/runtime_services/cactus_test_cmds.h10
-rw-r--r--include/runtime_services/ffa_helpers.h35
-rw-r--r--spm/cactus/cactus.mk2
-rw-r--r--tftf/tests/runtime_services/secure_service/ffa_helpers.c119
-rw-r--r--tftf/tests/runtime_services/secure_service/spm_common.c10
5 files changed, 88 insertions, 88 deletions
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index f892a2ca4..c65816f5c 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -41,8 +41,8 @@ static inline smc_ret_values cactus_send_cmd(
ffa_vm_id_t source, ffa_vm_id_t dest, uint64_t cmd, uint64_t val0,
uint64_t val1, uint64_t val2, uint64_t val3)
{
- return ffa_msg_send_direct_req64_5args(source, dest, cmd, val0, val1,
- val2, val3);
+ return ffa_msg_send_direct_req64(source, dest, cmd, val0, val1, val2,
+ val3);
}
/**
@@ -54,8 +54,8 @@ static inline smc_ret_values cactus_send_response(
ffa_vm_id_t source, ffa_vm_id_t dest, uint32_t resp, uint32_t val0,
uint64_t val1, uint64_t val2, uint64_t val3)
{
- return ffa_msg_send_direct_resp64_5args(source, dest, resp, val0, val1,
- val2, val3);
+ return ffa_msg_send_direct_resp64(source, dest, resp, val0, val1,
+ val2, val3);
}
/**
@@ -64,7 +64,7 @@ static inline smc_ret_values cactus_send_response(
static inline smc_ret_values cactus_response(
ffa_vm_id_t source, ffa_vm_id_t dest, uint32_t response)
{
- return ffa_msg_send_direct_resp(source, dest, response);
+ return ffa_msg_send_direct_resp64(source, dest, response, 0, 0, 0, 0);
}
static inline uint32_t cactus_get_response(smc_ret_values ret)
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 064b5a3fe..e2962995c 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -372,19 +372,25 @@ static inline ffa_vm_id_t ffa_dir_msg_source(smc_ret_values val) {
return (ffa_vm_id_t)(val.ret1 >> 16U);
}
-smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message);
-smc_ret_values ffa_msg_send_direct_req64_5args(uint32_t source_id, uint32_t dest_id,
- uint64_t arg0, uint64_t arg1,
- uint64_t arg2, uint64_t arg3,
- uint64_t arg4);
-
-smc_ret_values ffa_msg_send_direct_resp64_5args(ffa_vm_id_t source_id,
- ffa_vm_id_t dest_id,
- uint64_t arg0,
- uint64_t arg1,
- uint64_t arg2,
- uint64_t arg3,
- uint64_t arg4);
+smc_ret_values ffa_msg_send_direct_req64(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4);
+
+smc_ret_values ffa_msg_send_direct_req32(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4);
+
+smc_ret_values ffa_msg_send_direct_resp64(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4);
+
+smc_ret_values ffa_msg_send_direct_resp32(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4);
static inline bool is_ffa_direct_response(smc_ret_values ret)
{
@@ -396,14 +402,11 @@ smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
smc_ret_values ffa_version(uint32_t input_version);
smc_ret_values ffa_id_get(void);
smc_ret_values ffa_msg_wait(void);
-smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t source_id,
- ffa_vm_id_t dest_id, uint32_t message);
smc_ret_values ffa_error(int32_t error_code);
smc_ret_values ffa_features(uint32_t feature);
smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]);
smc_ret_values ffa_rx_release(void);
smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
-
smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
uint32_t fragment_length);
smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index ac32d12d1..31ac990c9 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -40,10 +40,10 @@ CACTUS_SOURCES := \
sp_helpers.c \
) \
$(addprefix spm/cactus/cactus_tests/, \
- cactus_ffa_tests.c \
cactus_test_cpu_features.c \
cactus_test_cmds.c \
cactus_test_direct_messaging.c \
+ cactus_test_ffa.c \
cactus_test_memory_sharing.c \
)
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index 9567debd1..41dd94b11 100644
--- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -57,58 +57,83 @@ smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id)
* -BUSY: Message target is busy
* -ABORTED: Message target ran into an unexpected error and has aborted
*/
-static smc_ret_values __ffa_msg_send_direct_req32_5(uint32_t source_id,
- uint32_t dest_id,
- uint32_t arg0,
- uint32_t arg1,
- uint32_t arg2,
- uint32_t arg3,
- uint32_t arg4)
+smc_ret_values ffa_msg_send_direct_req64(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4)
{
smc_args args = {
- FFA_MSG_SEND_DIRECT_REQ_SMC32,
- (source_id << 16) | dest_id,
- 0,
- arg0, arg1, arg2, arg3, arg4
+ .fid = FFA_MSG_SEND_DIRECT_REQ_SMC64,
+ .arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
+ .arg2 = 0,
+ .arg3 = arg0,
+ .arg4 = arg1,
+ .arg5 = arg2,
+ .arg6 = arg3,
+ .arg7 = arg4,
};
return tftf_smc(&args);
}
-/* Direct message send helper accepting a single 32b message argument */
-smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id,
- uint32_t message)
+smc_ret_values ffa_msg_send_direct_req32(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4)
{
- return __ffa_msg_send_direct_req32_5(source_id, dest_id,
- message, 0, 0, 0, 0);
+ smc_args args = {
+ .fid = FFA_MSG_SEND_DIRECT_REQ_SMC32,
+ .arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
+ .arg2 = 0,
+ .arg3 = arg0,
+ .arg4 = arg1,
+ .arg5 = arg2,
+ .arg6 = arg3,
+ .arg7 = arg4,
+ };
+
+ return tftf_smc(&args);
}
-smc_ret_values ffa_msg_send_direct_req64_5args(uint32_t source_id,
- uint32_t dest_id,
- uint64_t arg0,
- uint64_t arg1,
- uint64_t arg2,
- uint64_t arg3,
- uint64_t arg4)
+smc_ret_values ffa_msg_send_direct_resp64(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4)
{
smc_args args = {
- FFA_MSG_SEND_DIRECT_REQ_SMC64,
- (source_id << 16) | dest_id,
- 0,
- arg0, arg1, arg2, arg3, arg4
+ .fid = FFA_MSG_SEND_DIRECT_RESP_SMC64,
+ .arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
+ .arg2 = 0,
+ .arg3 = arg0,
+ .arg4 = arg1,
+ .arg5 = arg2,
+ .arg6 = arg3,
+ .arg7 = arg4,
};
return tftf_smc(&args);
}
-/* Direct message send helper accepting a single 64b message argument */
-smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id,
- uint64_t message)
+smc_ret_values ffa_msg_send_direct_resp32(ffa_vm_id_t source_id,
+ ffa_vm_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4)
{
- return ffa_msg_send_direct_req64_5args(source_id, dest_id,
- message, 0, 0, 0, 0);
+ smc_args args = {
+ .fid = FFA_MSG_SEND_DIRECT_RESP_SMC32,
+ .arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
+ .arg2 = 0,
+ .arg3 = arg0,
+ .arg4 = arg1,
+ .arg5 = arg2,
+ .arg6 = arg3,
+ .arg7 = arg4,
+ };
+
+ return tftf_smc(&args);
}
+
/**
* Initialises the header of the given `ffa_memory_region`, not including the
* composite memory region offset.
@@ -303,36 +328,6 @@ smc_ret_values ffa_msg_wait(void)
return tftf_smc(&args);
}
-smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t source_id,
- ffa_vm_id_t dest_id,
- uint32_t message)
-{
- return ffa_msg_send_direct_resp64_5args(source_id, dest_id, message,
- 0, 0, 0, 0);
-}
-
-smc_ret_values ffa_msg_send_direct_resp64_5args(ffa_vm_id_t source_id,
- ffa_vm_id_t dest_id,
- uint64_t arg0,
- uint64_t arg1,
- uint64_t arg2,
- uint64_t arg3,
- uint64_t arg4)
-{
- smc_args args = {
- .fid = FFA_MSG_SEND_DIRECT_RESP_SMC64,
- .arg1 = (source_id << 16) | (dest_id),
- .arg2 = 0,
- .arg3 = arg0,
- .arg4 = arg1,
- .arg5 = arg2,
- .arg6 = arg3,
- .arg7 = arg4,
- };
-
- return tftf_smc(&args);
-}
-
smc_ret_values ffa_error(int32_t error_code)
{
smc_args args = {
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index 541ec922d..7e54a3add 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -85,8 +85,9 @@ bool check_spmc_execution_level(void)
* Send a first OP-TEE-defined protocol message through
* FFA direct message.
*/
- ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1),
- OPTEE_FFA_GET_API_VERSION);
+ ret_values = ffa_msg_send_direct_req32(HYP_ID, SP_ID(1),
+ OPTEE_FFA_GET_API_VERSION, 0,
+ 0, 0, 0);
if ((ret_values.ret3 == FFA_VERSION_MAJOR) &&
(ret_values.ret4 == FFA_VERSION_MINOR)) {
is_optee_spmc_criteria++;
@@ -96,8 +97,9 @@ bool check_spmc_execution_level(void)
* Send a second OP-TEE-defined protocol message through
* FFA direct message.
*/
- ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1),
- OPTEE_FFA_GET_OS_VERSION);
+ ret_values = ffa_msg_send_direct_req32(HYP_ID, SP_ID(1),
+ OPTEE_FFA_GET_OS_VERSION,
+ 0, 0, 0, 0);
if ((ret_values.ret3 == OPTEE_FFA_GET_OS_VERSION_MAJOR) &&
(ret_values.ret4 == OPTEE_FFA_GET_OS_VERSION_MINOR)) {
is_optee_spmc_criteria++;