fix(ff-a): tftf handling of its RXTX buffer pair
The way tftf was handling the RXTX buffer pair created a dependency
on a set of tests from 'test_ffa_setup_and_discovery.c'. This was
problematic for test configurations for which the SPM tests are
not present.
This patch removes such dependency:
- Delete the 'INIT_MAILBOX' macro, and 'init_mailbox' function;
- RXTX buffer pair allocated within the 'get_tftf_mailbox'.
They are mapped into the SPMC via FFA_RXTX_MAP, and are returned
in the function's argument.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ia010ebd21f11ab7ca6582b574ffc9179693b1eed
diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c
index 46a376f..cba4dad 100644
--- a/tftf/tests/common/test_helpers.c
+++ b/tftf/tests/common/test_helpers.c
@@ -132,20 +132,32 @@
return test_ret;
}
-void set_tftf_mailbox(const struct mailbox_buffers *mb)
+bool reset_tftf_mailbox(void)
{
- if (mb != NULL) {
- test_mb = *mb;
+ 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)
{
- if ((test_mb.recv != NULL) && (test_mb.send != NULL)) {
- *mb = test_mb;
- return true;
+ 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;
+ }
}
- return false;
+
+ *mb = test_mb;
+
+ return true;
}
test_result_t check_spmc_testing_set_up(
@@ -235,24 +247,6 @@
}
/*
- * Initializes the Mailbox for other SPM related tests that need to use
- * RXTX buffers.
- */
-bool mailbox_init(struct mailbox_buffers mb)
-{
- struct ffa_value 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;
-}
-
-/*
* Utility function to wait for all CPUs other than the caller to be
* OFF.
*/