summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2022-03-29 18:36:36 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2022-05-19 18:10:00 +0100
commitce386b12b15b33cc362cbca14514831e4459467f (patch)
tree8ea080d30cc015cbdd5fe5b18f83051f806e3724
parent6baf5b87ff121ceff5eb2f818dd8b409f2c30dc2 (diff)
test(spm): use ffa_helpers for ivy partition
Allow the ivy partition to use the ffa_helpers functions. To achieve this we create a common struct for ff-a calls that is used for both parameters and returns, this aligns with the Hafnium implementation. We can then use preprocessor macros to pick either SMC or SVC as the conduit depending on the exception level the SP is running at. Change-Id: Ic9525baabcf40d15545b6f6d504cf954373f08f9 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
-rw-r--r--include/common/test_helpers.h15
-rw-r--r--include/runtime_services/cactus_message_loop.h12
-rw-r--r--include/runtime_services/cactus_test_cmds.h184
-rw-r--r--include/runtime_services/ffa_helpers.h189
-rw-r--r--include/runtime_services/spm_common.h16
-rw-r--r--spm/cactus/cactus.mk12
-rw-r--r--spm/cactus/cactus_main.c9
-rw-r--r--spm/cactus/cactus_tests/cactus_message_loop.c4
-rw-r--r--spm/cactus/cactus_tests/cactus_test_direct_messaging.c14
-rw-r--r--spm/cactus/cactus_tests/cactus_test_ffa.c12
-rw-r--r--spm/cactus/cactus_tests/cactus_test_interrupts.c4
-rw-r--r--spm/cactus/cactus_tests/cactus_test_memory_sharing.c2
-rw-r--r--spm/cactus/cactus_tests/cactus_test_notifications.c10
-rw-r--r--spm/cactus/cactus_tests/cactus_tests_smmuv3.c4
-rw-r--r--spm/common/sp_debug.c9
-rw-r--r--spm/ivy/app/ivy_main.c32
-rw-r--r--spm/ivy/ivy.mk2
-rw-r--r--tftf/tests/common/test_helpers.c8
-rw-r--r--tftf/tests/misc_tests/test_invalid_access.c2
-rw-r--r--tftf/tests/runtime_services/realm_payload/realm_payload_spm_test.c6
-rw-r--r--tftf/tests/runtime_services/secure_service/aarch32/ffa_arch_helpers.S42
-rw-r--r--tftf/tests/runtime_services/secure_service/aarch64/ffa_arch_helpers.S53
-rw-r--r--tftf/tests/runtime_services/secure_service/ffa_helpers.c226
-rw-r--r--tftf/tests/runtime_services/secure_service/spm_common.c61
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c10
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c2
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c4
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c8
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_notifications.c53
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c10
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c14
-rw-r--r--tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c6
-rw-r--r--tftf/tests/runtime_services/secure_service/test_spm_smmu.c4
-rw-r--r--tftf/tests/tests-invalid-access.mk3
-rw-r--r--tftf/tests/tests-spm.mk3
35 files changed, 588 insertions, 457 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index c808df1..40cc96f 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -8,6 +8,7 @@
#define TEST_HELPERS_H__
#include <arch_features.h>
+#include <ffa_helpers.h>
#include <ffa_svc.h>
#include <events.h>
#include <plat_topology.h>
@@ -182,16 +183,16 @@ typedef test_result_t (*test_function_arg_t)(void *arg);
#define SKIP_TEST_IF_FFA_VERSION_LESS_THAN(major, minor) \
do { \
- smc_ret_values smc_ret = ffa_version( \
+ struct ffa_value ret = ffa_version( \
MAKE_FFA_VERSION(major, minor)); \
- uint32_t version = smc_ret.ret0; \
+ uint32_t version = ret.fid; \
\
if (version == FFA_ERROR_NOT_SUPPORTED) { \
tftf_testcase_printf("FFA_VERSION not supported.\n"); \
return TEST_RESULT_SKIPPED; \
} \
\
- if ((version & FFA_VERSION_BIT31_MASK) != 0U) { \
+ if ((version & FFA_VERSION_BIT31_MASK) != 0U) { \
tftf_testcase_printf("FFA_VERSION bad response: %x\n", \
version); \
return TEST_RESULT_FAIL; \
@@ -222,13 +223,13 @@ typedef test_result_t (*test_function_arg_t)(void *arg);
#define SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(mb, ffa_uuid) \
do { \
- smc_ret_values smc_ret = ffa_partition_info_get(ffa_uuid); \
+ struct ffa_value sc_ret = ffa_partition_info_get(ffa_uuid); \
ffa_rx_release(); \
- if (ffa_func_id(smc_ret) == FFA_ERROR && \
- ffa_error_code(smc_ret) == FFA_ERROR_INVALID_PARAMETER) { \
+ if (ffa_func_id(sc_ret) == FFA_ERROR && \
+ ffa_error_code(sc_ret) == FFA_ERROR_INVALID_PARAMETER) { \
tftf_testcase_printf("FFA endpoint not deployed!\n"); \
return TEST_RESULT_SKIPPED; \
- } else if (smc_ret.ret0 != FFA_SUCCESS_SMC32) { \
+ } else if (ffa_func_id(sc_ret) != FFA_SUCCESS_SMC32) { \
ERROR("ffa_partition_info_get failed!\n"); \
return TEST_RESULT_FAIL; \
} \
diff --git a/include/runtime_services/cactus_message_loop.h b/include/runtime_services/cactus_message_loop.h
index d69e77c..4d963ac 100644
--- a/include/runtime_services/cactus_message_loop.h
+++ b/include/runtime_services/cactus_message_loop.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
*/
@@ -12,8 +12,8 @@
*/
struct cactus_cmd_handler {
const uint64_t id;
- smc_ret_values (*fn)(const smc_ret_values *args,
- struct mailbox_buffers *mb);
+ struct ffa_value (*fn)(const struct ffa_value *args,
+ struct mailbox_buffers *mb);
};
/**
@@ -25,8 +25,8 @@ struct cactus_cmd_handler {
* Define handler's function signature.
*/
#define CACTUS_HANDLER_FN(name) \
- static smc_ret_values CACTUS_HANDLER_FN_NAME(name)( \
- const smc_ret_values *args, struct mailbox_buffers *mb)
+ static struct ffa_value CACTUS_HANDLER_FN_NAME(name)( \
+ const struct ffa_value *args, struct mailbox_buffers *mb)
/**
* Helper to define Cactus command handler, and pair it with a command ID.
@@ -40,5 +40,5 @@ struct cactus_cmd_handler {
}; \
CACTUS_HANDLER_FN(name)
-bool cactus_handle_cmd(smc_ret_values *cmd_args, smc_ret_values *ret,
+bool cactus_handle_cmd(struct ffa_value *cmd_args, struct ffa_value *ret,
struct mailbox_buffers *mb);
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 435d270..1e60e0e 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -25,18 +25,18 @@
#define CACTUS_ERROR_UNHANDLED U(4)
/**
- * Get command from struct smc_ret_values.
+ * Get command from struct ffa_value.
*/
-static inline uint64_t cactus_get_cmd(smc_ret_values ret)
+static inline uint64_t cactus_get_cmd(struct ffa_value ret)
{
- return (uint64_t)ret.ret3;
+ return (uint64_t)ret.arg3;
}
/**
* Template for commands to be sent to CACTUS partitions over direct
* messages interfaces.
*/
-static inline smc_ret_values cactus_send_cmd(
+static inline struct ffa_value cactus_send_cmd(
ffa_id_t source, ffa_id_t dest, uint64_t cmd, uint64_t val0,
uint64_t val1, uint64_t val2, uint64_t val3)
{
@@ -49,7 +49,7 @@ static inline smc_ret_values cactus_send_cmd(
* 'cactus_send_response' is the template for custom responses, in case there is
* a need to propagate more than one value in the response of a command.
*/
-static inline smc_ret_values cactus_send_response(
+static inline struct ffa_value cactus_send_response(
ffa_id_t source, ffa_id_t dest, uint32_t resp, uint64_t val0,
uint64_t val1, uint64_t val2, uint64_t val3)
{
@@ -60,15 +60,15 @@ static inline smc_ret_values cactus_send_response(
/**
* For responses of one value only.
*/
-static inline smc_ret_values cactus_response(
+static inline struct ffa_value cactus_response(
ffa_id_t source, ffa_id_t dest, uint32_t response)
{
return cactus_send_response(source, dest, response, 0, 0, 0, 0);
}
-static inline uint32_t cactus_get_response(smc_ret_values ret)
+static inline uint32_t cactus_get_response(struct ffa_value ret)
{
- return (uint32_t)ret.ret3;
+ return (uint32_t)ret.arg3;
}
/**
@@ -77,7 +77,7 @@ static inline uint32_t cactus_get_response(smc_ret_values ret)
* If more arguments are needed, a custom response should be defined for the
* specific test.
*/
-static inline smc_ret_values cactus_success_resp(
+static inline struct ffa_value cactus_success_resp(
ffa_id_t source, ffa_id_t dest, uint64_t value)
{
return cactus_send_response(source, dest, CACTUS_SUCCESS, value,
@@ -89,16 +89,16 @@ static inline smc_ret_values cactus_success_resp(
* the reason, which can be specific to the test, or general ones as defined
* in the error code list.
*/
-static inline smc_ret_values cactus_error_resp(
+static inline struct ffa_value cactus_error_resp(
ffa_id_t source, ffa_id_t dest, uint32_t error_code)
{
return cactus_send_response(source, dest, CACTUS_ERROR, error_code,
0, 0, 0);
}
-static inline uint32_t cactus_error_code(smc_ret_values ret)
+static inline uint32_t cactus_error_code(struct ffa_value ret)
{
- return (uint32_t) ret.ret4;
+ return (uint32_t) ret.arg4;
}
/**
@@ -109,16 +109,16 @@ static inline uint32_t cactus_error_code(smc_ret_values ret)
*/
#define CACTUS_ECHO_CMD U(0x6563686f)
-static inline smc_ret_values cactus_echo_send_cmd(
+static inline struct ffa_value cactus_echo_send_cmd(
ffa_id_t source, ffa_id_t dest, uint64_t echo_val)
{
return cactus_send_cmd(source, dest, CACTUS_ECHO_CMD, echo_val, 0, 0,
0);
}
-static inline uint64_t cactus_echo_get_val(smc_ret_values ret)
+static inline uint64_t cactus_echo_get_val(struct ffa_value ret)
{
- return (uint64_t)ret.ret4;
+ return (uint64_t)ret.arg4;
}
/**
@@ -130,7 +130,7 @@ static inline uint64_t cactus_echo_get_val(smc_ret_values ret)
*/
#define CACTUS_REQ_ECHO_CMD (CACTUS_ECHO_CMD + 1)
-static inline smc_ret_values cactus_req_echo_send_cmd(
+static inline struct ffa_value cactus_req_echo_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t echo_dest,
uint64_t echo_val)
{
@@ -138,9 +138,9 @@ static inline smc_ret_values cactus_req_echo_send_cmd(
echo_dest, 0, 0);
}
-static inline ffa_id_t cactus_req_echo_get_echo_dest(smc_ret_values ret)
+static inline ffa_id_t cactus_req_echo_get_echo_dest(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret5;
+ return (ffa_id_t)ret.arg5;
}
/**
@@ -154,16 +154,16 @@ static inline ffa_id_t cactus_req_echo_get_echo_dest(smc_ret_values ret)
*/
#define CACTUS_DEADLOCK_CMD U(0x64656164)
-static inline smc_ret_values cactus_deadlock_send_cmd(
+static inline struct ffa_value cactus_deadlock_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t next_dest)
{
return cactus_send_cmd(source, dest, CACTUS_DEADLOCK_CMD, next_dest, 0,
0, 0);
}
-static inline ffa_id_t cactus_deadlock_get_next_dest(smc_ret_values ret)
+static inline ffa_id_t cactus_deadlock_get_next_dest(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret4;
+ return (ffa_id_t)ret.arg4;
}
/**
@@ -172,7 +172,7 @@ static inline ffa_id_t cactus_deadlock_get_next_dest(smc_ret_values ret)
*/
#define CACTUS_REQ_DEADLOCK_CMD (CACTUS_DEADLOCK_CMD + 1)
-static inline smc_ret_values cactus_req_deadlock_send_cmd(
+static inline struct ffa_value cactus_req_deadlock_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t next_dest1,
ffa_id_t next_dest2)
{
@@ -181,9 +181,9 @@ static inline smc_ret_values cactus_req_deadlock_send_cmd(
}
/* To get next_dest1 use CACTUS_DEADLOCK_GET_NEXT_DEST */
-static inline ffa_id_t cactus_deadlock_get_next_dest2(smc_ret_values ret)
+static inline ffa_id_t cactus_deadlock_get_next_dest2(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret5;
+ return (ffa_id_t)ret.arg5;
}
/**
@@ -194,7 +194,7 @@ static inline ffa_id_t cactus_deadlock_get_next_dest2(smc_ret_values ret)
*/
#define CACTUS_MEM_SEND_CMD U(0x6d656d)
-static inline smc_ret_values cactus_mem_send_cmd(
+static inline struct ffa_value cactus_mem_send_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
ffa_memory_handle_t handle, ffa_memory_region_flags_t retrieve_flags,
bool non_secure, uint16_t word_to_write)
@@ -208,25 +208,26 @@ static inline smc_ret_values cactus_mem_send_cmd(
handle, retrieve_flags, val3);
}
-static inline ffa_memory_handle_t cactus_mem_send_get_handle(smc_ret_values ret)
+static inline ffa_memory_handle_t cactus_mem_send_get_handle(
+ struct ffa_value ret)
{
- return (ffa_memory_handle_t)ret.ret5;
+ return (ffa_memory_handle_t)ret.arg5;
}
static inline ffa_memory_region_flags_t cactus_mem_send_get_retrv_flags(
- smc_ret_values ret)
+ struct ffa_value ret)
{
- return (ffa_memory_region_flags_t)ret.ret6;
+ return (ffa_memory_region_flags_t)ret.arg6;
}
-static inline uint16_t cactus_mem_send_words_to_write(smc_ret_values ret)
+static inline uint16_t cactus_mem_send_words_to_write(struct ffa_value ret)
{
- return (uint16_t)ret.ret7;
+ return (uint16_t)ret.arg7;
}
-static inline bool cactus_mem_send_get_non_secure(smc_ret_values ret)
+static inline bool cactus_mem_send_get_non_secure(struct ffa_value ret)
{
- return (bool)(ret.ret7 >> 16);
+ return (bool)(ret.arg7 >> 16);
}
/**
@@ -238,7 +239,7 @@ static inline bool cactus_mem_send_get_non_secure(smc_ret_values ret)
*/
#define CACTUS_REQ_MEM_SEND_CMD U(0x6d656d6f7279)
-static inline smc_ret_values cactus_req_mem_send_send_cmd(
+static inline struct ffa_value cactus_req_mem_send_send_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
ffa_id_t receiver, bool non_secure)
{
@@ -246,19 +247,19 @@ static inline smc_ret_values cactus_req_mem_send_send_cmd(
receiver, non_secure, 0);
}
-static inline uint32_t cactus_req_mem_send_get_mem_func(smc_ret_values ret)
+static inline uint32_t cactus_req_mem_send_get_mem_func(struct ffa_value ret)
{
- return (uint32_t)ret.ret4;
+ return (uint32_t)ret.arg4;
}
-static inline ffa_id_t cactus_req_mem_send_get_receiver(smc_ret_values ret)
+static inline ffa_id_t cactus_req_mem_send_get_receiver(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret5;
+ return (ffa_id_t)ret.arg5;
}
-static inline bool cactus_req_mem_send_get_non_secure(smc_ret_values ret)
+static inline bool cactus_req_mem_send_get_non_secure(struct ffa_value ret)
{
- return (bool)ret.ret6;
+ return (bool)ret.arg6;
}
/**
@@ -270,7 +271,7 @@ static inline bool cactus_req_mem_send_get_non_secure(smc_ret_values ret)
*/
#define CACTUS_REQ_SIMD_FILL_CMD U(0x53494d44)
-static inline smc_ret_values cactus_req_simd_fill_send_cmd(
+static inline struct ffa_value cactus_req_simd_fill_send_cmd(
ffa_id_t source, ffa_id_t dest)
{
return cactus_send_cmd(source, dest, CACTUS_REQ_SIMD_FILL_CMD, 0, 0, 0,
@@ -284,7 +285,7 @@ static inline smc_ret_values cactus_req_simd_fill_send_cmd(
*/
#define CACTUS_SLEEP_CMD U(0x736c656570)
-static inline smc_ret_values cactus_sleep_cmd(
+static inline struct ffa_value cactus_sleep_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t sleep_time)
{
return cactus_send_cmd(source, dest, CACTUS_SLEEP_CMD, sleep_time, 0, 0,
@@ -299,7 +300,7 @@ static inline smc_ret_values cactus_sleep_cmd(
*/
#define CACTUS_FWD_SLEEP_CMD (CACTUS_SLEEP_CMD + 1)
-static inline smc_ret_values cactus_fwd_sleep_cmd(
+static inline struct ffa_value cactus_fwd_sleep_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t fwd_dest,
uint32_t sleep_time)
{
@@ -307,14 +308,14 @@ static inline smc_ret_values cactus_fwd_sleep_cmd(
fwd_dest, 0, 0);
}
-static inline uint32_t cactus_get_sleep_time(smc_ret_values ret)
+static inline uint32_t cactus_get_sleep_time(struct ffa_value ret)
{
- return (uint32_t)ret.ret4;
+ return (uint32_t)ret.arg4;
}
-static inline ffa_id_t cactus_get_fwd_sleep_dest(smc_ret_values ret)
+static inline ffa_id_t cactus_get_fwd_sleep_dest(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret5;
+ return (ffa_id_t)ret.arg5;
}
/**
@@ -326,7 +327,7 @@ static inline ffa_id_t cactus_get_fwd_sleep_dest(smc_ret_values ret)
*/
#define CACTUS_SLEEP_TRIGGER_TWDOG_CMD (CACTUS_SLEEP_CMD + 2)
-static inline smc_ret_values cactus_sleep_trigger_wdog_cmd(
+static inline struct ffa_value cactus_sleep_trigger_wdog_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t sleep_time,
uint64_t wdog_time)
{
@@ -335,9 +336,9 @@ static inline smc_ret_values cactus_sleep_trigger_wdog_cmd(
}
-static inline uint32_t cactus_get_wdog_trigger_duration(smc_ret_values ret)
+static inline uint32_t cactus_get_wdog_trigger_duration(struct ffa_value ret)
{
- return (uint32_t)ret.ret5;
+ return (uint32_t)ret.arg5;
}
/**
@@ -347,7 +348,7 @@ static inline uint32_t cactus_get_wdog_trigger_duration(smc_ret_values ret)
*/
#define CACTUS_INTERRUPT_CMD U(0x696e7472)
-static inline smc_ret_values cactus_interrupt_cmd(
+static inline struct ffa_value cactus_interrupt_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t interrupt_id,
bool enable, uint32_t pin)
{
@@ -355,19 +356,19 @@ static inline smc_ret_values cactus_interrupt_cmd(
enable, pin, 0);
}
-static inline uint32_t cactus_get_interrupt_id(smc_ret_values ret)
+static inline uint32_t cactus_get_interrupt_id(struct ffa_value ret)
{
- return (uint32_t)ret.ret4;
+ return (uint32_t)ret.arg4;
}
-static inline bool cactus_get_interrupt_enable(smc_ret_values ret)
+static inline bool cactus_get_interrupt_enable(struct ffa_value ret)
{
- return (bool)ret.ret5;
+ return (bool)ret.arg5;
}
-static inline enum interrupt_pin cactus_get_interrupt_pin(smc_ret_values ret)
+static inline enum interrupt_pin cactus_get_interrupt_pin(struct ffa_value ret)
{
- return (enum interrupt_pin)ret.ret6;
+ return (enum interrupt_pin)ret.arg6;
}
/**
@@ -377,7 +378,7 @@ static inline enum interrupt_pin cactus_get_interrupt_pin(smc_ret_values ret)
*/
#define CACTUS_DMA_SMMUv3_CMD (0x534d4d55)
-static inline smc_ret_values cactus_send_dma_cmd(
+static inline struct ffa_value cactus_send_dma_cmd(
ffa_id_t source, ffa_id_t dest)
{
return cactus_send_cmd(source, dest, CACTUS_DMA_SMMUv3_CMD, 0, 0, 0,
@@ -395,7 +396,7 @@ static inline smc_ret_values cactus_send_dma_cmd(
*/
#define CACTUS_NOTIFICATION_BIND_CMD U(0x62696e64)
-static inline smc_ret_values cactus_notification_bind_send_cmd(
+static inline struct ffa_value cactus_notification_bind_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
ffa_id_t sender, ffa_notification_bitmap_t notifications, uint32_t flags)
{
@@ -414,7 +415,7 @@ static inline smc_ret_values cactus_notification_bind_send_cmd(
*/
#define CACTUS_NOTIFICATION_UNBIND_CMD U(0x756e62696e64)
-static inline smc_ret_values cactus_notification_unbind_send_cmd(
+static inline struct ffa_value cactus_notification_unbind_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
ffa_id_t sender, ffa_notification_bitmap_t notifications)
{
@@ -422,22 +423,20 @@ static inline smc_ret_values cactus_notification_unbind_send_cmd(
receiver, sender, notifications, 0);
}
-static inline ffa_id_t cactus_notification_get_receiver(
- smc_ret_values ret)
+static inline ffa_id_t cactus_notification_get_receiver(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret4;
+ return (ffa_id_t)ret.arg4;
}
-static inline ffa_id_t cactus_notification_get_sender(
- smc_ret_values ret)
+static inline ffa_id_t cactus_notification_get_sender(struct ffa_value ret)
{
- return (ffa_id_t)ret.ret5;
+ return (ffa_id_t)ret.arg5;
}
static inline ffa_notification_bitmap_t cactus_notification_get_notifications(
- smc_ret_values ret)
+ struct ffa_value ret)
{
- return (uint64_t)ret.ret6;
+ return (uint64_t)ret.arg6;
}
/**
@@ -450,7 +449,7 @@ static inline ffa_notification_bitmap_t cactus_notification_get_notifications(
*/
#define CACTUS_NOTIFICATION_GET_CMD U(0x6765746e6f74)
-static inline smc_ret_values cactus_notification_get_send_cmd(
+static inline struct ffa_value cactus_notification_get_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
uint32_t vcpu_id, uint32_t flags, bool check_npi_handled)
{
@@ -458,17 +457,17 @@ static inline smc_ret_values cactus_notification_get_send_cmd(
receiver, vcpu_id, check_npi_handled, flags);
}
-static inline uint32_t cactus_notification_get_vcpu(smc_ret_values ret)
+static inline uint32_t cactus_notification_get_vcpu(struct ffa_value ret)
{
- return (uint32_t)ret.ret5;
+ return (uint32_t)ret.arg5;
}
-static inline uint32_t cactus_notification_get_flags(smc_ret_values ret)
+static inline uint32_t cactus_notification_get_flags(struct ffa_value ret)
{
- return (uint32_t)ret.ret7;
+ return (uint32_t)ret.arg7;
}
-static inline smc_ret_values cactus_notifications_get_success_resp(
+static inline struct ffa_value cactus_notifications_get_success_resp(
ffa_id_t source, ffa_id_t dest, uint64_t from_sp,
uint64_t from_vm)
{
@@ -476,19 +475,19 @@ static inline smc_ret_values cactus_notifications_get_success_resp(
from_vm, 0, 0);
}
-static inline uint64_t cactus_notifications_get_from_sp(smc_ret_values ret)
+static inline uint64_t cactus_notifications_get_from_sp(struct ffa_value ret)
{
- return (uint64_t)ret.ret4;
+ return (uint64_t)ret.arg4;
}
-static inline uint64_t cactus_notifications_get_from_vm(smc_ret_values ret)
+static inline uint64_t cactus_notifications_get_from_vm(struct ffa_value ret)
{
- return (uint64_t)ret.ret5;
+ return (uint64_t)ret.arg5;
}
-static inline bool cactus_notifications_check_npi_handled(smc_ret_values ret)
+static inline bool cactus_notifications_check_npi_handled(struct ffa_value ret)
{
- return (bool)ret.ret6;
+ return (bool)ret.arg6;
}
/**
@@ -501,7 +500,7 @@ static inline bool cactus_notifications_check_npi_handled(smc_ret_values ret)
*/
#define CACTUS_NOTIFICATIONS_SET_CMD U(0x6e6f74736574)
-static inline smc_ret_values cactus_notifications_set_send_cmd(
+static inline struct ffa_value cactus_notifications_set_send_cmd(
ffa_id_t source, ffa_id_t dest, ffa_id_t receiver,
ffa_id_t sender, uint32_t flags, ffa_notification_bitmap_t notifications,
ffa_id_t echo_dest)
@@ -512,14 +511,15 @@ static inline smc_ret_values cactus_notifications_set_send_cmd(
notifications, flags);
}
-static inline ffa_id_t cactus_notifications_set_get_receiver(smc_ret_values ret)
+static inline ffa_id_t cactus_notifications_set_get_receiver(
+ struct ffa_value ret)
{
- return (ffa_id_t)(ret.ret4 & 0xFFFFU);
+ return (ffa_id_t)(ret.arg4 & 0xFFFFU);
}
-static inline ffa_id_t cactus_notifications_set_get_sender(smc_ret_values ret)
+static inline ffa_id_t cactus_notifications_set_get_sender(struct ffa_value ret)
{
- return (ffa_id_t)((ret.ret4 >> 16U) & 0xFFFFU);
+ return (ffa_id_t)((ret.arg4 >> 16U) & 0xFFFFU);
}
/**
@@ -529,16 +529,16 @@ static inline ffa_id_t cactus_notifications_set_get_sender(smc_ret_values ret)
*/
#define CACTUS_TWDOG_START_CMD U(0x57444f47)
-static inline smc_ret_values cactus_send_twdog_cmd(
+static inline struct ffa_value cactus_send_twdog_cmd(
ffa_id_t source, ffa_id_t dest, uint64_t time)
{
return cactus_send_cmd(source, dest, CACTUS_TWDOG_START_CMD, time, 0, 0,
0);
}
-static inline uint32_t cactus_get_wdog_duration(smc_ret_values ret)
+static inline uint32_t cactus_get_wdog_duration(struct ffa_value ret)
{
- return (uint32_t)ret.ret4;
+ return (uint32_t)ret.arg4;
}
/**
@@ -548,16 +548,16 @@ static inline uint32_t cactus_get_wdog_duration(smc_ret_values ret)
*/
#define CACTUS_GET_REQ_COUNT_CMD U(0x726571636f756e74)
-static inline smc_ret_values cactus_get_req_count_send_cmd(
+static inline struct ffa_value cactus_get_req_count_send_cmd(
ffa_id_t source, ffa_id_t dest)
{
return cactus_send_cmd(source, dest, CACTUS_GET_REQ_COUNT_CMD, 0, 0, 0,
0);
}
-static inline uint32_t cactus_get_req_count(smc_ret_values ret)
+static inline uint32_t cactus_get_req_count(struct ffa_value ret)
{
- return (uint32_t)ret.ret4;
+ return (uint32_t)ret.arg4;
}
/**
@@ -567,7 +567,7 @@ static inline uint32_t cactus_get_req_count(smc_ret_values ret)
*/
#define CACTUS_LAST_INTERRUPT_SERVICED_CMD U(0x76494e54)
-static inline smc_ret_values cactus_get_last_interrupt_cmd(
+static inline struct ffa_value cactus_get_last_interrupt_cmd(
ffa_id_t source, ffa_id_t dest)
{
return cactus_send_cmd(source, dest, CACTUS_LAST_INTERRUPT_SERVICED_CMD,
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 8232128..1250673 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -172,28 +172,57 @@ struct ffa_partition_info_v1_0 {
uint32_t properties;
};
-static inline uint32_t ffa_func_id(smc_ret_values val)
+struct ffa_value {
+ u_register_t fid;
+ u_register_t arg1;
+ u_register_t arg2;
+ u_register_t arg3;
+ u_register_t arg4;
+ u_register_t arg5;
+ u_register_t arg6;
+ u_register_t arg7;
+};
+
+/* Function to make an SMC or SVC service call depending on the exception
+ * level of the SP.
+ */
+struct ffa_value ffa_service_call(struct ffa_value *args);
+
+/*
+ * Functions to trigger a service call.
+ *
+ * The arguments to pass through the service call must be stored in the
+ * ffa_value structure. The return values of the service call will be stored
+ * in the same structure (overriding the input arguments).
+ *
+ * Return the first return value. It is equivalent to args.fid but is also
+ * provided as the return value for convenience.
+ */
+u_register_t ffa_svc(struct ffa_value *args);
+u_register_t ffa_smc(struct ffa_value *args);
+
+static inline uint32_t ffa_func_id(struct ffa_value val)
{
- return (uint32_t) val.ret0;
+ return (uint32_t)val.fid;
}
-static inline int32_t ffa_error_code(smc_ret_values val)
+static inline int32_t ffa_error_code(struct ffa_value val)
{
- return (int32_t) val.ret2;
+ return (int32_t)val.arg2;
}
-static inline ffa_id_t ffa_endpoint_id(smc_ret_values val) {
- return (ffa_id_t) val.ret2 & 0xffff;
+static inline ffa_id_t ffa_endpoint_id(struct ffa_value val) {
+ return (ffa_id_t)val.arg2 & 0xffff;
}
-static inline uint32_t ffa_partition_info_count(smc_ret_values val)
+static inline uint32_t ffa_partition_info_count(struct ffa_value val)
{
- return (uint32_t) val.ret2;
+ return (uint32_t)val.arg2;
}
-static inline uint32_t ffa_feature_intid(smc_ret_values val)
+static inline uint32_t ffa_feature_intid(struct ffa_value val)
{
- return (uint32_t)val.ret2;
+ return (uint32_t)val.arg2;
}
typedef uint64_t ffa_notification_bitmap_t;
@@ -226,14 +255,16 @@ typedef uint64_t ffa_notification_bitmap_t;
#define FFA_NOTIFICATIONS_FLAGS_VCPU_ID(id) UINT32_C((id & 0xFFFF) << 16)
-static inline ffa_notification_bitmap_t ffa_notifications_get_from_sp(smc_ret_values val)
+static inline ffa_notification_bitmap_t ffa_notifications_get_from_sp(
+ struct ffa_value val)
{
- return FFA_NOTIFICATIONS_BITMAP(val.ret2, val.ret3);
+ return FFA_NOTIFICATIONS_BITMAP(val.arg2, val.arg3);
}
-static inline ffa_notification_bitmap_t ffa_notifications_get_from_vm(smc_ret_values val)
+static inline ffa_notification_bitmap_t ffa_notifications_get_from_vm(
+ struct ffa_value val)
{
- return FFA_NOTIFICATIONS_BITMAP(val.ret4, val.ret5);
+ return FFA_NOTIFICATIONS_BITMAP(val.arg4, val.arg5);
}
/*
@@ -250,22 +281,22 @@ static inline ffa_notification_bitmap_t ffa_notifications_get_from_vm(smc_ret_va
#define FFA_NOTIFICATIONS_LIST_SIZE_MASK 0x3U
static inline uint32_t ffa_notifications_info_get_lists_count(
- smc_ret_values ret)
+ struct ffa_value ret)
{
- return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT)
+ return (uint32_t)(ret.arg2 >> FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT)
& FFA_NOTIFICATIONS_LISTS_COUNT_MASK;
}
static inline uint32_t ffa_notifications_info_get_list_size(
- smc_ret_values ret, uint32_t list)
+ struct ffa_value ret, uint32_t list)
{
- return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LIST_SHIFT(list)) &
+ return (uint32_t)(ret.arg2 >> FFA_NOTIFICATIONS_LIST_SHIFT(list)) &
FFA_NOTIFICATIONS_LIST_SIZE_MASK;
}
-static inline bool ffa_notifications_info_get_more_pending(smc_ret_values ret)
+static inline bool ffa_notifications_info_get_more_pending(struct ffa_value ret)
{
- return (ret.ret2 & FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING) != 0U;
+ return (ret.arg2 & FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING) != 0U;
}
enum ffa_data_access {
@@ -531,9 +562,9 @@ static inline ffa_memory_handle_t ffa_assemble_handle(uint32_t h1, uint32_t h2)
(ffa_notification_bitmap_t)h2 << 32;
}
-static inline ffa_memory_handle_t ffa_mem_success_handle(smc_ret_values r)
+static inline ffa_memory_handle_t ffa_mem_success_handle(struct ffa_value r)
{
- return ffa_assemble_handle(r.ret2, r.ret3);
+ return ffa_assemble_handle(r.arg2, r.arg3);
}
/**
@@ -586,69 +617,69 @@ uint32_t ffa_memory_region_init(
enum ffa_memory_shareability shareability, uint32_t *total_length,
uint32_t *fragment_length);
-static inline ffa_id_t ffa_dir_msg_dest(smc_ret_values val) {
- return (ffa_id_t)val.ret1 & U(0xFFFF);
+static inline ffa_id_t ffa_dir_msg_dest(struct ffa_value val) {
+ return (ffa_id_t)val.arg1 & U(0xFFFF);
}
-static inline ffa_id_t ffa_dir_msg_source(smc_ret_values val) {
- return (ffa_id_t)(val.ret1 >> 16U);
+static inline ffa_id_t ffa_dir_msg_source(struct ffa_value val) {
+ return (ffa_id_t)(val.arg1 >> 16U);
}
-smc_ret_values ffa_msg_send_direct_req64(ffa_id_t source_id,
- ffa_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_id_t source_id,
- ffa_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_id_t source_id,
- ffa_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_id_t source_id,
- ffa_id_t dest_id, uint32_t arg0,
- uint32_t arg1, uint32_t arg2,
- uint32_t arg3, uint32_t arg4);
-
-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_spm_id_get(void);
-smc_ret_values ffa_msg_wait(void);
-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 struct ffa_uuid uuid);
-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_rxtx_unmap(void);
-smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
+struct ffa_value ffa_msg_send_direct_req64(ffa_id_t source_id,
+ ffa_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4);
+
+struct ffa_value ffa_msg_send_direct_req32(ffa_id_t source_id,
+ ffa_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4);
+
+struct ffa_value ffa_msg_send_direct_resp64(ffa_id_t source_id,
+ ffa_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4);
+
+struct ffa_value ffa_msg_send_direct_resp32(ffa_id_t source_id,
+ ffa_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4);
+
+struct ffa_value ffa_run(uint32_t dest_id, uint32_t vcpu_id);
+struct ffa_value ffa_version(uint32_t input_version);
+struct ffa_value ffa_id_get(void);
+struct ffa_value ffa_spm_id_get(void);
+struct ffa_value ffa_msg_wait(void);
+struct ffa_value ffa_error(int32_t error_code);
+struct ffa_value ffa_features(uint32_t feature);
+struct ffa_value ffa_partition_info_get(const struct ffa_uuid uuid);
+struct ffa_value ffa_rx_release(void);
+struct ffa_value ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
+struct ffa_value ffa_rxtx_unmap(void);
+struct ffa_value ffa_mem_donate(uint32_t descriptor_length,
+ uint32_t fragment_length);
+struct ffa_value ffa_mem_lend(uint32_t descriptor_length,
uint32_t fragment_length);
-smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
- uint32_t fragment_length);
-smc_ret_values ffa_mem_share(uint32_t descriptor_length,
- uint32_t fragment_length);
-smc_ret_values ffa_mem_retrieve_req(uint32_t descriptor_length,
- uint32_t fragment_length);
-smc_ret_values ffa_mem_relinquish(void);
-smc_ret_values ffa_mem_reclaim(uint64_t handle, uint32_t flags);
-smc_ret_values ffa_notification_bitmap_create(ffa_id_t vm_id,
- ffa_vcpu_count_t vcpu_count);
-smc_ret_values ffa_notification_bitmap_destroy(ffa_id_t vm_id);
-smc_ret_values ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
- uint32_t flags,
- ffa_notification_bitmap_t notifications);
-smc_ret_values ffa_notification_unbind(ffa_id_t sender, ffa_id_t receiver,
+struct ffa_value ffa_mem_share(uint32_t descriptor_length,
+ uint32_t fragment_length);
+struct ffa_value ffa_mem_retrieve_req(uint32_t descriptor_length,
+ uint32_t fragment_length);
+struct ffa_value ffa_mem_relinquish(void);
+struct ffa_value ffa_mem_reclaim(uint64_t handle, uint32_t flags);
+struct ffa_value ffa_notification_bitmap_create(ffa_id_t vm_id,
+ ffa_vcpu_count_t vcpu_count);
+struct ffa_value ffa_notification_bitmap_destroy(ffa_id_t vm_id);
+struct ffa_value ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
+ uint32_t flags,
ffa_notification_bitmap_t notifications);
-smc_ret_values ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
- uint32_t flags,
- ffa_notification_bitmap_t bitmap);
-smc_ret_values ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
- uint32_t flags);
-smc_ret_values ffa_notification_info_get(void);
+struct ffa_value ffa_notification_unbind(ffa_id_t sender, ffa_id_t receiver,
+ ffa_notification_bitmap_t notifications);
+struct ffa_value ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
+ uint32_t flags,
+ ffa_notification_bitmap_t bitmap);
+struct ffa_value ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
+ uint32_t flags);
+struct ffa_value ffa_notification_info_get(void);
#endif /* __ASSEMBLY__ */
#endif /* FFA_HELPERS_H */
diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h
index f187ed7..6dc0e22 100644
--- a/include/runtime_services/spm_common.h
+++ b/include/runtime_services/spm_common.h
@@ -83,13 +83,13 @@ struct mailbox_buffers {
/**
* Helpers to evaluate returns of FF-A calls.
*/
-bool is_ffa_call_error(smc_ret_values val);
-bool is_expected_ffa_error(smc_ret_values ret, int32_t error_code);
-bool is_ffa_direct_response(smc_ret_values ret);
-bool is_expected_ffa_return(smc_ret_values ret, uint32_t func_id);
-bool is_expected_cactus_response(smc_ret_values ret, uint32_t expected_resp,
+bool is_ffa_call_error(struct ffa_value val);
+bool is_expected_ffa_error(struct ffa_value ret, int32_t error_code);
+bool is_ffa_direct_response(struct ffa_value ret);
+bool is_expected_ffa_return(struct ffa_value ret, uint32_t func_id);
+bool is_expected_cactus_response(struct ffa_value ret, uint32_t expected_resp,
uint32_t arg);
-void dump_smc_ret_values(smc_ret_values ret);
+void dump_ffa_value(struct ffa_value ret);
/*
* Vector length:
@@ -140,13 +140,13 @@ bool memory_relinquish(struct ffa_mem_relinquish *m, uint64_t handle,
ffa_memory_handle_t memory_send(
struct ffa_memory_region *memory_region, uint32_t mem_func,
- uint32_t fragment_length, uint32_t total_length, smc_ret_values *ret);
+ uint32_t fragment_length, uint32_t total_length, struct ffa_value *ret);
ffa_memory_handle_t memory_init_and_send(
struct ffa_memory_region *memory_region, size_t memory_region_max_size,
ffa_id_t sender, ffa_id_t receiver,
const struct ffa_memory_region_constituent* constituents,
- uint32_t constituents_count, uint32_t mem_func, smc_ret_values *ret);
+ uint32_t constituents_count, uint32_t mem_func, struct ffa_value *ret);
bool ffa_partition_info_helper(struct mailbox_buffers *mb,
const struct ffa_uuid uuid,
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 74baee5..6e6f2da 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -37,7 +37,6 @@ CACTUS_SOURCES := \
cactus_main.c \
) \
$(addprefix spm/common/, \
- aarch64/sp_arch_helpers.S \
sp_debug.c \
sp_helpers.c \
spm_helpers.c \
@@ -54,11 +53,12 @@ CACTUS_SOURCES := \
)
# TODO: Remove dependency on TFTF files.
-CACTUS_SOURCES += \
- tftf/framework/debug.c \
- tftf/framework/${ARCH}/asm_debug.S \
- tftf/tests/runtime_services/secure_service/ffa_helpers.c \
- tftf/tests/runtime_services/secure_service/spm_common.c \
+CACTUS_SOURCES += \
+ tftf/framework/debug.c \
+ tftf/framework/${ARCH}/asm_debug.S \
+ tftf/tests/runtime_services/secure_service/${ARCH}/ffa_arch_helpers.S \
+ tftf/tests/runtime_services/secure_service/ffa_helpers.c \
+ tftf/tests/runtime_services/secure_service/spm_common.c \
tftf/framework/${ARCH}/exception_report.c
CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 8138565..56cf21d 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -17,6 +17,7 @@
#include <lib/xlat_tables/xlat_mmu_helpers.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <ffa_helpers.h>
#include <plat_arm.h>
#include <plat/common/platform.h>
#include <platform_def.h>
@@ -49,7 +50,7 @@ ffa_id_t g_ffa_id;
static void __dead2 message_loop(ffa_id_t vm_id, struct mailbox_buffers *mb)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
ffa_id_t destination;
/*
@@ -226,10 +227,10 @@ void __dead2 cactus_main(bool primary_cold_boot,
assert(IS_IN_EL1() != 0);
struct mailbox_buffers mb;
- smc_ret_values ret;
+ struct ffa_value ret;
/* Get current FFA id */
- smc_ret_values ffa_id_ret = ffa_id_get();
+ struct ffa_value ffa_id_ret = ffa_id_get();
ffa_id_t ffa_id = ffa_endpoint_id(ffa_id_ret);
if (ffa_func_id(ffa_id_ret) != FFA_SUCCESS_SMC32) {
ERROR("FFA_ID_GET failed.\n");
diff --git a/spm/cactus/cactus_tests/cactus_message_loop.c b/spm/cactus/cactus_tests/cactus_message_loop.c
index 750c954..2cd54c1 100644
--- a/spm/cactus/cactus_tests/cactus_message_loop.c
+++ b/spm/cactus/cactus_tests/cactus_message_loop.c
@@ -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
*/
@@ -35,7 +35,7 @@ extern struct cactus_cmd_handler cactus_cmd_handler_end[];
* Traverses command table from section ".cactus_handler", searches for a
* registered command and invokes the respective handler.
*/
-bool cactus_handle_cmd(smc_ret_values *cmd_args, smc_ret_values *ret,
+bool cactus_handle_cmd(struct ffa_value *cmd_args, struct ffa_value *ret,
struct mailbox_buffers *mb)
{
uint64_t in_cmd;
diff --git a/spm/cactus/cactus_tests/cactus_test_direct_messaging.c b/spm/cactus/cactus_tests/cactus_test_direct_messaging.c
index 9b9d1aa..93bcba1 100644
--- a/spm/cactus/cactus_tests/cactus_test_direct_messaging.c
+++ b/spm/cactus/cactus_tests/cactus_test_direct_messaging.c
@@ -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
*/
@@ -23,7 +23,7 @@ CACTUS_CMD_HANDLER(echo_cmd, CACTUS_ECHO_CMD)
CACTUS_CMD_HANDLER(req_echo_cmd, CACTUS_REQ_ECHO_CMD)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
ffa_id_t vm_id = ffa_dir_msg_dest(*args);
ffa_id_t echo_dest = cactus_req_echo_get_echo_dest(*args);
uint64_t echo_val = cactus_echo_get_val(*args);
@@ -48,12 +48,12 @@ CACTUS_CMD_HANDLER(req_echo_cmd, CACTUS_REQ_ECHO_CMD)
return cactus_success_resp(vm_id, ffa_dir_msg_source(*args), 0);
}
-static smc_ret_values base_deadlock_handler(ffa_id_t vm_id,
- ffa_id_t source,
- ffa_id_t deadlock_dest,
- ffa_id_t deadlock_next_dest)
+static struct ffa_value base_deadlock_handler(ffa_id_t vm_id,
+ ffa_id_t source,
+ ffa_id_t deadlock_dest,
+ ffa_id_t deadlock_next_dest)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
ffa_ret = cactus_deadlock_send_cmd(vm_id, deadlock_dest,
deadlock_next_dest);
diff --git a/spm/cactus/cactus_tests/cactus_test_ffa.c b/spm/cactus/cactus_tests/cactus_test_ffa.c
index bca3984..7e6bf9e 100644
--- a/spm/cactus/cactus_tests/cactus_test_ffa.c
+++ b/spm/cactus/cactus_tests/cactus_test_ffa.c
@@ -71,7 +71,7 @@ static const struct ffa_partition_info ffa_expected_partition_info[] = {
static void ffa_features_test(void)
{
const char *test_features = "FFA Features interface";
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
unsigned int expected_ret;
const struct ffa_features_test *ffa_feature_test_target;
unsigned int i, test_target_size =
@@ -109,7 +109,7 @@ static void ffa_partition_info_wrong_test(void)
announce_test_start(test_wrong_uuid);
- smc_ret_values ret = ffa_partition_info_get(uuid);
+ struct ffa_value ret = ffa_partition_info_get(uuid);
expect(ffa_func_id(ret), FFA_ERROR);
expect(ffa_error_code(ret), FFA_ERROR_INVALID_PARAMETER);
@@ -146,8 +146,10 @@ void ffa_version_test(void)
announce_test_start(test_ffa_version);
- smc_ret_values ret = ffa_version(MAKE_FFA_VERSION(FFA_MAJOR, FFA_MINOR));
- spm_version = (uint32_t)ret.ret0;
+ struct ffa_value ret = ffa_version(MAKE_FFA_VERSION(FFA_MAJOR,
+ FFA_MINOR));
+
+ spm_version = (uint32_t)ret.fid;
bool ffa_version_compatible =
((spm_version >> FFA_VERSION_MAJOR_SHIFT) == FFA_MAJOR &&
@@ -170,7 +172,7 @@ void ffa_spm_id_get_test(void)
announce_test_start(test_spm_id_get);
if (spm_version >= MAKE_FFA_VERSION(1, 1)) {
- smc_ret_values ret = ffa_spm_id_get();
+ struct ffa_value ret = ffa_spm_id_get();
expect(ffa_func_id(ret), FFA_SUCCESS_SMC32);
diff --git a/spm/cactus/cactus_tests/cactus_test_interrupts.c b/spm/cactus/cactus_tests/cactus_test_interrupts.c
index dc64512..31ba7ca 100644
--- a/spm/cactus/cactus_tests/cactus_test_interrupts.c
+++ b/spm/cactus/cactus_tests/cactus_test_interrupts.c
@@ -44,7 +44,7 @@ CACTUS_CMD_HANDLER(sleep_cmd, CACTUS_SLEEP_CMD)
CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
ffa_id_t vm_id = ffa_dir_msg_dest(*args);
ffa_id_t fwd_dest = cactus_get_fwd_sleep_dest(*args);
uint32_t sleep_ms = cactus_get_sleep_time(*args);
@@ -54,7 +54,7 @@ CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD)
ffa_ret = cactus_sleep_cmd(vm_id, fwd_dest, sleep_ms);
- while (ffa_ret.ret0 == FFA_INTERRUPT) {
+ while (ffa_func_id(ffa_ret) == FFA_INTERRUPT) {
/* Received FFA_INTERRUPT in blocked state. */
VERBOSE("Processing FFA_INTERRUPT while blocked on direct response\n");
unsigned int my_core_pos = platform_get_core_pos(read_mpidr_el1());
diff --git a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
index 884240b..e67ff42 100644
--- a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
+++ b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
@@ -181,7 +181,7 @@ CACTUS_CMD_HANDLER(mem_send_cmd, CACTUS_MEM_SEND_CMD)
CACTUS_CMD_HANDLER(req_mem_send_cmd, CACTUS_REQ_MEM_SEND_CMD)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
uint32_t mem_func = cactus_req_mem_send_get_mem_func(*args);
ffa_id_t receiver = cactus_req_mem_send_get_receiver(*args);
ffa_memory_handle_t handle;
diff --git a/spm/cactus/cactus_tests/cactus_test_notifications.c b/spm/cactus/cactus_tests/cactus_test_notifications.c
index bd293f9..947c8e0 100644
--- a/spm/cactus/cactus_tests/cactus_test_notifications.c
+++ b/spm/cactus/cactus_tests/cactus_test_notifications.c
@@ -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
*/
@@ -51,7 +51,7 @@ CACTUS_CMD_HANDLER(notifications_bind, CACTUS_NOTIFICATION_BIND_CMD)
ffa_notification_bitmap_t notifications =
cactus_notification_get_notifications(*args);
uint32_t flags = cactus_notification_get_flags(*args);
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("Partition %x requested to bind notifications '%llx' to %x\n",
source, notifications, receiver);
@@ -73,7 +73,7 @@ CACTUS_CMD_HANDLER(notifications_unbind, CACTUS_NOTIFICATION_UNBIND_CMD)
ffa_id_t sender = cactus_notification_get_sender(*args);
ffa_notification_bitmap_t notifications =
cactus_notification_get_notifications(*args);
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("Partition %x requested to unbind notifications '%llx' to %x\n",
source, notifications, receiver);
@@ -95,7 +95,7 @@ CACTUS_CMD_HANDLER(notifications_get, CACTUS_NOTIFICATION_GET_CMD)
cactus_notification_get_receiver(*args);
uint32_t flags = cactus_notification_get_flags(*args);
uint32_t vcpu_id = cactus_notification_get_vcpu(*args);
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("Partition %x requested to get notifications.\n", source);
@@ -139,7 +139,7 @@ CACTUS_CMD_HANDLER(notifications_set, CACTUS_NOTIFICATIONS_SET_CMD)
ffa_id_t sender = cactus_notifications_set_get_sender(*args);
ffa_id_t echo_dest = cactus_req_echo_get_echo_dest(*args);
uint32_t flags = cactus_notification_get_flags(*args);
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("Partition %x requested to set notifications.\n", source);
diff --git a/spm/cactus/cactus_tests/cactus_tests_smmuv3.c b/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
index fbf46c8..fac9514 100644
--- a/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
+++ b/spm/cactus/cactus_tests/cactus_tests_smmuv3.c
@@ -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
*/
@@ -150,7 +150,7 @@ static bool run_smmuv3_test(void)
CACTUS_CMD_HANDLER(smmuv3_cmd, CACTUS_DMA_SMMUv3_CMD)
{
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
ffa_id_t vm_id = ffa_dir_msg_dest(*args);
ffa_id_t source = ffa_dir_msg_source(*args);
diff --git a/spm/common/sp_debug.c b/spm/common/sp_debug.c
index 396253b..2e67be3 100644
--- a/spm/common/sp_debug.c
+++ b/spm/common/sp_debug.c
@@ -1,13 +1,13 @@
/*
- * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <drivers/arm/pl011.h>
#include <drivers/console.h>
+#include <ffa_helpers.h>
#include <sp_debug.h>
-#include <sp_helpers.h>
#include <spm_helpers.h>
static int (*putc_impl)(int);
@@ -21,12 +21,11 @@ static int putc_hypcall(int c)
static int putc_svccall(int c)
{
- /* TODO svc call */
- svc_args args = {
+ struct ffa_value args = {
.fid = SPM_DEBUG_LOG,
.arg1 = c
};
- sp_svc(&args);
+ ffa_svc(&args);
return c;
}
diff --git a/spm/ivy/app/ivy_main.c b/spm/ivy/app/ivy_main.c
index 232ab2e..1aafb57 100644
--- a/spm/ivy/app/ivy_main.c
+++ b/spm/ivy/app/ivy_main.c
@@ -9,7 +9,6 @@
#include <errno.h>
#include <ffa_helpers.h>
#include <sp_debug.h>
-#include <sp_helpers.h>
#include "ivy.h"
@@ -19,46 +18,35 @@ extern const char version_string[];
void __dead2 ivy_main(void)
{
- u_register_t ret;
- svc_args args;
+ struct ffa_value ret;
ffa_id_t my_id;
set_putc_impl(SVC_CALL_AS_STDOUT);
/* Get FF-A id. */
- args = (svc_args){.fid = FFA_ID_GET};
- ret = sp_svc(&args);
- if (ret != FFA_SUCCESS_SMC32) {
+ ret = ffa_id_get();
+ if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) {
ERROR("Cannot get FF-A id.\n");
panic();
}
- my_id = (ffa_id_t)args.arg2;
+ my_id = ffa_endpoint_id(ret);
NOTICE("Booting Secure Partition (ID: %x)\n", my_id);
NOTICE("%s\n", build_message);
NOTICE("%s\n", version_string);
init:
- args = (svc_args) {.fid = FFA_MSG_WAIT};
- ret = sp_svc(&args);
+ ret = ffa_msg_wait();
while (1) {
- ffa_id_t req_sender = (ffa_id_t)(args.arg1 >> 16);
-
- if (ret != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
- ERROR("unknown FF-A request %lx\n", ret);
+ if (ffa_func_id(ret) != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
+ ERROR("unknown FF-A request %x\n", ffa_func_id(ret));
goto init;
}
- VERBOSE("Received request: %lx\n", args.arg3);
-
-
- args.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32;
- args.arg1 = ((u_register_t)my_id) << 16 |
- (u_register_t)req_sender;
- args.arg2 = 0;
- args.arg3 = 0;
+ VERBOSE("Received request: %lx\n", ret.ret3);
- ret = sp_svc(&args);
+ ret = ffa_msg_send_direct_resp32(my_id, ffa_dir_msg_source(ret),
+ 0, 0, 0, 0, 0);
}
}
diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk
index 9531f9b..e996a7c 100644
--- a/spm/ivy/ivy.mk
+++ b/spm/ivy/ivy.mk
@@ -42,7 +42,6 @@ IVY_SOURCES := \
ivy_main.c \
) \
$(addprefix spm/common/, \
- aarch64/sp_arch_helpers.S \
sp_debug.c \
sp_helpers.c \
spm_helpers.c \
@@ -61,6 +60,7 @@ endif
IVY_SOURCES += \
tftf/framework/debug.c \
tftf/framework/${ARCH}/asm_debug.S \
+ tftf/tests/runtime_services/secure_service/${ARCH}/ffa_arch_helpers.S \
tftf/tests/runtime_services/secure_service/ffa_helpers.c
IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c
index 1a6ea64..6b966da 100644
--- a/tftf/tests/common/test_helpers.c
+++ b/tftf/tests/common/test_helpers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -229,7 +229,7 @@ bool spm_core_sp_init(ffa_id_t sp_id)
*/
if (sp_id != SP_ID(1)) {
uint32_t core_pos = get_current_core_id();
- smc_ret_values ret = ffa_run(sp_id, core_pos);
+ struct ffa_value ret = ffa_run(sp_id, core_pos);
if (ffa_func_id(ret) != FFA_MSG_WAIT) {
ERROR("Failed to run SP%x on core %u\n",
@@ -243,7 +243,7 @@ bool spm_core_sp_init(ffa_id_t sp_id)
bool spm_set_managed_exit_int(ffa_id_t sp_id, bool enable)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ret = cactus_interrupt_cmd(HYP_ID, sp_id, MANAGED_EXIT_INTERRUPT_ID,
enable, INTERRUPT_TYPE_FIQ);
@@ -263,7 +263,7 @@ bool spm_set_managed_exit_int(ffa_id_t sp_id, bool enable)
*/
bool mailbox_init(struct mailbox_buffers mb)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ffa_rxtx_unmap();
CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret);
diff --git a/tftf/tests/misc_tests/test_invalid_access.c b/tftf/tests/misc_tests/test_invalid_access.c
index 8b79caf..14be340 100644
--- a/tftf/tests/misc_tests/test_invalid_access.c
+++ b/tftf/tests/misc_tests/test_invalid_access.c
@@ -301,7 +301,7 @@ test_result_t rt_memory_cannot_be_accessed_in_s(void)
sizeof(struct ffa_memory_region_constituent);
ffa_memory_handle_t handle;
struct mailbox_buffers mb;
- smc_ret_values ret;
+ struct ffa_value ret;
if (get_armv9_2_feat_rme_support() == 0U) {
return TEST_RESULT_SKIPPED;
diff --git a/tftf/tests/runtime_services/realm_payload/realm_payload_spm_test.c b/tftf/tests/runtime_services/realm_payload/realm_payload_spm_test.c
index d11c1c9..22c1752 100644
--- a/tftf/tests/runtime_services/realm_payload/realm_payload_spm_test.c
+++ b/tftf/tests/runtime_services/realm_payload/realm_payload_spm_test.c
@@ -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
*/
@@ -114,7 +114,7 @@ static test_result_t send_cactus_echo_cmd(ffa_id_t sender,
ffa_id_t dest,
uint64_t value)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ret = cactus_echo_send_cmd(sender, dest, value);
/*
@@ -144,7 +144,7 @@ static test_result_t run_spm_direct_message(void)
unsigned int mpid = read_mpidr_el1() & MPID_MASK;
unsigned int core_pos = platform_get_core_pos(mpid);
test_result_t ret = TEST_RESULT_SUCCESS;
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
/*
* Send a direct message request to SP1 (MP SP) from current physical
diff --git a/tftf/tests/runtime_services/secure_service/aarch32/ffa_arch_helpers.S b/tftf/tests/runtime_services/secure_service/aarch32/ffa_arch_helpers.S
new file mode 100644
index 0000000..0d5395f
--- /dev/null
+++ b/tftf/tests/runtime_services/secure_service/aarch32/ffa_arch_helpers.S
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+
+ .macro service_call _conduit
+ /* Push r9 to keep the stack pointer aligned to 64 bit. */
+ push {r4 - r9}
+
+ /*
+ * Save the ffa_value pointer in a callee saved register.
+ */
+ mov r8, r0
+
+ /* Load the argument values into the appropriate registers. */
+ ldm r0, {r0 - r7}
+
+ \_conduit #0
+
+ /*
+ * The return values are stored in x0-x7, put them in the ffa_value
+ * return structure.
+ */
+ stm r8, {r0 - r7}
+
+ pop {r4 - r9}
+ .endm
+
+.globl ffa_svc
+func ffa_svc
+ service_call svc
+ bx lr
+endfunc ffa_svc
+
+.globl ffa_smc
+func ffa_smc
+ service_call smc
+ bx lr
+endfunc ffa_smc
diff --git a/tftf/tests/runtime_services/secure_service/aarch64/ffa_arch_helpers.S b/tftf/tests/runtime_services/secure_service/aarch64/ffa_arch_helpers.S
new file mode 100644
index 0000000..0e35a38
--- /dev/null
+++ b/tftf/tests/runtime_services/secure_service/aarch64/ffa_arch_helpers.S
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+
+ .macro service_call _conduit
+ /*
+ * Save the address of the ffa_value structure on the stack.
+ *
+ * Although x0 contains an 8-byte value, we are allocating 16 bytes
+ * on the stack to respect the 16-byte stack-alignment.
+ */
+ str x0, [sp, #-16]!
+
+ /* Load the argument values into the appropriate registers. */
+ ldp x6, x7, [x0, #48]
+ ldp x4, x5, [x0, #32]
+ ldp x2, x3, [x0, #16]
+ ldp x0, x1, [x0, #0]
+
+ \_conduit #0
+
+ /*
+ * Pop the ffa_value structure address from the stack into a
+ * caller-saved register.
+ */
+ ldr x9, [sp], #16
+
+ /*
+ * The return values are stored in x0-x7, put them in the ffa_value
+ * return structure.
+ */
+ stp x0, x1, [x9, #0]
+ stp x2, x3, [x9, #16]
+ stp x4, x5, [x9, #32]
+ stp x6, x7, [x9, #48]
+
+ .endm
+
+.globl ffa_svc
+func ffa_svc
+ service_call svc
+ ret
+endfunc ffa_svc
+
+.globl ffa_smc
+func ffa_smc
+ service_call smc
+ ret
+endfunc ffa_smc
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index 4525d6e..e5c2590 100644
--- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -9,6 +9,16 @@
#include <ffa_helpers.h>
#include <ffa_svc.h>
+struct ffa_value ffa_service_call(struct ffa_value *args)
+{
+#if IMAGE_IVY
+ ffa_svc(args);
+#else
+ ffa_smc(args);
+#endif
+ return *args;
+}
+
/*-----------------------------------------------------------------------------
* FFA_RUN
*
@@ -26,15 +36,15 @@
* -BUSY: vCPU is busy and caller must retry later
* -ABORTED: vCPU or VM ran into an unexpected error and has aborted
*/
-smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id)
+struct ffa_value ffa_run(uint32_t dest_id, uint32_t vcpu_id)
{
- smc_args args = {
+ struct ffa_value args = {
FFA_MSG_RUN,
(dest_id << 16) | vcpu_id,
0, 0, 0, 0, 0, 0
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/*-----------------------------------------------------------------------------
@@ -55,12 +65,12 @@ 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
*/
-smc_ret_values ffa_msg_send_direct_req64(ffa_id_t source_id,
- ffa_id_t dest_id, uint64_t arg0,
- uint64_t arg1, uint64_t arg2,
- uint64_t arg3, uint64_t arg4)
+struct ffa_value ffa_msg_send_direct_req64(ffa_id_t source_id,
+ ffa_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MSG_SEND_DIRECT_REQ_SMC64,
.arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
.arg2 = 0,
@@ -71,15 +81,15 @@ smc_ret_values ffa_msg_send_direct_req64(ffa_id_t source_id,
.arg7 = arg4,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_msg_send_direct_req32(ffa_id_t source_id,
- ffa_id_t dest_id, uint32_t arg0,
- uint32_t arg1, uint32_t arg2,
- uint32_t arg3, uint32_t arg4)
+struct ffa_value ffa_msg_send_direct_req32(ffa_id_t source_id,
+ ffa_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MSG_SEND_DIRECT_REQ_SMC32,
.arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
.arg2 = 0,
@@ -90,15 +100,15 @@ smc_ret_values ffa_msg_send_direct_req32(ffa_id_t source_id,
.arg7 = arg4,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_msg_send_direct_resp64(ffa_id_t source_id,
- ffa_id_t dest_id, uint64_t arg0,
- uint64_t arg1, uint64_t arg2,
- uint64_t arg3, uint64_t arg4)
+struct ffa_value ffa_msg_send_direct_resp64(ffa_id_t source_id,
+ ffa_id_t dest_id, uint64_t arg0,
+ uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MSG_SEND_DIRECT_RESP_SMC64,
.arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
.arg2 = 0,
@@ -109,15 +119,15 @@ smc_ret_values ffa_msg_send_direct_resp64(ffa_id_t source_id,
.arg7 = arg4,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_msg_send_direct_resp32(ffa_id_t source_id,
- ffa_id_t dest_id, uint32_t arg0,
- uint32_t arg1, uint32_t arg2,
- uint32_t arg3, uint32_t arg4)
+struct ffa_value ffa_msg_send_direct_resp32(ffa_id_t source_id,
+ ffa_id_t dest_id, uint32_t arg0,
+ uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32,
.arg1 = ((uint32_t)(source_id << 16)) | (dest_id),
.arg2 = 0,
@@ -128,7 +138,7 @@ smc_ret_values ffa_msg_send_direct_resp32(ffa_id_t source_id,
.arg7 = arg4,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
@@ -297,69 +307,69 @@ uint32_t ffa_memory_retrieve_request_init(
* -Bits[30:16]: Major version.
* -Bits[15:0]: Minor version.
*/
-smc_ret_values ffa_version(uint32_t input_version)
+struct ffa_value ffa_version(uint32_t input_version)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_VERSION,
.arg1 = input_version
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_id_get(void)
+struct ffa_value ffa_id_get(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_ID_GET
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_spm_id_get(void)
+struct ffa_value ffa_spm_id_get(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_SPM_ID_GET
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_msg_wait(void)
+struct ffa_value ffa_msg_wait(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MSG_WAIT
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_error(int32_t error_code)
+struct ffa_value ffa_error(int32_t error_code)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_ERROR,
.arg1 = 0,
.arg2 = error_code
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Query the higher EL if the requested FF-A feature is implemented. */
-smc_ret_values ffa_features(uint32_t feature)
+struct ffa_value ffa_features(uint32_t feature)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_FEATURES,
.arg1 = feature
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Get information about VMs or SPs based on UUID */
-smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid)
+struct ffa_value ffa_partition_info_get(const struct ffa_uuid uuid)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_PARTITION_INFO_GET,
.arg1 = uuid.uuid[0],
.arg2 = uuid.uuid[1],
@@ -367,23 +377,23 @@ smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid)
.arg4 = uuid.uuid[3]
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Query SPMD that the rx buffer of the partition can be released */
-smc_ret_values ffa_rx_release(void)
+struct ffa_value ffa_rx_release(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_RX_RELEASE
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Map the RXTX buffer */
-smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages)
+struct ffa_value ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_RXTX_MAP_SMC64,
.arg1 = send,
.arg2 = recv,
@@ -394,13 +404,13 @@ smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages)
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Unmap the RXTX buffer allocated by the given FF-A component */
-smc_ret_values ffa_rxtx_unmap(void)
+struct ffa_value ffa_rxtx_unmap(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_RXTX_UNMAP,
.arg1 = FFA_PARAM_MBZ,
.arg2 = FFA_PARAM_MBZ,
@@ -411,14 +421,14 @@ smc_ret_values ffa_rxtx_unmap(void)
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Donate memory to another partition */
-smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
+struct ffa_value ffa_mem_donate(uint32_t descriptor_length,
uint32_t fragment_length)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_DONATE_SMC32,
.arg1 = descriptor_length,
.arg2 = fragment_length,
@@ -426,14 +436,14 @@ smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
.arg4 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Lend memory to another partition */
-smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
- uint32_t fragment_length)
+struct ffa_value ffa_mem_lend(uint32_t descriptor_length,
+ uint32_t fragment_length)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_LEND_SMC32,
.arg1 = descriptor_length,
.arg2 = fragment_length,
@@ -441,14 +451,14 @@ smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
.arg4 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Share memory with another partition */
-smc_ret_values ffa_mem_share(uint32_t descriptor_length,
- uint32_t fragment_length)
+struct ffa_value ffa_mem_share(uint32_t descriptor_length,
+ uint32_t fragment_length)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_SHARE_SMC32,
.arg1 = descriptor_length,
.arg2 = fragment_length,
@@ -456,14 +466,14 @@ smc_ret_values ffa_mem_share(uint32_t descriptor_length,
.arg4 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Retrieve memory shared by another partition */
-smc_ret_values ffa_mem_retrieve_req(uint32_t descriptor_length,
- uint32_t fragment_length)
+struct ffa_value ffa_mem_retrieve_req(uint32_t descriptor_length,
+ uint32_t fragment_length)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_RETRIEVE_REQ_SMC32,
.arg1 = descriptor_length,
.arg2 = fragment_length,
@@ -474,37 +484,37 @@ smc_ret_values ffa_mem_retrieve_req(uint32_t descriptor_length,
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Relinquish access to memory region */
-smc_ret_values ffa_mem_relinquish(void)
+struct ffa_value ffa_mem_relinquish(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_RELINQUISH,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/* Reclaim exclusive access to owned memory region */
-smc_ret_values ffa_mem_reclaim(uint64_t handle, uint32_t flags)
+struct ffa_value ffa_mem_reclaim(uint64_t handle, uint32_t flags)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_MEM_RECLAIM,
.arg1 = (uint32_t) handle,
.arg2 = (uint32_t) (handle >> 32),
.arg3 = flags
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/** Create Notifications Bitmap for the given VM */
-smc_ret_values ffa_notification_bitmap_create(ffa_id_t vm_id,
- ffa_vcpu_count_t vcpu_count)
+struct ffa_value ffa_notification_bitmap_create(ffa_id_t vm_id,
+ ffa_vcpu_count_t vcpu_count)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_BITMAP_CREATE,
.arg1 = vm_id,
.arg2 = vcpu_count,
@@ -515,13 +525,13 @@ smc_ret_values ffa_notification_bitmap_create(ffa_id_t vm_id,
.arg7 = FFA_PARAM_MBZ,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/** Destroy Notifications Bitmap for the given VM */
-smc_ret_values ffa_notification_bitmap_destroy(ffa_id_t vm_id)
+struct ffa_value ffa_notification_bitmap_destroy(ffa_id_t vm_id)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_BITMAP_DESTROY,
.arg1 = vm_id,
.arg2 = FFA_PARAM_MBZ,
@@ -532,15 +542,15 @@ smc_ret_values ffa_notification_bitmap_destroy(ffa_id_t vm_id)
.arg7 = FFA_PARAM_MBZ,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/** Bind VM to all the notifications in the bitmap */
-smc_ret_values ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
- uint32_t flags,
- ffa_notification_bitmap_t bitmap)
+struct ffa_value ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
+ uint32_t flags,
+ ffa_notification_bitmap_t bitmap)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_BIND,
.arg1 = (sender << 16) | (receiver),
.arg2 = flags,
@@ -551,15 +561,15 @@ smc_ret_values ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
.arg7 = FFA_PARAM_MBZ,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
/** Unbind previously bound VM from notifications in bitmap */
-smc_ret_values ffa_notification_unbind(ffa_id_t sender,
- ffa_id_t receiver,
- ffa_notification_bitmap_t bitmap)
+struct ffa_value ffa_notification_unbind(ffa_id_t sender,
+ ffa_id_t receiver,
+ ffa_notification_bitmap_t bitmap)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_UNBIND,
.arg1 = (sender << 16) | (receiver),
.arg2 = FFA_PARAM_MBZ,
@@ -570,14 +580,14 @@ smc_ret_values ffa_notification_unbind(ffa_id_t sender,
.arg7 = FFA_PARAM_MBZ,
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
- uint32_t flags,
- ffa_notification_bitmap_t bitmap)
+struct ffa_value ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
+ uint32_t flags,
+ ffa_notification_bitmap_t bitmap)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_SET,
.arg1 = (sender << 16) | (receiver),
.arg2 = flags,
@@ -588,13 +598,13 @@ smc_ret_values ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
- uint32_t flags)
+struct ffa_value ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
+ uint32_t flags)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_GET,
.arg1 = (vcpu_id << 16) | (receiver),
.arg2 = flags,
@@ -605,12 +615,12 @@ smc_ret_values ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
-smc_ret_values ffa_notification_info_get(void)
+struct ffa_value ffa_notification_info_get(void)
{
- smc_args args = {
+ struct ffa_value args = {
.fid = FFA_NOTIFICATION_INFO_GET_SMC64,
.arg1 = FFA_PARAM_MBZ,
.arg2 = FFA_PARAM_MBZ,
@@ -621,5 +631,5 @@ smc_ret_values ffa_notification_info_get(void)
.arg7 = FFA_PARAM_MBZ
};
- return tftf_smc(&args);
+ return ffa_service_call(&args);
}
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index 4181588..efdaa3f 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -23,7 +23,7 @@
/**
* Helper to log errors after FF-A calls.
*/
-bool is_ffa_call_error(smc_ret_values ret)
+bool is_ffa_call_error(struct ffa_value ret)
{
if (ffa_func_id(ret) == FFA_ERROR) {
VERBOSE("FF-A call returned error (%x): %d\n",
@@ -33,7 +33,7 @@ bool is_ffa_call_error(smc_ret_values ret)
return false;
}
-bool is_expected_ffa_error(smc_ret_values ret, int32_t error_code)
+bool is_expected_ffa_error(struct ffa_value ret, int32_t error_code)
{
if (ffa_func_id(ret) == FFA_ERROR &&
ffa_error_code(ret) == error_code) {
@@ -51,7 +51,7 @@ bool is_expected_ffa_error(smc_ret_values ret, int32_t error_code)
* Should be used after FFA_MSG_SEND_DIRECT_REQ, or after sending a test command
* to an SP.
*/
-bool is_ffa_direct_response(smc_ret_values ret)
+bool is_ffa_direct_response(struct ffa_value ret)
{
if ((ffa_func_id(ret) == FFA_MSG_SEND_DIRECT_RESP_SMC32) ||
(ffa_func_id(ret) == FFA_MSG_SEND_DIRECT_RESP_SMC64)) {
@@ -68,7 +68,7 @@ bool is_ffa_direct_response(smc_ret_values ret)
/**
* Helper to check the return value of FF-A call is as expected.
*/
-bool is_expected_ffa_return(smc_ret_values ret, uint32_t func_id)
+bool is_expected_ffa_return(struct ffa_value ret, uint32_t func_id)
{
if (ffa_func_id(ret) == func_id) {
return true;
@@ -79,7 +79,7 @@ bool is_expected_ffa_return(smc_ret_values ret, uint32_t func_id)
return false;
}
-bool is_expected_cactus_response(smc_ret_values ret, uint32_t expected_resp,
+bool is_expected_cactus_response(struct ffa_value ret, uint32_t expected_resp,
uint32_t arg)
{
if (!is_ffa_direct_response(ret)) {
@@ -87,28 +87,28 @@ bool is_expected_cactus_response(smc_ret_values ret, uint32_t expected_resp,
}
if (cactus_get_response(ret) != expected_resp ||
- (uint32_t)ret.ret4 != arg) {
+ (uint32_t)ret.arg4 != arg) {
ERROR("Expected response %x and %x; "
"Obtained %x and %x\n",
expected_resp, arg, cactus_get_response(ret),
- (int32_t)ret.ret4);
+ (int32_t)ret.arg4);
return false;
}
return true;
}
-void dump_smc_ret_values(smc_ret_values ret)
+void dump_ffa_value(struct ffa_value ret)
{
NOTICE("FF-A value: %lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx\n",
- ret.ret0,
- ret.ret1,
- ret.ret2,
- ret.ret3,
- ret.ret4,
- ret.ret5,
- ret.ret6,
- ret.ret7);
+ ret.fid,
+ ret.arg1,
+ ret.arg2,
+ ret.arg3,
+ ret.arg4,
+ ret.arg5,
+ ret.arg6,
+ ret.arg7);
}
void fill_simd_vector_regs(const simd_vector_t v[SIMD_NUM_VECTORS])
@@ -261,7 +261,7 @@ void read_sve_vector_regs(sve_vector_t v[SVE_NUM_VECTORS])
bool check_spmc_execution_level(void)
{
unsigned int is_optee_spmc_criteria = 0U;
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
/*
* Send a first OP-TEE-defined protocol message through
@@ -270,8 +270,8 @@ bool check_spmc_execution_level(void)
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 == 1 &&
- (ret_values.ret4 == 0 || ret_values.ret4 == 1)) {
+ if (ret_values.arg3 == 1 &&
+ (ret_values.arg4 == 0 || ret_values.arg4 == 1)) {
is_optee_spmc_criteria++;
}
@@ -282,8 +282,8 @@ bool check_spmc_execution_level(void)
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)) {
+ if ((ret_values.arg3 == OPTEE_FFA_GET_OS_VERSION_MAJOR) &&
+ (ret_values.arg4 == OPTEE_FFA_GET_OS_VERSION_MINOR)) {
is_optee_spmc_criteria++;
}
@@ -353,7 +353,7 @@ bool memory_retrieve(struct mailbox_buffers *mb,
ffa_id_t sender, ffa_id_t receiver,
ffa_memory_region_flags_t flags)
{
- smc_ret_values ret;
+ struct ffa_value ret;
uint32_t fragment_size;
uint32_t total_size;
uint32_t descriptor_size;
@@ -388,8 +388,8 @@ bool memory_retrieve(struct mailbox_buffers *mb,
* successful ffa_mem_retrieve_req, total_size must be equal to
* fragment_size.
*/
- total_size = ret.ret1;
- fragment_size = ret.ret2;
+ total_size = ret.arg1;
+ fragment_size = ret.arg2;
if (total_size != fragment_size) {
ERROR("Only expect one memory segment to be sent!\n");
@@ -417,7 +417,7 @@ bool memory_retrieve(struct mailbox_buffers *mb,
bool memory_relinquish(struct ffa_mem_relinquish *m, uint64_t handle,
ffa_id_t id)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ffa_mem_relinquish_init(m, handle, 0, id);
ret = ffa_mem_relinquish();
@@ -441,7 +441,7 @@ bool memory_relinquish(struct ffa_mem_relinquish *m, uint64_t handle,
*/
ffa_memory_handle_t memory_send(
struct ffa_memory_region *memory_region, uint32_t mem_func,
- uint32_t fragment_length, uint32_t total_length, smc_ret_values *ret)
+ uint32_t fragment_length, uint32_t total_length, struct ffa_value *ret)
{
if (fragment_length != total_length) {
ERROR("For now, fragment_length and total_length need to be"
@@ -460,7 +460,7 @@ ffa_memory_handle_t memory_send(
*ret = ffa_mem_donate(total_length, fragment_length);
break;
default:
- *ret = (smc_ret_values){0};
+ *ret = (struct ffa_value){0};
ERROR("TFTF - Invalid func id %x!\n", mem_func);
return FFA_MEMORY_HANDLE_INVALID;
}
@@ -485,7 +485,7 @@ ffa_memory_handle_t memory_init_and_send(
struct ffa_memory_region *memory_region, size_t memory_region_max_size,
ffa_id_t sender, ffa_id_t receiver,
const struct ffa_memory_region_constituent *constituents,
- uint32_t constituents_count, uint32_t mem_func, smc_ret_values *ret)
+ uint32_t constituents_count, uint32_t mem_func, struct ffa_value *ret)
{
uint32_t remaining_constituent_count;
uint32_t total_length;
@@ -526,11 +526,12 @@ bool ffa_partition_info_helper(struct mailbox_buffers *mb,
const uint16_t expected_size)
{
bool result = true;
- smc_ret_values ret = ffa_partition_info_get(uuid);
+ struct ffa_value ret = ffa_partition_info_get(uuid);
if (ffa_func_id(ret) == FFA_SUCCESS_SMC32) {
if (ffa_partition_info_count(ret) != expected_size) {
- ERROR("Unexpected number of partitions %ld\n", ret.ret2);
+ ERROR("Unexpected number of partitions %ld\n",
+ ret.arg2);
return false;
}
const struct ffa_partition_info *info =
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c
index 2eb53ed..5e52f12 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -30,7 +30,7 @@ static test_result_t send_cactus_echo_cmd(ffa_id_t sender,
ffa_id_t dest,
uint64_t value)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ret = cactus_echo_send_cmd(sender, dest, value);
/*
@@ -96,7 +96,7 @@ static test_result_t send_cactus_req_echo_cmd(ffa_id_t sender,
ffa_id_t echo_dest,
uint64_t value)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ret = cactus_req_echo_send_cmd(sender, dest, echo_dest, value);
@@ -141,7 +141,7 @@ test_result_t test_ffa_sp_to_sp_direct_messaging(void)
test_result_t test_ffa_sp_to_sp_deadlock(void)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/**********************************************************************
* Check SPMC has ffa_version and expected FFA endpoints are deployed.
@@ -169,7 +169,7 @@ static test_result_t cpu_on_handler(void)
{
unsigned int core_pos = get_current_core_id();
test_result_t ret = TEST_RESULT_SUCCESS;
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
/*
* Send a direct message request to SP1 (MP SP) from current physical
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c b/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
index ffa2a6f..61cf2ad 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
@@ -47,7 +47,7 @@ test_result_t rl_memory_cannot_be_accessed_in_s(void)
sizeof(struct ffa_memory_region_constituent);
ffa_memory_handle_t handle;
struct mailbox_buffers mb;
- smc_ret_values ret;
+ struct ffa_value ret;
u_register_t retmm;
if (get_armv9_2_feat_rme_support() == 0U) {
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c b/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c
index c92d683..1c17513 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c
@@ -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
*/
@@ -64,7 +64,7 @@ static int timer_handler(void *data)
test_result_t test_ffa_ns_interrupt(void)
{
int ret;
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
CHECK_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
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 7f62ea5..b4d58b2 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
@@ -59,7 +59,7 @@ static bool check_written_words(uint32_t *ptr, uint32_t word, uint32_t wcount)
*/
static test_result_t test_memory_send_sp(uint32_t mem_func)
{
- smc_ret_values ret;
+ struct ffa_value ret;
ffa_memory_handle_t handle;
uint32_t *ptr;
struct mailbox_buffers mb;
@@ -146,7 +146,7 @@ static test_result_t test_req_mem_send_sp_to_sp(uint32_t mem_func,
ffa_id_t receiver_sp,
bool non_secure)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/***********************************************************************
* Check if SPMC's ffa_version and presence of expected FF-A endpoints.
@@ -178,7 +178,7 @@ static test_result_t test_req_mem_send_sp_to_vm(uint32_t mem_func,
ffa_id_t sender_sp,
ffa_id_t receiver_vm)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/**********************************************************************
* Check if SPMC's ffa_version and presence of expected FF-A endpoints.
@@ -259,7 +259,7 @@ test_result_t test_mem_share_to_sp_clear_memory(void)
uint32_t total_length;
uint32_t fragment_length;
ffa_memory_handle_t handle;
- smc_ret_values ret;
+ struct ffa_value ret;
uint32_t *ptr;
/* Arbitrarily write 10 words after using shared memory. */
const uint32_t nr_words_to_write = 10U;
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c b/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
index 7ed8f97..e900ae3 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
@@ -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
*/
@@ -53,7 +53,7 @@ static ffa_notification_bitmap_t g_notifications = FFA_NOTIFICATION(0) |
*/
test_result_t test_notifications_retrieve_int_ids(void)
{
- smc_ret_values ret;
+ struct ffa_value ret;
SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 1);
@@ -104,7 +104,8 @@ static bool notifications_bitmap_create(ffa_id_t vm_id,
{
VERBOSE("Creating bitmap for VM %x; cpu count: %u.\n",
vm_id, vcpu_count);
- smc_ret_values ret = ffa_notification_bitmap_create(vm_id, vcpu_count);
+ struct ffa_value ret = ffa_notification_bitmap_create(vm_id,
+ vcpu_count);
return !is_ffa_call_error(ret);
}
@@ -115,7 +116,7 @@ static bool notifications_bitmap_create(ffa_id_t vm_id,
static bool notifications_bitmap_destroy(ffa_id_t vm_id)
{
VERBOSE("Destroying bitmap of VM %x.\n", vm_id);
- smc_ret_values ret = ffa_notification_bitmap_destroy(vm_id);
+ struct ffa_value ret = ffa_notification_bitmap_destroy(vm_id);
return !is_ffa_call_error(ret);
}
@@ -157,7 +158,7 @@ test_result_t test_ffa_notifications_destroy_not_created(void)
return TEST_RESULT_SKIPPED;
}
- smc_ret_values ret = ffa_notification_bitmap_destroy(VM_ID(1));
+ struct ffa_value ret = ffa_notification_bitmap_destroy(VM_ID(1));
if (!is_expected_ffa_error(ret, FFA_ERROR_DENIED)) {
return TEST_RESULT_FAIL;
@@ -172,7 +173,7 @@ test_result_t test_ffa_notifications_destroy_not_created(void)
*/
test_result_t test_ffa_notifications_create_after_create(void)
{
- smc_ret_values ret;
+ struct ffa_value ret;
const ffa_id_t vm_id = VM_ID(2);
SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 1);
@@ -217,7 +218,7 @@ static bool request_notification_bind(
ffa_notification_bitmap_t notifications, uint32_t flags,
uint32_t expected_resp, uint32_t error_code)
{
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("TFTF requesting SP to bind notifications!\n");
@@ -248,7 +249,7 @@ static bool request_notification_unbind(
ffa_notification_bitmap_t notifications, uint32_t expected_resp,
uint32_t error_code)
{
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("TFTF requesting SP to unbind notifications!\n");
@@ -307,7 +308,7 @@ test_result_t test_ffa_notifications_vm_bind_unbind(void)
{
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
const ffa_id_t vm_id = VM_ID(1);
- smc_ret_values ret;
+ struct ffa_value ret;
if (!notifications_bitmap_create(vm_id, 1)) {
return TEST_RESULT_FAIL;
@@ -340,7 +341,7 @@ test_result_t test_ffa_notifications_vm_bind_vm(void)
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
const ffa_id_t vm_id = VM_ID(1);
const ffa_id_t sender_id = VM_ID(2);
- smc_ret_values ret;
+ struct ffa_value ret;
if (!notifications_bitmap_create(vm_id, 1)) {
return TEST_RESULT_FAIL;
@@ -458,7 +459,7 @@ test_result_t test_ffa_notifications_bind_unbind_zeroed(void)
*/
static bool request_notification_get(
ffa_id_t cmd_dest, ffa_id_t receiver, uint32_t vcpu_id, uint32_t flags,
- bool check_npi_handled, smc_ret_values *response)
+ bool check_npi_handled, struct ffa_value *response)
{
VERBOSE("TFTF requesting SP to get notifications!\n");
@@ -474,7 +475,7 @@ static bool request_notification_set(
ffa_notification_bitmap_t notifications, ffa_id_t echo_dest,
uint32_t exp_resp, int32_t exp_error)
{
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("TFTF requesting SP %x (as %x) to set notifications to %x\n",
cmd_dest, sender, receiver);
@@ -501,7 +502,7 @@ static bool notification_set(ffa_id_t receiver, ffa_id_t sender,
uint32_t flags,
ffa_notification_bitmap_t notifications)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/* Sender sets notifications to receiver. */
if (!IS_SP_ID(sender)) {
@@ -525,7 +526,7 @@ static bool notification_set(ffa_id_t receiver, ffa_id_t sender,
* Check that SP's response to CACTUS_NOTIFICATION_GET_CMD is as expected.
*/
static bool is_notifications_get_as_expected(
- smc_ret_values *ret, uint64_t exp_from_sp, uint64_t exp_from_vm,
+ struct ffa_value *ret, uint64_t exp_from_sp, uint64_t exp_from_vm,
ffa_id_t receiver)
{
uint64_t from_sp;
@@ -564,7 +565,7 @@ static bool is_notifications_get_as_expected(
}
static bool is_notifications_info_get_as_expected(
- smc_ret_values *ret, uint16_t *ids, uint32_t *lists_sizes,
+ struct ffa_value *ret, uint16_t *ids, uint32_t *lists_sizes,
const uint32_t max_ids_count, uint32_t lists_count, bool more_pending)
{
if (lists_count != ffa_notifications_info_get_lists_count(*ret) ||
@@ -573,7 +574,7 @@ static bool is_notifications_info_get_as_expected(
" Lists counts: %u; more pending %u\n",
ffa_notifications_info_get_lists_count(*ret),
ffa_notifications_info_get_more_pending(*ret));
- dump_smc_ret_values(*ret);
+ dump_ffa_value(*ret);
return false;
}
@@ -590,7 +591,7 @@ static bool is_notifications_info_get_as_expected(
}
/* Compare the IDs list */
- if (memcmp(&ret->ret3, ids, sizeof(ids[0]) * max_ids_count) != 0) {
+ if (memcmp(&ret->arg3, ids, sizeof(ids[0]) * max_ids_count) != 0) {
ERROR("List of IDs not as expected\n");
return false;
}
@@ -608,7 +609,7 @@ static bool is_notifications_info_get_as_expected(
static bool notification_bind_and_set(ffa_id_t sender,
ffa_id_t receiver, ffa_notification_bitmap_t notifications, uint32_t flags)
{
- smc_ret_values ret;
+ struct ffa_value ret;
uint32_t flags_bind = flags & FFA_NOTIFICATIONS_FLAG_PER_VCPU;
/* Receiver binds notifications to sender. */
@@ -639,7 +640,7 @@ static bool notification_get_and_validate(
ffa_notification_bitmap_t exp_from_vm, uint32_t vcpu_id,
uint32_t flags, bool check_npi_handled)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/* Receiver gets pending notifications. */
if (IS_SP_ID(receiver)) {
@@ -658,7 +659,7 @@ static bool notifications_info_get(
uint32_t *expected_lists_sizes, const uint32_t max_ids_count,
bool expected_more_pending)
{
- smc_ret_values ret;
+ struct ffa_value ret;
VERBOSE("Getting pending notification's info.\n");
@@ -700,7 +701,7 @@ static bool notification_pending_interrupt_sp_enable(ffa_id_t receiver,
bool enable)
{
VERBOSE("Configuring NPI to receiver: %x\n", receiver);
- smc_ret_values ret = cactus_interrupt_cmd(
+ struct ffa_value ret = cactus_interrupt_cmd(
HYP_ID, receiver, NOTIFICATION_PENDING_INTERRUPT_INTID,
enable, INTERRUPT_TYPE_IRQ);
@@ -836,7 +837,7 @@ test_result_t test_ffa_notifications_sp_signals_vm(void)
const ffa_id_t sender = SP_ID(1);
const ffa_id_t receiver = VM_ID(1);
uint32_t get_flags = FFA_NOTIFICATIONS_FLAG_BITMAP_SP;
- smc_ret_values ret;
+ struct ffa_value ret;
test_result_t result = TEST_RESULT_SUCCESS;
/* Variables to validate calls to FFA_NOTIFICATION_INFO_GET. */
@@ -961,7 +962,7 @@ test_result_t test_ffa_notifications_info_get_none(void)
return TEST_RESULT_SKIPPED;
}
- smc_ret_values ret;
+ struct ffa_value ret;
ret = ffa_notification_info_get();
@@ -1265,7 +1266,7 @@ test_result_t test_ffa_notifications_sp_signals_vm_per_vcpu(void)
const bool exp_more_notif_pending = false;
test_result_t result = TEST_RESULT_SUCCESS;
uint64_t notifications_to_unbind = 0;
- smc_ret_values ret;
+ struct ffa_value ret;
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
@@ -1339,7 +1340,7 @@ test_result_t test_ffa_notifications_sp_signals_sp_immediate_sri(void)
const ffa_id_t sender = SP_ID(1);
const ffa_id_t receiver = SP_ID(2);
uint32_t get_flags = FFA_NOTIFICATIONS_FLAG_BITMAP_SP;
- smc_ret_values ret;
+ struct ffa_value ret;
test_result_t result = TEST_RESULT_SUCCESS;
/** Variables to validate calls to FFA_NOTIFICATION_INFO_GET. */
@@ -1431,7 +1432,7 @@ test_result_t test_ffa_notifications_sp_signals_sp_delayed_sri(void)
const ffa_id_t echo_dest = SP_ID(1);
uint32_t echo_dest_cmd_count = 0;
uint32_t get_flags = FFA_NOTIFICATIONS_FLAG_BITMAP_SP;
- smc_ret_values ret;
+ struct ffa_value ret;
test_result_t result = TEST_RESULT_SUCCESS;
/** Variables to validate calls to FFA_NOTIFICATION_INFO_GET. */
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c b/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
index 8ed590a..ac19c06 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c
@@ -24,7 +24,7 @@ static const struct ffa_uuid expected_sp_uuids[] = {
static bool configure_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest,
bool enable)
{
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
ret_values = cactus_interrupt_cmd(source, dest, IRQ_TWDOG_INTID,
enable, INTERRUPT_TYPE_IRQ);
@@ -96,7 +96,7 @@ static bool disable_trusted_wdog_interrupt(ffa_id_t source, ffa_id_t dest)
test_result_t test_ffa_sec_interrupt_sp_running(void)
{
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
@@ -200,7 +200,7 @@ test_result_t test_ffa_sec_interrupt_sp_waiting(void)
uint64_t time1;
volatile uint64_t time2, time_lapsed;
uint64_t timer_freq = read_cntfrq_el0();
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
@@ -299,7 +299,7 @@ test_result_t test_ffa_sec_interrupt_sp_waiting(void)
*/
test_result_t test_ffa_sec_interrupt_sp_blocked(void)
{
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
@@ -399,7 +399,7 @@ test_result_t test_ffa_sec_interrupt_sp_blocked(void)
*/
test_result_t test_ffa_sec_interrupt_sp1_waiting_sp2_running(void)
{
- smc_ret_values ret_values;
+ struct ffa_value ret_values;
CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
index 1373adf..ad9da1a 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
@@ -76,7 +76,7 @@ test_result_t test_ffa_features(void)
return TEST_RESULT_SUCCESS;
}
- smc_ret_values ffa_ret;
+ struct ffa_value ffa_ret;
unsigned int expected_ret;
const struct ffa_features_test *ffa_feature_test_target;
unsigned int i, test_target_size =
@@ -124,9 +124,9 @@ static test_result_t test_ffa_version(uint32_t input_version,
return TEST_RESULT_SKIPPED;
}
- smc_ret_values ret_values = ffa_version(input_version);
+ struct ffa_value ret_values = ffa_version(input_version);
- uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret_values.ret0);
+ uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret_values.fid);
if (spm_version == expected_return) {
return TEST_RESULT_SUCCESS;
@@ -199,7 +199,7 @@ test_result_t test_ffa_version_smaller(void)
static test_result_t test_ffa_rxtx_map(uint32_t expected_return)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/**********************************************************************
* Verify that FFA is there and that it has the correct version.
@@ -246,7 +246,7 @@ test_result_t test_ffa_rxtx_map_fail(void)
static test_result_t test_ffa_rxtx_unmap(uint32_t expected_return)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/**********************************************************************
* Verify that FFA is there and that it has the correct version.
@@ -309,7 +309,7 @@ test_result_t test_ffa_spm_id_get(void)
{
SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 1);
- smc_ret_values ffa_ret = ffa_spm_id_get();
+ struct ffa_value ffa_ret = ffa_spm_id_get();
if (is_ffa_call_error(ffa_ret)) {
ERROR("FFA_SPM_ID_GET call failed! Error code: 0x%x\n",
@@ -381,7 +381,7 @@ test_result_t test_ffa_partition_info_v1_0(void)
GET_TFTF_MAILBOX(mb);
test_result_t result = TEST_RESULT_SUCCESS;
- smc_ret_values ret = ffa_partition_info_get(null_uuid);
+ struct ffa_value ret = ffa_partition_info_get(null_uuid);
uint64_t expected_size = ARRAY_SIZE(ffa_expected_partition_info);
if (ffa_func_id(ret) == FFA_SUCCESS_SMC32) {
diff --git a/tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c b/tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c
index 655f9d9..4924df4 100644
--- a/tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c
+++ b/tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c
@@ -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
*/
@@ -46,7 +46,7 @@ test_result_t test_simd_vectors_preserved(void)
}
fill_simd_vector_regs(simd_vectors_send);
- smc_ret_values ret = cactus_req_simd_fill_send_cmd(SENDER, RECEIVER);
+ struct ffa_value ret = cactus_req_simd_fill_send_cmd(SENDER, RECEIVER);
if (!is_ffa_direct_response(ret)) {
return TEST_RESULT_FAIL;
@@ -89,7 +89,7 @@ test_result_t test_sve_vectors_preserved(void)
fill_sve_vector_regs(sve_vectors_send);
- smc_ret_values ret = cactus_req_simd_fill_send_cmd(SENDER, RECEIVER);
+ struct ffa_value ret = cactus_req_simd_fill_send_cmd(SENDER, RECEIVER);
if (!is_ffa_direct_response(ret)) {
return TEST_RESULT_FAIL;
diff --git a/tftf/tests/runtime_services/secure_service/test_spm_smmu.c b/tftf/tests/runtime_services/secure_service/test_spm_smmu.c
index b041a97..0f0a5d9 100644
--- a/tftf/tests/runtime_services/secure_service/test_spm_smmu.c
+++ b/tftf/tests/runtime_services/secure_service/test_spm_smmu.c
@@ -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
*/
@@ -18,7 +18,7 @@ static const struct ffa_uuid expected_sp_uuids[] = { {PRIMARY_UUID} };
**************************************************************************/
test_result_t test_smmu_spm(void)
{
- smc_ret_values ret;
+ struct ffa_value ret;
/**********************************************************************
* Check SPMC has ffa_version and expected FFA endpoints are deployed.
diff --git a/tftf/tests/tests-invalid-access.mk b/tftf/tests/tests-invalid-access.mk
index b1df9ba..ffca79e 100644
--- a/tftf/tests/tests-invalid-access.mk
+++ b/tftf/tests/tests-invalid-access.mk
@@ -13,7 +13,8 @@ TESTS_SOURCES += \
TESTS_SOURCES += \
$(addprefix tftf/tests/runtime_services/secure_service/, \
+ ${ARCH}/ffa_arch_helpers.S \
ffa_helpers.c \
spm_common.c \
test_ffa_setup_and_discovery.c \
-) \ No newline at end of file
+)
diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk
index 941758c..702c10c 100644
--- a/tftf/tests/tests-spm.mk
+++ b/tftf/tests/tests-spm.mk
@@ -1,11 +1,12 @@
#
-# Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
TESTS_SOURCES += \
$(addprefix tftf/tests/runtime_services/secure_service/, \
+ ${ARCH}/ffa_arch_helpers.S \
ffa_helpers.c \
spm_common.c \
test_ffa_direct_messaging.c \