diff options
author | Max Shvetsov <maksims.svecovs@arm.com> | 2020-06-08 11:15:30 +0100 |
---|---|---|
committer | Max Shvetsov <maksims.svecovs@arm.com> | 2020-07-27 13:36:01 +0100 |
commit | 40eb6a2ee493beb61d617f249af91e4f52453700 (patch) | |
tree | 55bf174271d54fad16fb0f1d7b1e25f67216f1cb /spm/cactus/cactus_ffa_tests.c | |
parent | c17c1d3ad278e007b551617be23b09e13b577ef0 (diff) | |
download | tf-a-tests-40eb6a2ee493beb61d617f249af91e4f52453700.tar.gz |
Cactus: FFA_FEATURES test.
Calls FFA_FEATURES API from the secure virtual FF-A instance which is serviced by SPMC.
Expected responses should be edited according to the feature
implementation progress.
Removing obsolete SPRT version check and cactus_tests_misc.c as a
result.
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Change-Id: I8a2e569a3bce31a735e1af04994984fda2168296
Diffstat (limited to 'spm/cactus/cactus_ffa_tests.c')
-rw-r--r-- | spm/cactus/cactus_ffa_tests.c | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c index 411cc9f2..46813bbe 100644 --- a/spm/cactus/cactus_ffa_tests.c +++ b/spm/cactus/cactus_ffa_tests.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ #include <assert.h> -#include <errno.h> #include <debug.h> +#include <errno.h> #include <ffa_helpers.h> #include <sp_helpers.h> @@ -13,6 +13,66 @@ #define FFA_MAJOR 1U #define FFA_MINOR 0U +struct feature_test { + const char *test_name; + unsigned int feature; + unsigned int expected_ret; +}; + +static const struct feature_test test_target[] = { + {"FFA_ERROR_32 check", FFA_ERROR, FFA_SUCCESS_SMC32}, + {"FFA_SUCCESS_32 check", FFA_SUCCESS_SMC32, FFA_SUCCESS_SMC32}, + {"FFA_INTERRUPT_32 check", FFA_INTERRUPT, FFA_SUCCESS_SMC32}, + {"FFA_VERSION_32 check", FFA_VERSION, FFA_SUCCESS_SMC32}, + {"FFA_FEATURES_32 check", FFA_FEATURES, FFA_SUCCESS_SMC32}, + {"FFA_RX_RELEASE_32 check", FFA_RX_RELEASE, FFA_SUCCESS_SMC32}, + {"FFA_RXTX_MAP_32 check", FFA_RXTX_MAP_SMC32, FFA_ERROR}, + {"FFA_RXTX_MAP_64 check", FFA_RXTX_MAP_SMC64, FFA_SUCCESS_SMC32}, + {"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_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}, + {"FFA_RUN_32 check", FFA_MSG_RUN, FFA_SUCCESS_SMC32}, + {"FFA_MSG_SEND_32 check", FFA_MSG_SEND, FFA_SUCCESS_SMC32}, + {"FFA_MEM_DONATE_32 check", FFA_MEM_DONATE_SMC32, FFA_SUCCESS_SMC32}, + {"FFA_MEM_LEND_32 check", FFA_MEM_LEND_SMC32, FFA_SUCCESS_SMC32}, + {"FFA_MEM_SHARE_32 check", FFA_MEM_SHARE_SMC32, FFA_SUCCESS_SMC32}, + {"FFA_MEM_RETRIEVE_REQ_32 check", FFA_MEM_RETRIEVE_REQ_SMC32, FFA_SUCCESS_SMC32}, + {"FFA_MEM_RETRIEVE_RESP_32 check", FFA_MEM_RETRIEVE_RESP, FFA_SUCCESS_SMC32}, + {"FFA_MEM_RELINQUISH_32 check", FFA_MEM_RELINQUISH, FFA_SUCCESS_SMC32}, + {"FFA_MEM_RECLAIM_32 check", FFA_MEM_RECLAIM, FFA_SUCCESS_SMC32}, + {"Check non-existent command", 0xFFFF, FFA_ERROR} +}; + +/* + * Test FFA_FEATURES interface. + */ +static void ffa_features_test(void) +{ + const char *test_features = "FFA Features interface"; + smc_ret_values ffa_ret; + unsigned int i, test_target_size = + sizeof(test_target) / sizeof(struct feature_test); + + announce_test_section_start(test_features); + + for (i = 0U; i < test_target_size; i++) { + announce_test_start(test_target[i].test_name); + + ffa_ret = ffa_features(test_target[i].feature); + expect(ffa_ret.ret0, test_target[i].expected_ret); + if (test_target[i].expected_ret == FFA_ERROR) { + expect(ffa_ret.ret2, FFA_ERROR_NOT_SUPPORTED); + } + + announce_test_end(test_target[i].test_name); + } + + announce_test_section_end(test_features); +} + void ffa_tests(void) { const char *test_ffa = "FFA Interfaces"; @@ -25,8 +85,9 @@ void ffa_tests(void) smc_ret_values ret = ffa_version(MAKE_FFA_VERSION(FFA_MAJOR, FFA_MINOR)); uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret.ret0); - bool ffa_version_compatible = ((spm_version >> FFA_VERSION_MAJOR_SHIFT) == FFA_MAJOR && - (spm_version & FFA_VERSION_MINOR_MASK) >= FFA_MINOR); + bool ffa_version_compatible = + ((spm_version >> FFA_VERSION_MAJOR_SHIFT) == FFA_MAJOR && + (spm_version & FFA_VERSION_MINOR_MASK) >= FFA_MINOR); NOTICE("FFA_VERSION returned %u.%u; Compatible: %i\n", spm_version >> FFA_VERSION_MAJOR_SHIFT, @@ -37,5 +98,7 @@ void ffa_tests(void) announce_test_end(test_ffa_version); + ffa_features_test(); + announce_test_section_end(test_ffa); } |