summaryrefslogtreecommitdiff
path: root/spm/cactus/cactus_tests
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 /spm/cactus/cactus_tests
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>
Diffstat (limited to 'spm/cactus/cactus_tests')
-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
7 files changed, 26 insertions, 24 deletions
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);