fix: NS buffer (48b PA) memory sharing between SPs

Fix [1] by increasing cactus number of xlat tables.
This permits running the SP SP mem sharing of a buffer located at a
high physical PA region.
Test config [2] provides the model parameters to configurare the PE,
interconnect and SMMU to handle 48b physical address size.

[1] https://review.trustedfirmware.org/c/TF-A/tf-a-tests/+/13599
[2] https://review.trustedfirmware.org/c/ci/tf-a-ci-scripts/+/15445

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Ia290f15a6d30c898a5219d2bc1c3949b6ae7e7ef
diff --git a/plat/arm/fvp/include/platform_def.h b/plat/arm/fvp/include/platform_def.h
index 2a12fde..b8871c4 100644
--- a/plat/arm/fvp/include/platform_def.h
+++ b/plat/arm/fvp/include/platform_def.h
@@ -253,7 +253,7 @@
 #define MAX_MMAP_REGIONS		50
 #else
 #if IMAGE_CACTUS
-#define MAX_XLAT_TABLES			8
+#define MAX_XLAT_TABLES			9
 #else
 #define MAX_XLAT_TABLES			5
 #endif
diff --git a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
index 884240b..d40f94f 100644
--- a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
+++ b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
@@ -205,8 +205,11 @@
 
 	VERBOSE("Sharing at 0x%llx\n", (uint64_t)constituents[0].address);
 	mem_attrs = MT_RW_DATA;
-	if (non_secure)
+
+	if (non_secure) {
 		mem_attrs |= MT_NS;
+	}
+
 	ret = mmap_add_dynamic_region(
 		(uint64_t)constituents[0].address,
 		(uint64_t)constituents[0].address,
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 7f62ea5..a58e68c 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
@@ -211,17 +211,21 @@
 
 test_result_t test_req_ns_mem_share_sp_to_sp(void)
 {
-	/* Added this peprocessor condition because the test fails when RME is
-	 * enabled, because the model has PA_SIZE=48, but still doesn't have
-	 * allocated RAM allocatable there nor the itnerconnect support 48bit
-	 * addresses. */
-#if PA_SIZE == 48
+	/*
+	 * Skip the test when RME is enabled (for test setup reasons).
+	 * For RME tests, the model specifies 48b physical address size
+	 * at the PE, but misses allocating RAM and increasing the PA at
+	 * the interconnect level.
+	 */
+	if (get_armv9_2_feat_rme_support() != 0U) {
+		return TEST_RESULT_SKIPPED;
+	}
+
+	/* This test requires 48b physical address size capability. */
 	SKIP_TEST_IF_PA_SIZE_LESS_THAN(48);
+
 	return test_req_mem_send_sp_to_sp(FFA_MEM_SHARE_SMC32, SP_ID(3),
 					  SP_ID(2), true);
-#else
-	return TEST_RESULT_SKIPPED;
-#endif
 }
 
 test_result_t test_req_mem_lend_sp_to_sp(void)
diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml
index 878bec6..19033b7 100644
--- a/tftf/tests/tests-spm.xml
+++ b/tftf/tests/tests-spm.xml
@@ -90,7 +90,7 @@
                function="test_req_mem_lend_sp_to_sp" />
      <testcase name="Request Donate Memory SP-to-SP"
                function="test_req_mem_donate_sp_to_sp" />
-     <testcase name="Request Share NS Memory SP-to-SP"
+     <testcase name="Request Share NS Memory (large PA) SP-to-SP"
                function="test_req_ns_mem_share_sp_to_sp" />
      <testcase name="Request Share Memory SP-to-VM"
                function="test_req_mem_share_sp_to_vm" />