summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2023-07-28 18:32:27 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2023-07-31 16:59:23 +0100
commit82bf339c9e178e8200f763146f2f21abee9410ea (patch)
treed37718c9f321f866fbe0480ea758fb5175a5c032
parent85d58f31f121445225c2b9e6ee94c8589cc36669 (diff)
fix(spm): stop spm from being built for in aarch32
Hafnium does not support Aarch32 therefore we do not want to build in this case. Move spm related test helpers into their own file and add FF-A tests to the aarch32_tests_to_skip.txt file Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: Ic5a83ddf4aae2b7dd4b1c30e4cc76b0447e5b405
-rw-r--r--include/common/test_helpers.h107
-rw-r--r--include/runtime_services/spm_test_helpers.h119
-rw-r--r--tftf/tests/aarch32_tests_to_skip.txt11
-rw-r--r--tftf/tests/common/test_helpers.c118
-rw-r--r--tftf/tests/extensions/sve/test_sve.c1
-rw-r--r--tftf/tests/misc_tests/test_invalid_access.c1
-rw-r--r--tftf/tests/runtime_services/host_realm_managment/rmi_spm_tests.c1
-rw-r--r--tftf/tests/runtime_services/realm_payload/host_realm_spm.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/spm_test_helpers.c128
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_group0_interrupts.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c3
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_notifications.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_secure_interrupts.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_spm_cpu_features.c1
-rw-r--r--tftf/tests/runtime_services/secure_service/test_spm_smmu.c1
-rw-r--r--tftf/tests/tests-spm.mk1
-rw-r--r--tftf/tests/tests-standard.mk4
21 files changed, 275 insertions, 229 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 5af4d19..4972d6a 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -8,13 +8,9 @@
#define TEST_HELPERS_H__
#include <arch_features.h>
-#include <ffa_helpers.h>
-#include <ffa_svc.h>
-#include <events.h>
#include <plat_topology.h>
#include <psci.h>
#include <sme.h>
-#include <spm_common.h>
#include <tftf_lib.h>
#include <trusted_os.h>
#include <tsp.h>
@@ -182,33 +178,6 @@ typedef test_result_t (*test_function_arg_t)(void *arg);
version & MM_VERSION_MINOR_MASK); \
} while (0)
-#define SKIP_TEST_IF_FFA_VERSION_LESS_THAN(major, minor) \
- do { \
- struct ffa_value ret = ffa_version( \
- MAKE_FFA_VERSION(major, minor)); \
- 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) { \
- tftf_testcase_printf("FFA_VERSION bad response: %x\n", \
- version); \
- return TEST_RESULT_FAIL; \
- } \
- \
- if (version < MAKE_FFA_VERSION(major, minor)) { \
- tftf_testcase_printf("FFA_VERSION returned %u.%u\n" \
- "The required version is %u.%u\n", \
- version >> FFA_VERSION_MAJOR_SHIFT, \
- version & FFA_VERSION_MINOR_MASK, \
- major, minor); \
- return TEST_RESULT_SKIPPED; \
- } \
- } while (0)
-
#define SKIP_TEST_IF_ARCH_DEBUG_VERSION_LESS_THAN(version) \
do { \
uint32_t debug_ver = arch_get_debug_version(); \
@@ -222,41 +191,6 @@ typedef test_result_t (*test_function_arg_t)(void *arg);
} \
} while (0)
-#define SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(mb, ffa_uuid) \
- do { \
- struct ffa_value sc_ret = ffa_partition_info_get(ffa_uuid); \
- ffa_rx_release(); \
- 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 (ffa_func_id(sc_ret) != FFA_SUCCESS_SMC32) { \
- ERROR("ffa_partition_info_get failed!\n"); \
- return TEST_RESULT_FAIL; \
- } \
- } while (0)
-
-#define GET_TFTF_MAILBOX(mb) \
- do { \
- if (!get_tftf_mailbox(&mb)) { \
- ERROR("Mailbox RXTX buffers not configured!\n"); \
- return TEST_RESULT_FAIL; \
- } \
- } while (false);
-
-#define CHECK_SPMC_TESTING_SETUP(ffa_major, ffa_minor, expected_uuids) \
- do { \
- SKIP_TEST_IF_AARCH32(); \
- const size_t expected_uuids_size = \
- sizeof(expected_uuids) / sizeof(struct ffa_uuid); \
- test_result_t ret = check_spmc_testing_set_up( \
- ffa_major, ffa_minor, expected_uuids, \
- expected_uuids_size); \
- if (ret != TEST_RESULT_SUCCESS) { \
- return ret; \
- } \
- } while (false);
-
#define SKIP_TEST_IF_TRBE_NOT_SUPPORTED() \
do { \
if (!get_armv9_0_trbe_support()) { \
@@ -436,47 +370,6 @@ test_result_t map_test_unmap(const map_args_unmap_t *args,
test_function_arg_t test);
/*
- * Helper function to reset TFTF global mailbox for SPM related tests.
- * It calls the FFA_RXTX_UNMAP interface, for the SPMC to drop the current
- * address.
- */
-bool reset_tftf_mailbox(void);
-
-/*
- * Helper function to get TFTF global mailbox for SPM related tests.
- * Allocates RX/TX buffer pair and calls FFA_RXTX_MAP interface, for the SPMC
- * to map them into its own S1 translation.
- * If this function is called, and the buffers had been priorly mapped, it
- * sets 'mb' with the respective addresses.
- */
-bool get_tftf_mailbox(struct mailbox_buffers *mb);
-
-test_result_t check_spmc_testing_set_up(uint32_t ffa_version_major,
- uint32_t ffa_version_minor, const struct ffa_uuid *ffa_uuids,
- size_t ffa_uuids_size);
-
-/**
- * Turn on all cpus to execute a test in all.
- * - 'cpu_on_handler' should have the code containing the test.
- * - 'cpu_booted' is used for notifying which cores the test has been executed.
- * This should be used in the test executed by cpu_on_handler at the end of
- * processing to make sure it complies with this function's implementation.
- */
-test_result_t spm_run_multi_core_test(uintptr_t cpu_on_handler,
- event_t *cpu_booted);
-
-/**
- * Call FFA_RUN in the designated SP to make it reach the message loop.
- * Used within CPU_ON handlers, to bring up the SP in the current core.
- */
-bool spm_core_sp_init(ffa_id_t sp_id);
-
-/**
- * Initializes the Mailbox for other SPM related tests that need to use
- * RXTX buffers.
- */
-bool mailbox_init(struct mailbox_buffers mb);
-/*
* Utility function to wait for all CPUs other than the caller to be
* OFF.
*/
diff --git a/include/runtime_services/spm_test_helpers.h b/include/runtime_services/spm_test_helpers.h
new file mode 100644
index 0000000..fede4ad
--- /dev/null
+++ b/include/runtime_services/spm_test_helpers.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2018-2023, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SPM_TEST_HELPERS_H__
+#define SPM_TEST_HELPERS_H__
+
+#include <events.h>
+#include <ffa_helpers.h>
+#include <ffa_svc.h>
+#include <spm_common.h>
+
+#define SKIP_TEST_IF_FFA_VERSION_LESS_THAN(major, minor) \
+ do { \
+ struct ffa_value ret = ffa_version( \
+ MAKE_FFA_VERSION(major, minor)); \
+ 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) { \
+ tftf_testcase_printf("FFA_VERSION bad response: %x\n", \
+ version); \
+ return TEST_RESULT_FAIL; \
+ } \
+ \
+ if (version < MAKE_FFA_VERSION(major, minor)) { \
+ tftf_testcase_printf("FFA_VERSION returned %u.%u\n" \
+ "The required version is %u.%u\n", \
+ version >> FFA_VERSION_MAJOR_SHIFT, \
+ version & FFA_VERSION_MINOR_MASK, \
+ major, minor); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
+#define SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(mb, ffa_uuid) \
+ do { \
+ struct ffa_value sc_ret = ffa_partition_info_get(ffa_uuid); \
+ ffa_rx_release(); \
+ 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 (ffa_func_id(sc_ret) != FFA_SUCCESS_SMC32) { \
+ ERROR("ffa_partition_info_get failed!\n"); \
+ return TEST_RESULT_FAIL; \
+ } \
+ } while (0)
+
+#define GET_TFTF_MAILBOX(mb) \
+ do { \
+ if (!get_tftf_mailbox(&mb)) { \
+ ERROR("Mailbox RXTX buffers not configured!\n"); \
+ return TEST_RESULT_FAIL; \
+ } \
+ } while (false);
+
+#define CHECK_SPMC_TESTING_SETUP(ffa_major, ffa_minor, expected_uuids) \
+ do { \
+ SKIP_TEST_IF_AARCH32(); \
+ const size_t expected_uuids_size = \
+ sizeof(expected_uuids) / sizeof(struct ffa_uuid); \
+ test_result_t ret = check_spmc_testing_set_up( \
+ ffa_major, ffa_minor, expected_uuids, \
+ expected_uuids_size); \
+ if (ret != TEST_RESULT_SUCCESS) { \
+ return ret; \
+ } \
+ } while (false);
+
+/*
+ * Helper function to reset TFTF global mailbox for SPM related tests.
+ * It calls the FFA_RXTX_UNMAP interface, for the SPMC to drop the current
+ * address.
+ */
+bool reset_tftf_mailbox(void);
+
+/*
+ * Helper function to get TFTF global mailbox for SPM related tests.
+ * Allocates RX/TX buffer pair and calls FFA_RXTX_MAP interface, for the SPMC
+ * to map them into its own S1 translation.
+ * If this function is called, and the buffers had been priorly mapped, it
+ * sets 'mb' with the respective addresses.
+ */
+bool get_tftf_mailbox(struct mailbox_buffers *mb);
+
+test_result_t check_spmc_testing_set_up(uint32_t ffa_version_major,
+ uint32_t ffa_version_minor, const struct ffa_uuid *ffa_uuids,
+ size_t ffa_uuids_size);
+
+/**
+ * Turn on all cpus to execute a test in all.
+ * - 'cpu_on_handler' should have the code containing the test.
+ * - 'cpu_booted' is used for notifying which cores the test has been executed.
+ * This should be used in the test executed by cpu_on_handler at the end of
+ * processing to make sure it complies with this function's implementation.
+ */
+test_result_t spm_run_multi_core_test(uintptr_t cpu_on_handler,
+ event_t *cpu_booted);
+
+/**
+ * Call FFA_RUN in the designated SP to make it reach the message loop.
+ * Used within CPU_ON handlers, to bring up the SP in the current core.
+ */
+bool spm_core_sp_init(ffa_id_t sp_id);
+
+/**
+ * Initializes the Mailbox for other SPM related tests that need to use
+ * RXTX buffers.
+ */
+bool mailbox_init(struct mailbox_buffers mb);
+
+#endif /* __SPM_TEST_HELPERS_H__ */
diff --git a/tftf/tests/aarch32_tests_to_skip.txt b/tftf/tests/aarch32_tests_to_skip.txt
index e31202d..83e4028 100644
--- a/tftf/tests/aarch32_tests_to_skip.txt
+++ b/tftf/tests/aarch32_tests_to_skip.txt
@@ -6,5 +6,14 @@
Realm payload at EL1
SIMD,SVE Registers context
Invalid memory access with RME extension
+FF-A Setup and Discovery
+SP exceptions
+FF-A Direct messaging
+FF-A Group0 interrupts
+FF-A Power management
+FF-A Memory Sharing
+SIMD,SVE Registers context
+FF-A Interrupt
+SMMUv3 tests
+FF-A Notifications
RMI and SPM tests
-SP exceptions \ No newline at end of file
diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c
index 90773ae..6a0b08b 100644
--- a/tftf/tests/common/test_helpers.c
+++ b/tftf/tests/common/test_helpers.c
@@ -7,15 +7,11 @@
#include <stdlib.h>
#include <arch_helpers.h>
-#include <cactus_test_cmds.h>
#include <plat_topology.h>
#include <platform.h>
-#include <power_management.h>
#include <test_helpers.h>
#include <tftf_lib.h>
-static struct mailbox_buffers test_mb = {.send = NULL, .recv = NULL};
-
int is_sys_suspend_state_ready(void)
{
int aff_info;
@@ -134,120 +130,6 @@ test_result_t map_test_unmap(const map_args_unmap_t *args,
return test_ret;
}
-bool reset_tftf_mailbox(void)
-{
- if (is_ffa_call_error(ffa_rxtx_unmap())) {
- return false;
- }
-
- test_mb.send = NULL;
- test_mb.recv = NULL;
-
- return true;
-}
-
-bool get_tftf_mailbox(struct mailbox_buffers *mb)
-{
- struct ffa_value ret;
-
- if (test_mb.recv == NULL || test_mb.send == NULL) {
- CONFIGURE_AND_MAP_MAILBOX(test_mb, PAGE_SIZE, ret);
- if (is_ffa_call_error(ret)) {
- return false;
- }
- }
-
- *mb = test_mb;
-
- return true;
-}
-
-test_result_t check_spmc_testing_set_up(
- uint32_t ffa_version_major, uint32_t ffa_version_minor,
- const struct ffa_uuid *ffa_uuids, size_t ffa_uuids_size)
-{
- struct mailbox_buffers mb;
-
- if (ffa_uuids == NULL) {
- ERROR("Invalid parameter ffa_uuids!\n");
- return TEST_RESULT_FAIL;
- }
-
- SKIP_TEST_IF_FFA_VERSION_LESS_THAN(ffa_version_major,
- ffa_version_minor);
-
- /**********************************************************************
- * If OP-TEE is SPMC skip the current test.
- **********************************************************************/
- if (check_spmc_execution_level()) {
- VERBOSE("OPTEE as SPMC at S-EL1. Skipping test!\n");
- return TEST_RESULT_SKIPPED;
- }
-
- GET_TFTF_MAILBOX(mb);
-
- for (unsigned int i = 0U; i < ffa_uuids_size; i++)
- SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(*mb, ffa_uuids[i]);
-
- return TEST_RESULT_SUCCESS;
-}
-
-test_result_t spm_run_multi_core_test(uintptr_t cpu_on_handler,
- event_t *cpu_done)
-{
- unsigned int lead_mpid = read_mpidr_el1() & MPID_MASK;
- unsigned int core_pos, cpu_node, mpidr;
- int32_t ret;
-
- VERBOSE("Powering on all cpus.\n");
-
- for (unsigned int i = 0U; i < PLATFORM_CORE_COUNT; i++) {
- tftf_init_event(&cpu_done[i]);
- }
-
- /* Power on each secondary CPU one after the other. */
- for_each_cpu(cpu_node) {
- mpidr = tftf_get_mpidr_from_node(cpu_node);
- if (mpidr == lead_mpid) {
- continue;
- }
-
- ret = tftf_cpu_on(mpidr, cpu_on_handler, 0U);
- if (ret != 0) {
- ERROR("tftf_cpu_on mpidr 0x%x returns %d\n",
- mpidr, ret);
- }
-
- /* Wait for the secondary CPU to be ready. */
- core_pos = platform_get_core_pos(mpidr);
- tftf_wait_for_event(&cpu_done[core_pos]);
- }
-
- VERBOSE("Done exiting.\n");
-
- return TEST_RESULT_SUCCESS;
-}
-
-bool spm_core_sp_init(ffa_id_t sp_id)
-{
- /*
- * Secure Partitions secondary ECs need one round of ffa_run to reach
- * the message loop.
- */
- if (sp_id != SP_ID(1)) {
- uint32_t core_pos = get_current_core_id();
- 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",
- sp_id, core_pos);
- return false;
- }
- }
-
- return true;
-}
-
/*
* Utility function to wait for all CPUs other than the caller to be
* OFF.
diff --git a/tftf/tests/extensions/sve/test_sve.c b/tftf/tests/extensions/sve/test_sve.c
index 68ab775..bdd76e1 100644
--- a/tftf/tests/extensions/sve/test_sve.c
+++ b/tftf/tests/extensions/sve/test_sve.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <test_helpers.h>
#include <tftf_lib.h>
+#include <lib/extensions/sve.h>
#include "./test_sve.h"
diff --git a/tftf/tests/misc_tests/test_invalid_access.c b/tftf/tests/misc_tests/test_invalid_access.c
index 7325ace..5c173c5 100644
--- a/tftf/tests/misc_tests/test_invalid_access.c
+++ b/tftf/tests/misc_tests/test_invalid_access.c
@@ -11,6 +11,7 @@
#include <arch_features.h>
#include <debug.h>
#ifdef __aarch64__
+#include <spm_test_helpers.h>
#include <sync.h>
#endif
#include <host_realm_helper.h>
diff --git a/tftf/tests/runtime_services/host_realm_managment/rmi_spm_tests.c b/tftf/tests/runtime_services/host_realm_managment/rmi_spm_tests.c
index 7d2fe7f..d7a8157 100644
--- a/tftf/tests/runtime_services/host_realm_managment/rmi_spm_tests.c
+++ b/tftf/tests/runtime_services/host_realm_managment/rmi_spm_tests.c
@@ -17,6 +17,7 @@
#include <plat_topology.h>
#include <platform.h>
#include "rmi_spm_tests.h"
+#include <spm_test_helpers.h>
#include <smccc.h>
#include <test_helpers.h>
diff --git a/tftf/tests/runtime_services/realm_payload/host_realm_spm.c b/tftf/tests/runtime_services/realm_payload/host_realm_spm.c
index 7cc4ec3..895a6dd 100644
--- a/tftf/tests/runtime_services/realm_payload/host_realm_spm.c
+++ b/tftf/tests/runtime_services/realm_payload/host_realm_spm.c
@@ -13,6 +13,7 @@
#include <host_realm_helper.h>
#include <host_realm_mem_layout.h>
#include <host_shared_data.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#define REALM_TIME_SLEEP 300U
diff --git a/tftf/tests/runtime_services/secure_service/spm_test_helpers.c b/tftf/tests/runtime_services/secure_service/spm_test_helpers.c
new file mode 100644
index 0000000..054e774
--- /dev/null
+++ b/tftf/tests/runtime_services/secure_service/spm_test_helpers.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2023, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stdlib.h>
+
+#include <power_management.h>
+#include <spm_test_helpers.h>
+#include <test_helpers.h>
+#include <tftf_lib.h>
+
+static struct mailbox_buffers test_mb = {.send = NULL, .recv = NULL};
+
+bool reset_tftf_mailbox(void)
+{
+ if (is_ffa_call_error(ffa_rxtx_unmap())) {
+ return false;
+ }
+
+ test_mb.send = NULL;
+ test_mb.recv = NULL;
+
+ return true;
+}
+
+bool get_tftf_mailbox(struct mailbox_buffers *mb)
+{
+ struct ffa_value ret;
+
+ if (test_mb.recv == NULL || test_mb.send == NULL) {
+ CONFIGURE_AND_MAP_MAILBOX(test_mb, PAGE_SIZE, ret);
+ if (is_ffa_call_error(ret)) {
+ return false;
+ }
+ }
+
+ *mb = test_mb;
+
+ return true;
+}
+
+test_result_t check_spmc_testing_set_up(
+ uint32_t ffa_version_major, uint32_t ffa_version_minor,
+ const struct ffa_uuid *ffa_uuids, size_t ffa_uuids_size)
+{
+ struct mailbox_buffers mb;
+
+ if (ffa_uuids == NULL) {
+ ERROR("Invalid parameter ffa_uuids!\n");
+ return TEST_RESULT_FAIL;
+ }
+
+ SKIP_TEST_IF_FFA_VERSION_LESS_THAN(ffa_version_major,
+ ffa_version_minor);
+
+ /**********************************************************************
+ * If OP-TEE is SPMC skip the current test.
+ **********************************************************************/
+ if (check_spmc_execution_level()) {
+ VERBOSE("OPTEE as SPMC at S-EL1. Skipping test!\n");
+ return TEST_RESULT_SKIPPED;
+ }
+
+ GET_TFTF_MAILBOX(mb);
+
+ for (unsigned int i = 0U; i < ffa_uuids_size; i++)
+ SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(*mb, ffa_uuids[i]);
+
+ return TEST_RESULT_SUCCESS;
+}
+
+test_result_t spm_run_multi_core_test(uintptr_t cpu_on_handler,
+ event_t *cpu_done)
+{
+ unsigned int lead_mpid = read_mpidr_el1() & MPID_MASK;
+ unsigned int core_pos, cpu_node, mpidr;
+ int32_t ret;
+
+ VERBOSE("Powering on all cpus.\n");
+
+ for (unsigned int i = 0U; i < PLATFORM_CORE_COUNT; i++) {
+ tftf_init_event(&cpu_done[i]);
+ }
+
+ /* Power on each secondary CPU one after the other. */
+ for_each_cpu(cpu_node) {
+ mpidr = tftf_get_mpidr_from_node(cpu_node);
+ if (mpidr == lead_mpid) {
+ continue;
+ }
+
+ ret = tftf_cpu_on(mpidr, cpu_on_handler, 0U);
+ if (ret != 0) {
+ ERROR("tftf_cpu_on mpidr 0x%x returns %d\n",
+ mpidr, ret);
+ }
+
+ /* Wait for the secondary CPU to be ready. */
+ core_pos = platform_get_core_pos(mpidr);
+ tftf_wait_for_event(&cpu_done[core_pos]);
+ }
+
+ VERBOSE("Done exiting.\n");
+
+ return TEST_RESULT_SUCCESS;
+}
+
+bool spm_core_sp_init(ffa_id_t sp_id)
+{
+ /*
+ * Secure Partitions secondary ECs need one round of ffa_run to reach
+ * the message loop.
+ */
+ if (sp_id != SP_ID(1)) {
+ uint32_t core_pos = get_current_core_id();
+ 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",
+ sp_id, core_pos);
+ return false;
+ }
+ }
+
+ return true;
+}
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 5e52f12..1f8e81c 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
@@ -14,6 +14,7 @@
#include <lib/events.h>
#include <lib/power_management.h>
#include <platform.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#define ECHO_VAL1 U(0xa0a0a0a0)
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 870a00a..6fd77d2 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
@@ -14,6 +14,7 @@
#include <platform.h>
#include <smccc.h>
#include <spm_common.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#define SENDER HYP_ID
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_group0_interrupts.c b/tftf/tests/runtime_services/secure_service/test_ffa_group0_interrupts.c
index 9359edf..c6c7194 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_group0_interrupts.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_group0_interrupts.c
@@ -7,6 +7,7 @@
#include <cactus_test_cmds.h>
#include <ffa_endpoints.h>
#include <platform.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#define SP_SLEEP_TIME 200U
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 01fa2ee..454ea05 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_interrupts.c
@@ -7,6 +7,7 @@
#include <cactus_test_cmds.h>
#include <ffa_endpoints.h>
#include <ffa_helpers.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#include <timer.h>
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 9418b57..83c94c1 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
@@ -8,9 +8,10 @@
#include <cactus_test_cmds.h>
#include <ffa_endpoints.h>
+#include <spm_common.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#include <tftf_lib.h>
-#include <spm_common.h>
#include <xlat_tables_defs.h>
#define MAILBOX_SIZE PAGE_SIZE
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 ea264b4..9ca337a 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
@@ -14,6 +14,7 @@
#include <ffa_svc.h>
#include <platform.h>
#include <spm_common.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
/**
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 5977717..336faf9 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
@@ -7,6 +7,7 @@
#include <cactus_test_cmds.h>
#include <ffa_endpoints.h>
#include <ffa_helpers.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#include <timer.h>
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 613bdc4..d8a6f6a 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
@@ -10,6 +10,7 @@
#include <ffa_helpers.h>
#include <ffa_svc.h>
#include <spm_common.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#include <tftf_lib.h>
#include <xlat_tables_defs.h>
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 8f090a2..efd6c8a 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
@@ -8,6 +8,7 @@
#include <ffa_endpoints.h>
#include <ffa_helpers.h>
#include <fpu.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
#include <lib/extensions/sve.h>
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 0f0a5d9..238feae 100644
--- a/tftf/tests/runtime_services/secure_service/test_spm_smmu.c
+++ b/tftf/tests/runtime_services/secure_service/test_spm_smmu.c
@@ -8,6 +8,7 @@
#include <debug.h>
#include <ffa_endpoints.h>
#include <smccc.h>
+#include <spm_test_helpers.h>
#include <test_helpers.h>
static const struct ffa_uuid expected_sp_uuids[] = { {PRIMARY_UUID} };
diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk
index c0a7eb0..13f3f86 100644
--- a/tftf/tests/tests-spm.mk
+++ b/tftf/tests/tests-spm.mk
@@ -12,6 +12,7 @@ TESTS_SOURCES += \
${ARCH}/ffa_arch_helpers.S \
ffa_helpers.c \
spm_common.c \
+ spm_test_helpers.c \
test_ffa_direct_messaging.c \
test_ffa_interrupts.c \
test_ffa_secure_interrupts.c \
diff --git a/tftf/tests/tests-standard.mk b/tftf/tests/tests-standard.mk
index 2ff0882..46157ce 100644
--- a/tftf/tests/tests-standard.mk
+++ b/tftf/tests/tests-standard.mk
@@ -16,7 +16,6 @@ TESTS_MAKEFILE := $(addprefix tftf/tests/, \
tests-sdei.mk \
tests-single-fault.mk \
tests-smc.mk \
- tests-spm.mk \
tests-template.mk \
tests-tftf-validation.mk \
tests-trng.mk \
@@ -24,12 +23,13 @@ TESTS_MAKEFILE := $(addprefix tftf/tests/, \
tests-tsp.mk \
tests-uncontainable.mk \
tests-debugfs.mk \
- tests-rmi-spm.mk \
)
ifeq (${ARCH},aarch64)
TESTS_MAKEFILE += $(addprefix tftf/tests/, \
+ tests-spm.mk \
tests-realm-payload.mk \
+ tests-rmi-spm.mk \
)
endif