aboutsummaryrefslogtreecommitdiff
path: root/tftf
diff options
context:
space:
mode:
authorJ-Alves <joao.alves@arm.com>2020-11-18 10:51:15 +0000
committerJ-Alves <joao.alves@arm.com>2021-01-20 14:44:50 +0000
commit27390fd363595890aaf9ae4634dff97cf898349e (patch)
tree57d805d49dabd270aa070486efc7ed3a64edf37d /tftf
parentd8edeed7e7b64fb92390df52ec96b655e0ed0a38 (diff)
downloadtf-a-tests-27390fd363595890aaf9ae4634dff97cf898349e.tar.gz
TFTF: tests to request SP-to-SP memory share
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I06cd2aedf48232dff4c530f1930297f2d962b3f3
Diffstat (limited to 'tftf')
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_memory_sharing.c50
-rw-r--r--tftf/tests/tests-spm.xml18
2 files changed, 61 insertions, 7 deletions
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 25cc77b1d..a267b51d2 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
@@ -21,7 +21,7 @@ static const struct ffa_uuid expected_sp_uuids[] = {
{PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID}
};
-/* Memory section to be sent over mem management ABIs */
+/* Memory section to be used for memory share operations */
static __aligned(PAGE_SIZE) uint8_t share_page[PAGE_SIZE];
/**
@@ -125,3 +125,51 @@ test_result_t test_mem_donate_sp(void)
{
return test_memory_send_sp(FFA_MEM_DONATE_SMC32);
}
+
+/*
+ * Test requests a memory send operation between cactus SPs.
+ * 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)
+{
+ smc_ret_values ret;
+
+ /***********************************************************************
+ * Check if SPMC's ffa_version and presence of expected FF-A endpoints.
+ **********************************************************************/
+ CHECK_HAFNIUM_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
+
+ ret = CACTUS_REQ_MEM_SEND_SEND_CMD(HYP_ID, sender_sp, mem_func,
+ receiver_sp);
+
+ if (ret.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
+ ERROR("Failed to send message. error: %lx\n", ret.ret2);
+ return TEST_RESULT_FAIL;
+ }
+
+ if (CACTUS_IS_ERROR_RESP(ret)) {
+ return TEST_RESULT_FAIL;
+ }
+
+ return TEST_RESULT_SUCCESS;
+}
+
+test_result_t test_req_mem_share_sp_to_sp(void)
+{
+ return test_req_mem_send_sp_to_sp(FFA_MEM_SHARE_SMC32, SP_ID(3),
+ SP_ID(2));
+}
+
+test_result_t test_req_mem_lend_sp_to_sp(void)
+{
+ return test_req_mem_send_sp_to_sp(FFA_MEM_LEND_SMC32, SP_ID(2),
+ SP_ID(1));
+}
+
+test_result_t test_req_mem_donate_sp_to_sp(void)
+{
+ return test_req_mem_send_sp_to_sp(FFA_MEM_DONATE_SMC32, SP_ID(1),
+ SP_ID(3));
+}
diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml
index 14be8ca5a..2637acde0 100644
--- a/tftf/tests/tests-spm.xml
+++ b/tftf/tests/tests-spm.xml
@@ -46,12 +46,18 @@
<testsuite name="FF-A Memory Sharing"
description="Test FF-A Memory Sharing ABIs" >
- <testcase name="Lend Memory to Secure World"
- function="test_mem_lend_sp" />
- <testcase name="Share Memory with Secure World"
- function="test_mem_share_sp" />
- <testcase name="Donate Memory to Secure World"
- function="test_mem_donate_sp"/>
+ <testcase name="Lend Memory to Secure World"
+ function="test_mem_lend_sp" />
+ <testcase name="Share Memory with Secure World"
+ function="test_mem_share_sp" />
+ <testcase name="Donate Memory to Secure World"
+ function="test_mem_donate_sp"/>
+ <testcase name="Request Share Memory SP-to-SP"
+ function="test_req_mem_share_sp_to_sp" />
+ <testcase name="Request Lend Memory SP-to-SP"
+ function="test_req_mem_lend_sp_to_sp" />
+ <testcase name="Request Donate Memory SP-to-SP"
+ function="test_req_mem_donate_sp_to_sp" />
</testsuite>
<testsuite name="FF-A features"