summaryrefslogtreecommitdiff
path: root/tftf
diff options
context:
space:
mode:
Diffstat (limited to 'tftf')
-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
19 files changed, 156 insertions, 122 deletions
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