diff options
author | Olivier Deprez <olivier.deprez@arm.com> | 2021-06-18 17:28:42 +0200 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2021-06-18 17:28:42 +0200 |
commit | e3cfd6df27e46c17f514baab275f0a6209aecb44 (patch) | |
tree | 4254f7fd53218e903ed2e9755143ecda93167709 /tftf/tests | |
parent | 5de3d67e9fcc8b03efd28f6ae5fd4e0e7a345209 (diff) | |
parent | 6833ea5159f6adc08bda18d5147aba1e6ca281b5 (diff) | |
download | tf-a-tests-e3cfd6df27e46c17f514baab275f0a6209aecb44.tar.gz |
Merge changes from topic "db/spm_id_get"
* changes:
Group FF-A Setup and Discovery interface tests
Add tests for FFA function FFA_SPM_ID_GET
Change the name of type ffa_vm_id_t
Diffstat (limited to 'tftf/tests')
10 files changed, 293 insertions, 250 deletions
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c index 8e7b58c6f..4c69eb172 100644 --- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c +++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c @@ -55,8 +55,8 @@ 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_vm_id_t source_id, - ffa_vm_id_t dest_id, uint64_t arg0, +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) { @@ -74,8 +74,8 @@ smc_ret_values ffa_msg_send_direct_req64(ffa_vm_id_t source_id, return tftf_smc(&args); } -smc_ret_values ffa_msg_send_direct_req32(ffa_vm_id_t source_id, - ffa_vm_id_t dest_id, uint32_t arg0, +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) { @@ -93,8 +93,8 @@ smc_ret_values ffa_msg_send_direct_req32(ffa_vm_id_t source_id, return tftf_smc(&args); } -smc_ret_values ffa_msg_send_direct_resp64(ffa_vm_id_t source_id, - ffa_vm_id_t dest_id, uint64_t arg0, +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) { @@ -112,8 +112,8 @@ smc_ret_values ffa_msg_send_direct_resp64(ffa_vm_id_t source_id, return tftf_smc(&args); } -smc_ret_values ffa_msg_send_direct_resp32(ffa_vm_id_t source_id, - ffa_vm_id_t dest_id, uint32_t arg0, +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) { @@ -137,9 +137,9 @@ smc_ret_values ffa_msg_send_direct_resp32(ffa_vm_id_t source_id, * composite memory region offset. */ static void ffa_memory_region_init_header( - struct ffa_memory_region *memory_region, ffa_vm_id_t sender, + struct ffa_memory_region *memory_region, ffa_id_t sender, ffa_memory_attributes_t attributes, ffa_memory_region_flags_t flags, - ffa_memory_handle_t handle, uint32_t tag, ffa_vm_id_t receiver, + ffa_memory_handle_t handle, uint32_t tag, ffa_id_t receiver, ffa_memory_access_permissions_t permissions) { memory_region->sender = sender; @@ -168,7 +168,7 @@ static void ffa_memory_region_init_header( */ uint32_t ffa_memory_region_init( struct ffa_memory_region *memory_region, size_t memory_region_max_size, - ffa_vm_id_t sender, ffa_vm_id_t receiver, + ffa_id_t sender, ffa_id_t receiver, const struct ffa_memory_region_constituent constituents[], uint32_t constituent_count, uint32_t tag, ffa_memory_region_flags_t flags, enum ffa_data_access data_access, @@ -259,7 +259,7 @@ uint32_t ffa_memory_region_init( */ uint32_t ffa_memory_retrieve_request_init( struct ffa_memory_region *memory_region, ffa_memory_handle_t handle, - ffa_vm_id_t sender, ffa_vm_id_t receiver, uint32_t tag, + ffa_id_t sender, ffa_id_t receiver, uint32_t tag, ffa_memory_region_flags_t flags, enum ffa_data_access data_access, enum ffa_instruction_access instruction_access, enum ffa_memory_type type, enum ffa_memory_cacheability cacheability, @@ -291,7 +291,6 @@ uint32_t ffa_memory_retrieve_request_init( memory_region->receiver_count * sizeof(struct ffa_memory_access); } - /* * FFA Version ABI helper. * Version fields: @@ -317,6 +316,15 @@ smc_ret_values ffa_id_get(void) return tftf_smc(&args); } +smc_ret_values ffa_spm_id_get(void) +{ + smc_args args = { + .fid = FFA_SPM_ID_GET + }; + + return tftf_smc(&args); +} + smc_ret_values ffa_msg_wait(void) { smc_args args = { diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c index 179ef1cb9..e2d3392c1 100644 --- a/tftf/tests/runtime_services/secure_service/spm_common.c +++ b/tftf/tests/runtime_services/secure_service/spm_common.c @@ -6,6 +6,7 @@ #include <debug.h> #include <ffa_endpoints.h> +#include <ffa_svc.h> #include <spm_common.h> #include <xlat_tables_v2.h> @@ -166,6 +167,8 @@ static const struct ffa_features_test ffa_feature_test_target[] = { {"FFA_RXTX_UNMAP_32 check", FFA_RXTX_UNMAP, FFA_ERROR}, {"FFA_PARTITION_INFO_GET_32 check", FFA_PARTITION_INFO_GET, FFA_SUCCESS_SMC32}, {"FFA_ID_GET_32 check", FFA_ID_GET, FFA_SUCCESS_SMC32}, + {"FFA_SPM_ID_GET_32 check", FFA_SPM_ID_GET, FFA_SUCCESS_SMC32, + MAKE_FFA_VERSION(1, 1)}, {"FFA_MSG_POLL_32 check", FFA_MSG_POLL, FFA_SUCCESS_SMC32}, {"FFA_MSG_WAIT_32 check", FFA_MSG_WAIT, FFA_SUCCESS_SMC32}, {"FFA_YIELD_32 check", FFA_MSG_YIELD, FFA_SUCCESS_SMC32}, @@ -199,7 +202,7 @@ unsigned int get_ffa_feature_test_target( bool memory_retrieve(struct mailbox_buffers *mb, struct ffa_memory_region **retrieved, uint64_t handle, - ffa_vm_id_t sender, ffa_vm_id_t receiver, + ffa_id_t sender, ffa_id_t receiver, uint32_t mem_func) { smc_ret_values ret; @@ -269,7 +272,7 @@ bool memory_retrieve(struct mailbox_buffers *mb, } bool memory_relinquish(struct ffa_mem_relinquish *m, uint64_t handle, - ffa_vm_id_t id) + ffa_id_t id) { smc_ret_values ret; @@ -297,7 +300,7 @@ ffa_memory_handle_t memory_send( uint32_t fragment_length, uint32_t total_length) { smc_ret_values ret; - ffa_vm_id_t receiver = + ffa_id_t receiver = memory_region->receivers[0].receiver_permissions.receiver; if (fragment_length != total_length) { @@ -336,7 +339,7 @@ ffa_memory_handle_t memory_send( */ ffa_memory_handle_t memory_init_and_send( struct ffa_memory_region *memory_region, size_t memory_region_max_size, - ffa_vm_id_t sender, ffa_vm_id_t receiver, + ffa_id_t sender, ffa_id_t receiver, const struct ffa_memory_region_constituent *constituents, uint32_t constituents_count, uint32_t mem_func) { 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 0a722e497..1b9abe95b 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 @@ -27,8 +27,8 @@ static const struct ffa_uuid expected_sp_uuids[] = { static event_t cpu_booted[PLATFORM_CORE_COUNT]; -static test_result_t send_cactus_echo_cmd(ffa_vm_id_t sender, - ffa_vm_id_t dest, +static test_result_t send_cactus_echo_cmd(ffa_id_t sender, + ffa_id_t dest, uint64_t value) { smc_ret_values ret; @@ -92,9 +92,9 @@ test_result_t test_ffa_direct_messaging(void) * otherwise. * For the CACTUS_SUCCESS response, the test returns TEST_RESULT_SUCCESS. */ -static test_result_t send_cactus_req_echo_cmd(ffa_vm_id_t sender, - ffa_vm_id_t dest, - ffa_vm_id_t echo_dest, +static test_result_t send_cactus_req_echo_cmd(ffa_id_t sender, + ffa_id_t dest, + ffa_id_t echo_dest, uint64_t value) { smc_ret_values ret; diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_features.c b/tftf/tests/runtime_services/secure_service/test_ffa_features.c deleted file mode 100644 index e4cd845fd..000000000 --- a/tftf/tests/runtime_services/secure_service/test_ffa_features.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <spm_common.h> -#include <test_helpers.h> -#include <tftf_lib.h> - -test_result_t test_ffa_features(void) -{ - SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0); - - /* Check if SPMC is OP-TEE at S-EL1 */ - if (check_spmc_execution_level()) { - /* FFA_FEATURES is not yet supported in OP-TEE */ - return TEST_RESULT_SUCCESS; - } - - smc_ret_values ffa_ret; - const struct ffa_features_test *ffa_feature_test_target; - unsigned int i, test_target_size = - get_ffa_feature_test_target(&ffa_feature_test_target); - - for (i = 0U; i < test_target_size; i++) { - ffa_ret = ffa_features(ffa_feature_test_target[i].feature); - if (ffa_func_id(ffa_ret) != ffa_feature_test_target[i].expected_ret) { - tftf_testcase_printf("%s returned %x, expected %x\n", - ffa_feature_test_target[i].test_name, - ffa_func_id(ffa_ret), - ffa_feature_test_target[i].expected_ret); - return TEST_RESULT_FAIL; - } - if ((ffa_feature_test_target[i].expected_ret == FFA_ERROR) && - (ffa_error_code(ffa_ret) != FFA_ERROR_NOT_SUPPORTED)) { - tftf_testcase_printf("%s failed for the wrong reason: " - "returned %x, expected %x\n", - ffa_feature_test_target[i].test_name, - ffa_error_code(ffa_ret), - FFA_ERROR_NOT_SUPPORTED); - return TEST_RESULT_FAIL; - } - } - - return TEST_RESULT_SUCCESS; -} 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 f126c57d6..46a7349bf 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 @@ -130,8 +130,8 @@ test_result_t test_mem_donate_sp(void) * Cactus SP should reply to TFTF on whether the test succeeded or not. */ static test_result_t test_req_mem_send_sp_to_sp(uint32_t mem_func, - ffa_vm_id_t sender_sp, - ffa_vm_id_t receiver_sp) + ffa_id_t sender_sp, + ffa_id_t receiver_sp) { smc_ret_values ret; diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_rxtx_map.c b/tftf/tests/runtime_services/secure_service/test_ffa_rxtx_map.c deleted file mode 100644 index 1b47c5f99..000000000 --- a/tftf/tests/runtime_services/secure_service/test_ffa_rxtx_map.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <debug.h> - -#include <test_helpers.h> -#include <xlat_tables_defs.h> - -static struct mailbox_buffers mb; - -static test_result_t test_ffa_rxtx_map(uint32_t expected_return) -{ - smc_ret_values ret; - - /********************************************************************** - * Verify that FFA is there and that it has the correct version. - **********************************************************************/ - SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0); - - /********************************************************************** - * If OP-TEE is SPMC skip this test. - **********************************************************************/ - if (check_spmc_execution_level()) { - VERBOSE("OP-TEE as SPMC at S-EL1. Skipping test!\n"); - return TEST_RESULT_SKIPPED; - } - - /* - * Declare RXTX buffers, assign them to the mailbox and call - * FFA_RXTX_MAP. - */ - CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret); - if (ffa_func_id(ret) != expected_return) { - ERROR("Failed to map RXTX buffers %x!\n", ffa_error_code(ret)); - return TEST_RESULT_FAIL; - } - - return TEST_RESULT_SUCCESS; -} - -/** - * Test mapping RXTX buffers from NWd. - * This test also sets the Mailbox for other SPM related tests that need to use - * RXTX buffers. - */ -test_result_t test_ffa_rxtx_map_success(void) -{ - test_result_t ret = test_ffa_rxtx_map(FFA_SUCCESS_SMC32); - - if (ret == TEST_RESULT_SUCCESS) { - INFO("Set RXTX Mailbox for remaining spm tests!\n"); - set_tftf_mailbox(&mb); - } - return ret; -} - -/** - * Test to verify that 2nd call to FFA_RXTX_MAP should fail. - */ -test_result_t test_ffa_rxtx_map_fail(void) -{ - INFO("This test expects error log.\n"); - return test_ffa_rxtx_map(FFA_ERROR); -} 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 new file mode 100644 index 000000000..f8a5ace57 --- /dev/null +++ b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2020-2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <debug.h> + +#include <ffa_svc.h> +#include <ffa_helpers.h> +#include <spm_common.h> +#include <test_helpers.h> +#include <tftf_lib.h> +#include <xlat_tables_defs.h> + +static bool should_skip_version_test; + +static struct mailbox_buffers mb; + +/* + * Using FFA version expected for SPM. + */ +#define SPM_VERSION MAKE_FFA_VERSION(FFA_VERSION_MAJOR, FFA_VERSION_MINOR) + +/****************************************************************************** + * FF-A Features ABI Tests + ******************************************************************************/ + +test_result_t test_ffa_features(void) +{ + SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0); + + /* Check if SPMC is OP-TEE at S-EL1 */ + if (check_spmc_execution_level()) { + /* FFA_FEATURES is not yet supported in OP-TEE */ + return TEST_RESULT_SUCCESS; + } + + smc_ret_values ffa_ret; + unsigned int expected_ret; + const struct ffa_features_test *ffa_feature_test_target; + unsigned int i, test_target_size = + get_ffa_feature_test_target(&ffa_feature_test_target); + struct ffa_features_test test_target; + + for (i = 0U; i < test_target_size; i++) { + test_target = ffa_feature_test_target[i]; + ffa_ret = ffa_features(test_target.feature); + expected_ret = FFA_VERSION_COMPILED + >= test_target.version_added ? + test_target.expected_ret : FFA_ERROR; + if (ffa_func_id(ffa_ret) != expected_ret) { + tftf_testcase_printf("%s returned %x, expected %x\n", + test_target.test_name, + ffa_func_id(ffa_ret), + expected_ret); + return TEST_RESULT_FAIL; + } + if ((expected_ret == FFA_ERROR) && + (ffa_error_code(ffa_ret) != FFA_ERROR_NOT_SUPPORTED)) { + tftf_testcase_printf("%s failed for the wrong reason: " + "returned %x, expected %x\n", + test_target.test_name, + ffa_error_code(ffa_ret), + FFA_ERROR_NOT_SUPPORTED); + return TEST_RESULT_FAIL; + } + } + + return TEST_RESULT_SUCCESS; +} + +/****************************************************************************** + * FF-A Version ABI Tests + ******************************************************************************/ + +/* + * Calls FFA Version ABI, and checks if the result as expected. + */ +static test_result_t test_ffa_version(uint32_t input_version, + uint32_t expected_return) +{ + if (should_skip_version_test) { + return TEST_RESULT_SKIPPED; + } + + smc_ret_values ret_values = ffa_version(input_version); + + uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret_values.ret0); + + if (spm_version == expected_return) { + return TEST_RESULT_SUCCESS; + } + + tftf_testcase_printf("Input Version: 0x%x\n" + "Return: 0x%x\nExpected: 0x%x\n", + input_version, spm_version, expected_return); + + return TEST_RESULT_FAIL; +} + +/* + * @Test_Aim@ Validate what happens when using same version as SPM. + */ +test_result_t test_ffa_version_equal(void) +{ + /* + * FFA_VERSION interface is used to check that SPM functionality is + * supported. On FFA_VERSION invocation from TFTF, the SPMD returns + * either NOT_SUPPORTED or the SPMC version value provided in the SPMC + * manifest. The variable "should_skip_test" is set to true when the + * SPMD returns NOT_SUPPORTED or a mismatched version, which means that + * a TFTF physical FF-A endpoint version (SPM_VERSION) does not match + * the SPMC's physical FF-A endpoint version. This prevents running the + * subsequent FF-A version tests (and break the test flow), as they're + * not relevant when the SPMD is not present within BL31 + * (FFA_VERSION returns NOT_SUPPORTED). + */ + test_result_t ret = test_ffa_version(SPM_VERSION, SPM_VERSION); + + if (ret != TEST_RESULT_SUCCESS) { + should_skip_version_test = true; + ret = TEST_RESULT_SKIPPED; + } + return ret; +} + +/* + * @Test_Aim@ Validate what happens when setting bit 31 in + * 'input_version'. As per spec, FFA version is 31 bits long. + * Bit 31 set is an invalid input. + */ +test_result_t test_ffa_version_bit31(void) +{ + return test_ffa_version(FFA_VERSION_BIT31_MASK | SPM_VERSION, + FFA_ERROR_NOT_SUPPORTED); +} + +/* + * @Test_Aim@ Validate what happens for bigger version than SPM's. + */ +test_result_t test_ffa_version_bigger(void) +{ + return test_ffa_version(MAKE_FFA_VERSION(FFA_VERSION_MAJOR + 1, 0), + SPM_VERSION); +} + +/* + * @Test_Aim@ Validate what happens for smaller version than SPM's. + */ +test_result_t test_ffa_version_smaller(void) +{ + return test_ffa_version(MAKE_FFA_VERSION(0, 9), SPM_VERSION); +} + +/****************************************************************************** + * FF-A RXTX ABI Tests + ******************************************************************************/ + +static test_result_t test_ffa_rxtx_map(uint32_t expected_return) +{ + smc_ret_values ret; + + /********************************************************************** + * Verify that FFA is there and that it has the correct version. + **********************************************************************/ + SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0); + + /********************************************************************** + * If OP-TEE is SPMC skip this test. + **********************************************************************/ + if (check_spmc_execution_level()) { + VERBOSE("OP-TEE as SPMC at S-EL1. Skipping test!\n"); + return TEST_RESULT_SKIPPED; + } + + /* + * Declare RXTX buffers, assign them to the mailbox and call + * FFA_RXTX_MAP. + */ + CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret); + if (ffa_func_id(ret) != expected_return) { + ERROR("Failed to map RXTX buffers %x!\n", ffa_error_code(ret)); + return TEST_RESULT_FAIL; + } + + return TEST_RESULT_SUCCESS; +} + +/** + * Test mapping RXTX buffers from NWd. + * This test also sets the Mailbox for other SPM related tests that need to use + * RXTX buffers. + */ +test_result_t test_ffa_rxtx_map_success(void) +{ + test_result_t ret = test_ffa_rxtx_map(FFA_SUCCESS_SMC32); + + if (ret == TEST_RESULT_SUCCESS) { + INFO("Set RXTX Mailbox for remaining spm tests!\n"); + set_tftf_mailbox(&mb); + } + return ret; +} + +/** + * Test to verify that 2nd call to FFA_RXTX_MAP should fail. + */ +test_result_t test_ffa_rxtx_map_fail(void) +{ + INFO("This test expects error log.\n"); + return test_ffa_rxtx_map(FFA_ERROR); +} + +/****************************************************************************** + * FF-A SPM_ID_GET ABI Tests + ******************************************************************************/ + +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(); + + if (is_ffa_call_error(ffa_ret)) { + ERROR("FFA_SPM_ID_GET call failed! Error code: 0x%x\n", + ffa_error_code(ffa_ret)); + return TEST_RESULT_FAIL; + } + + /* Check the SPMC value given in the fvp_spmc_manifest is returned */ + ffa_id_t spm_id = ffa_endpoint_id(ffa_ret); + + if (spm_id != SPMC_ID) { + ERROR("Expected SPMC_ID of 0x%x\n received: 0x%x\n", + SPMC_ID, spm_id); + return TEST_RESULT_FAIL; + } + + return TEST_RESULT_SUCCESS; +} diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_version.c b/tftf/tests/runtime_services/secure_service/test_ffa_version.c deleted file mode 100644 index 41eca5adc..000000000 --- a/tftf/tests/runtime_services/secure_service/test_ffa_version.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <ffa_svc.h> -#include <test_helpers.h> -#include <tftf_lib.h> - -/* - * Using FFA version expected for SPM. - */ -#define SPM_VERSION MAKE_FFA_VERSION(FFA_VERSION_MAJOR, FFA_VERSION_MINOR) - -static bool should_skip_test; - -/* - * Calls FFA Version ABI, and checks if the result as expected. - */ -static test_result_t test_ffa_version(uint32_t input_version, uint32_t expected_return) -{ - if (should_skip_test) { - return TEST_RESULT_SKIPPED; - } - - smc_ret_values ret_values = ffa_version(input_version); - - uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret_values.ret0); - - if (spm_version == expected_return) { - return TEST_RESULT_SUCCESS; - } - - tftf_testcase_printf("Input Version: 0x%x\nReturn: 0x%x\nExpected: 0x%x\n", - input_version, spm_version, expected_return); - - return TEST_RESULT_FAIL; -} - -/* - * @Test_Aim@ Validate what happens when using same version as SPM. - */ -test_result_t test_ffa_version_equal(void) -{ - /* - * FFA_VERSION interface is used to check that SPM functionality is supported. - * On FFA_VERSION invocation from TFTF, the SPMD returns either NOT_SUPPORTED or - * the SPMC version value provided in the SPMC manifest. The variable "should_skip_test" - * is set to true when the SPMD returns NOT_SUPPORTED or a mismatched version, which - * means that a TFTF physical FF-A endpoint version (SPM_VERSION) does not match the - * SPMC's physical FF-A endpoint version. This prevents running the subsequent FF-A - * version tests (and break the test flow), as they're not relevant when the SPMD is - * not present within BL31 (FFA_VERSION returns NOT_SUPPORTED). - */ - test_result_t ret = test_ffa_version(SPM_VERSION, SPM_VERSION); - if (ret != TEST_RESULT_SUCCESS) { - should_skip_test = true; - ret = TEST_RESULT_SKIPPED; - } - return ret; -} - -/* - * @Test_Aim@ Validate what happens when setting bit 31 in - * 'input_version'. As per spec, FFA version is 31 bits long. - * Bit 31 set is an invalid input. - */ -test_result_t test_ffa_version_bit31(void) -{ - return test_ffa_version(FFA_VERSION_BIT31_MASK | SPM_VERSION, FFA_ERROR_NOT_SUPPORTED); -} - -/* - * @Test_Aim@ Validate what happens for bigger version than SPM's. - */ -test_result_t test_ffa_version_bigger(void) -{ - return test_ffa_version(MAKE_FFA_VERSION(FFA_VERSION_MAJOR + 1, 0), SPM_VERSION); -} - -/* - * @Test_Aim@ Validate what happens for smaller version than SPM's. - */ -test_result_t test_ffa_version_smaller(void) -{ - return test_ffa_version(MAKE_FFA_VERSION(0, 9), SPM_VERSION); -} diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk index e62e03d94..dc99337b1 100644 --- a/tftf/tests/tests-spm.mk +++ b/tftf/tests/tests-spm.mk @@ -9,11 +9,9 @@ TESTS_SOURCES += \ ffa_helpers.c \ spm_common.c \ test_ffa_direct_messaging.c \ - test_ffa_features.c \ test_ffa_interrupts.c \ test_ffa_memory_sharing.c \ - test_ffa_rxtx_map.c \ - test_ffa_version.c \ + test_ffa_setup_and_discovery.c \ test_spm_cpu_features.c \ test_spm_smmu.c \ ) diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml index 32efc161b..cafbc4629 100644 --- a/tftf/tests/tests-spm.xml +++ b/tftf/tests/tests-spm.xml @@ -7,27 +7,27 @@ --> <testsuites> + <testsuite name="FF-A Setup and Discovery" + description="Test FF-A Setup and Discovery interfaces" > + <testcase name="Test FFA_FEATURES" + function="test_ffa_features" /> - <testsuite name="FF-A Version" - description="Test FF-A Version ABI" > - - <testcase name="Same FFA version as SPM" - function="test_ffa_version_equal" /> - <testcase name="Setting bit 31 in input version" - function="test_ffa_version_bit31"/> - <testcase name="Bigger FFA version than SPM" - function="test_ffa_version_bigger" /> - <testcase name="Smaller FFA version than SPM" - function="test_ffa_version_smaller" /> - - </testsuite> + <testcase name="Same FFA version as SPM" + function="test_ffa_version_equal" /> + <testcase name="Setting bit 31 in input version" + function="test_ffa_version_bit31"/> + <testcase name="Bigger FFA version than SPM" + function="test_ffa_version_bigger" /> + <testcase name="Smaller FFA version than SPM" + function="test_ffa_version_smaller" /> - <testsuite name="FF-A RXTX Mapping" - description="Test to FF-A RXTX mapping ABI" > <testcase name="FF-A RXTX Map API success" function="test_ffa_rxtx_map_success" /> <testcase name="FF-A RXTX Map API consecutive" function="test_ffa_rxtx_map_fail" /> + + <testcase name="Test FFA_SPM_ID_GET" + function="test_ffa_spm_id_get" /> </testsuite> <testsuite name="FF-A Direct messaging" @@ -66,12 +66,6 @@ function="test_req_mem_donate_sp_to_sp" /> </testsuite> - <testsuite name="FF-A features" - description="Test FFA_FEATURES ABI" > - <testcase name="Test FFA_FEATURES" - function="test_ffa_features" /> - </testsuite> - <testsuite name="SIMD,SVE Registers context" description="Validate context switch between NWd and SWd" > <testcase name="Check that SIMD registers context is preserved" @@ -89,4 +83,5 @@ <testcase name="Check DMA command by SMMUv3TestEngine completes" function="test_smmu_spm" /> </testsuite> + </testsuites> |