aboutsummaryrefslogtreecommitdiff
path: root/tftf
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2021-02-11 09:32:20 +0100
committerOlivier Deprez <olivier.deprez@arm.com>2021-03-15 17:06:39 +0100
commit35e1948987aed5929f4c614c79370e12d2a90e52 (patch)
treeea4cb089ea1b6ba063b3489156c66a861ca22ccc /tftf
parentc0e91695bd1a95370d76f7e68098711f08fe4257 (diff)
downloadtf-a-tests-35e1948987aed5929f4c614c79370e12d2a90e52.tar.gz
cactus: declare third SP instance as UP SP
Third cactus instance is declared as a UP SP in its manifest. This permits exercising the test case of TFTF sending direct message requests from any physical core to the single vCPU (hence migrated) that the SP implements. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I70574ebb34ac4f2e2bdb667e8715006167eec6a4
Diffstat (limited to 'tftf')
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c43
1 files changed, 38 insertions, 5 deletions
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 df97cf46..0a722e49 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
@@ -175,8 +175,8 @@ static test_result_t cpu_on_handler(void)
smc_ret_values ffa_ret;
/*
- * Send a direct message request to SP1 from current physical CPU.
- * Notice SP1 ECs are already woken as a result of the PSCI_CPU_ON
+ * Send a direct message request to SP1 (MP SP) from current physical
+ * CPU. Notice SP1 ECs are already woken as a result of the PSCI_CPU_ON
* invocation so they already reached the message loop.
* The SPMC uses the MP pinned context corresponding to the physical
* CPU emitting the request.
@@ -200,15 +200,48 @@ static test_result_t cpu_on_handler(void)
}
/*
- * Send a direct message request to SP2 from current physical CPU.
- * The SPMC uses the MP pinned context corresponding to the physical
- * CPU emitting the request.
+ * Send a direct message request to SP2 (MP SP) from current physical
+ * CPU. The SPMC uses the MP pinned context corresponding to the
+ * physical CPU emitting the request.
*/
ret = send_cactus_echo_cmd(HYP_ID, SP_ID(2), ECHO_VAL2);
if (ret != TEST_RESULT_SUCCESS) {
goto out;
}
+ /*
+ * Send a direct message request to SP3 (UP SP) from current physical CPU.
+ * The SPMC uses the single vCPU migrated to the new physical core.
+ * The single SP vCPU may receive requests from multiple physical CPUs.
+ * Thus it is possible one message is being processed on one core while
+ * another (or multiple) cores attempt sending a new direct message
+ * request. In such case the cores attempting the new request receive
+ * a busy response from the SPMC. To handle this case a retry loop is
+ * implemented permitting some fairness.
+ */
+ uint32_t trial_loop = 5U;
+ while (trial_loop--) {
+ ffa_ret = cactus_echo_send_cmd(HYP_ID, SP_ID(3), ECHO_VAL3);
+ if ((ffa_func_id(ffa_ret) == FFA_ERROR) &&
+ (ffa_error_code(ffa_ret) == FFA_ERROR_BUSY)) {
+ VERBOSE("%s(%u) trial %u\n", __func__, core_pos, trial_loop);
+ waitms(1);
+ continue;
+ }
+
+ if (is_ffa_direct_response(ffa_ret) == true) {
+ if (cactus_get_response(ffa_ret) != CACTUS_SUCCESS ||
+ cactus_echo_get_val(ffa_ret) != ECHO_VAL3) {
+ ERROR("Echo Failed!\n");
+ ret = TEST_RESULT_FAIL;
+ }
+
+ goto out;
+ }
+ }
+
+ ret = TEST_RESULT_FAIL;
+
out:
/* Tell the lead CPU that the calling CPU has completed the test */
tftf_send_event(&cpu_booted[core_pos]);