feat(cactus): use security state attribute

Cactus uses security attribute from memory transaction
descriptor in the shared memory related tests.

Change-Id: I7c4f3ef2c72e36236d23e5a061e27a2ea60fa2d6
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 9dc0d90..a12a588 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -201,15 +201,10 @@
 static inline struct ffa_value cactus_mem_send_cmd(
 	ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
 	ffa_memory_handle_t handle, ffa_memory_region_flags_t retrieve_flags,
-	bool non_secure, uint16_t word_to_write)
+	uint16_t word_to_write)
 {
-	/*
-	 * `non_secure` and `word_to_write` are packed in the same register.
-	 * Packed in a 32-bit value to support AArch32 platforms (eg Juno).
-	 */
-	uint32_t val3 = ((uint32_t)non_secure << 16) | word_to_write;
 	return cactus_send_cmd(source, dest, CACTUS_MEM_SEND_CMD, mem_func,
-			       handle, retrieve_flags, val3);
+			       handle, retrieve_flags, word_to_write);
 }
 
 static inline ffa_memory_handle_t cactus_mem_send_get_handle(
@@ -229,11 +224,6 @@
 	return (uint16_t)ret.arg7;
 }
 
-static inline bool cactus_mem_send_get_non_secure(struct ffa_value ret)
-{
-	return (bool)(ret.arg7 >> 16);
-}
-
 /**
  * Command to request a memory management operation. The 'mem_func' argument
  * identifies the operation that is to be performend, and 'receiver' is the id
diff --git a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
index d9467b4..15ab0f1 100644
--- a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
+++ b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
@@ -80,7 +80,6 @@
 	ffa_memory_region_flags_t retrv_flags =
 					 cactus_mem_send_get_retrv_flags(*args);
 	uint32_t words_to_write = cactus_mem_send_words_to_write(*args);
-	bool non_secure = cactus_mem_send_get_non_secure(*args);
 
 	expect(memory_retrieve(mb, &m, handle, source, vm_id,
 			       retrv_flags, mem_func), true);
@@ -101,7 +100,8 @@
 
 	mem_attrs = MT_RW_DATA | MT_EXECUTE_NEVER;
 
-	if (non_secure) {
+	if (ffa_get_memory_security_attr(m->attributes) ==
+	    FFA_MEMORY_SECURITY_NON_SECURE) {
 		mem_attrs |= MT_NS;
 	}
 
@@ -237,7 +237,7 @@
 	}
 
 	ffa_ret = cactus_mem_send_cmd(vm_id, receiver, mem_func, handle,
-				      0, non_secure, 10);
+				      0, 10);
 
 	if (!is_ffa_direct_response(ffa_ret)) {
 		return cactus_error_resp(vm_id, source, CACTUS_ERROR_FFA_CALL);
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c b/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
index 6fd77d2..5cb6dd4 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_exceptions.c
@@ -82,7 +82,7 @@
 
 	/* Retrieve the shared page and attempt accessing it. */
 	ret = cactus_mem_send_cmd(SENDER, RECEIVER, FFA_MEM_SHARE_SMC32,
-				  handle, 0, true, 1);
+				  handle, 0, 1);
 
 	/* Undelegate the shared page. */
 	retmm = host_rmi_granule_undelegate((u_register_t)&share_page);
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 83c94c1..60e6a1b 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
@@ -161,7 +161,7 @@
 	ptr = (uint32_t *)constituents[0].address;
 
 	ret = cactus_mem_send_cmd(SENDER, borrower, mem_func, handle, 0,
-				  true, nr_words_to_write);
+				  nr_words_to_write);
 
 	if (!is_ffa_direct_response(ret)) {
 		return TEST_RESULT_FAIL;
@@ -421,8 +421,7 @@
 	VERBOSE("Memory has been shared!\n");
 
 	ret = cactus_mem_send_cmd(SENDER, RECEIVER, FFA_MEM_LEND_SMC32, handle,
-				  FFA_MEMORY_REGION_FLAG_CLEAR, true,
-				  nr_words_to_write);
+				  FFA_MEMORY_REGION_FLAG_CLEAR, nr_words_to_write);
 
 	if (!is_ffa_direct_response(ret)) {
 		return TEST_RESULT_FAIL;