diff options
author | nabkah01 <nabil.kahlouche@arm.com> | 2022-03-22 22:54:23 +0000 |
---|---|---|
committer | nabkah01 <nabil.kahlouche@arm.com> | 2022-05-18 11:35:21 +0100 |
commit | d5c67b889678d4e05ab4c43c590e11aa8b58e7f0 (patch) | |
tree | 6fcef96d6d88bfb5ab28efdd22b83f69e42bec69 | |
parent | a13b64bd4a2191b2c9715709b4db841b20fe7110 (diff) | |
download | tf-a-tests-d5c67b889678d4e05ab4c43c590e11aa8b58e7f0.tar.gz |
feat(ff-a): create function helper to setup FF-A mailbox
Fix test dependencies issue when SPM test is used individually.
Provide an API function from SPM test suite to initialize the FF-A
mailbox and enable FF-A based message with SP.
Signed-off-by: Nabil Kahlouche <nabil.kahlouche@arm.com>
Change-Id: I246491907f1641c47937a9a1c91cfd4a9b8bfe20
-rw-r--r-- | include/common/test_helpers.h | 13 | ||||
-rw-r--r-- | tftf/tests/common/test_helpers.c | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h index e8382708d..7a14079c4 100644 --- a/include/common/test_helpers.h +++ b/include/common/test_helpers.h @@ -244,6 +244,14 @@ typedef test_result_t (*test_function_arg_t)(void *arg); } \ } while (false); +#define INIT_TFTF_MAILBOX(mb) \ + do { \ + if (!mailbox_init(mb)) { \ + ERROR("Mailbox not configured properly!\n"); \ + return TEST_RESULT_FAIL; \ + } \ + } while (false); + #define CHECK_SPMC_TESTING_SETUP(ffa_major, ffa_minor, expected_uuids) \ do { \ SKIP_TEST_IF_AARCH32(); \ @@ -407,4 +415,9 @@ bool spm_core_sp_init(ffa_id_t sp_id); */ bool spm_set_managed_exit_int(ffa_id_t sp_id, bool enable); +/** + * Initializes the Mailbox for other SPM related tests that need to use + * RXTX buffers. + */ +bool mailbox_init(struct mailbox_buffers mb); #endif /* __TEST_HELPERS_H__ */ diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c index b7eeb1530..1a6ea6428 100644 --- a/tftf/tests/common/test_helpers.c +++ b/tftf/tests/common/test_helpers.c @@ -256,3 +256,22 @@ bool spm_set_managed_exit_int(ffa_id_t sp_id, bool enable) return true; } + +/* + * Initializes the Mailbox for other SPM related tests that need to use + * RXTX buffers. + */ +bool mailbox_init(struct mailbox_buffers mb) +{ + smc_ret_values ret; + + ffa_rxtx_unmap(); + CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret); + if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) { + ERROR("Failed to map RXTX buffers %x!\n", ffa_error_code(ret)); + return false; + } + set_tftf_mailbox(&mb); + return true; +} + |