test(spm): check rxtx unmap at NS physical instance
Validate that a call to FFA_RXTX_UNMAP from the NS
physical FF-A instance, can't result in SPMC unampping
buffers belonging to an SP.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Iebb51a1bb8db96c6ea9e22235e0d884f7b62f1c7
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
index 1300f70..72982e9 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
@@ -304,6 +304,42 @@
}
return ret;
}
+
+/*
+ * The FFA_RXTX_UNMAP specification at the NS physical FF-A instance allows for
+ * an ID to be given to the SPMC. The ID should relate to a VM that had its ID
+ * previously forwarded to the SPMC.
+ * This test validates that calls to FFA_RXTX_UNMAP from the NS physical
+ * instance can't unmap RXTX buffer pair of an SP.
+ */
+test_result_t test_ffa_rxtx_unmap_fail_if_sp(void)
+{
+ struct ffa_value ret;
+ struct ffa_value args;
+
+ CHECK_SPMC_TESTING_SETUP(1, 1, sp_uuids);
+
+ /* Invoked FFA_RXTX_UNMAP, providing the ID of an SP in w1. */
+ args = (struct ffa_value) {
+ .fid = FFA_RXTX_UNMAP,
+ .arg1 = SP_ID(1) << 16,
+ .arg2 = FFA_PARAM_MBZ,
+ .arg3 = FFA_PARAM_MBZ,
+ .arg4 = FFA_PARAM_MBZ,
+ .arg5 = FFA_PARAM_MBZ,
+ .arg6 = FFA_PARAM_MBZ,
+ .arg7 = FFA_PARAM_MBZ
+ };
+
+ ret = ffa_service_call(&args);
+
+ if (!is_expected_ffa_error(ret, FFA_ERROR_INVALID_PARAMETER)) {
+ return TEST_RESULT_FAIL;
+ }
+
+ return TEST_RESULT_SUCCESS;
+}
+
/******************************************************************************
* FF-A SPM_ID_GET ABI Tests
******************************************************************************/
diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml
index 68d6357..9d5bcad 100644
--- a/tftf/tests/tests-spm.xml
+++ b/tftf/tests/tests-spm.xml
@@ -36,7 +36,8 @@
function="test_ffa_rxtx_unmap_fail" />
<testcase name="FF-A RXTX remap unmapped region success"
function="test_ffa_rxtx_map_unmapped_success" />
-
+ <testcase name="FF-A RXTX unmap SP rxtx buffer"
+ function="test_ffa_rxtx_unmap_fail_if_sp" />
<testcase name="Test FFA_SPM_ID_GET"
function="test_ffa_spm_id_get" />