feat(ff-a): add impdef field to ffa_memory_access

Add impdef field to the endpoint memory access descriptor as
introduced by FF-A v1.2.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: Ieb2808a5b4a8773cb4729c5aa10a6a0223ed8039
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 3f760fa..ffd7b67 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -527,6 +527,10 @@
 /** The maximum number of recipients a memory region may be sent to. */
 #define MAX_MEM_SHARE_RECIPIENTS 1U
 
+struct ffa_memory_access_impdef {
+	uint64_t val[2];
+};
+
 /**
  * This corresponds to table "Endpoint memory access descriptor" of the FFA 1.0
  * specification.
@@ -538,6 +542,8 @@
 	 * an `ffa_composite_memory_region` struct.
 	 */
 	uint32_t composite_memory_region_offset;
+	/* Space for implementation defined information */
+	struct ffa_memory_access_impdef impdef;
 	uint64_t reserved_0;
 };
 
@@ -751,10 +757,11 @@
 					     const uint16_t start_index,
 					     const uint16_t tag);
 
-struct ffa_memory_access ffa_memory_access_init_permissions(
+struct ffa_memory_access ffa_memory_access_init(
 	ffa_id_t receiver_id, enum ffa_data_access data_access,
 	enum ffa_instruction_access instruction_access,
-	ffa_memory_receiver_flags_t flags);
+	ffa_memory_receiver_flags_t flags,
+	struct ffa_memory_access_impdef *impdef);
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
index 2fbc63b..8ea85c4 100644
--- a/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
+++ b/spm/cactus/cactus_tests/cactus_test_memory_sharing.c
@@ -81,12 +81,12 @@
 					 cactus_mem_send_get_retrv_flags(*args);
 	uint32_t words_to_write = cactus_mem_send_words_to_write(*args);
 
-	struct ffa_memory_access receiver = ffa_memory_access_init_permissions(
+	struct ffa_memory_access receiver = ffa_memory_access_init(
 		vm_id, FFA_DATA_ACCESS_RW,
 		(mem_func == FFA_MEM_SHARE_SMC32)
 			? FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED
 			: FFA_INSTRUCTION_ACCESS_NX,
-		0);
+		0, NULL);
 
 	expect(memory_retrieve(mb, &m, handle, source, &receiver, 1,
 			       retrv_flags),
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index ad63e68..8b53bb0 100644
--- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -787,10 +787,11 @@
 /**
  * Initializes receiver permissions in a memory transaction descriptor.
  */
-struct ffa_memory_access ffa_memory_access_init_permissions(
+struct ffa_memory_access ffa_memory_access_init(
 	ffa_id_t receiver_id, enum ffa_data_access data_access,
 	enum ffa_instruction_access instruction_access,
-	ffa_memory_receiver_flags_t flags)
+	ffa_memory_receiver_flags_t flags,
+	struct ffa_memory_access_impdef *impdef)
 {
 	struct ffa_memory_access access;
 	access.reserved_0 = 0;
@@ -800,6 +801,8 @@
 	access.receiver_permissions.permissions.data_access = data_access;
 	access.receiver_permissions.permissions.instruction_access =
 		instruction_access;
+	access.impdef = impdef != NULL ? *impdef :
+		(struct ffa_memory_access_impdef){{0, 0}};
 
 	return access;
 }
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index dce4b7f..823db76 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -827,6 +827,6 @@
 			? FFA_DATA_ACCESS_NOT_SPECIFIED
 			: FFA_DATA_ACCESS_RW;
 
-	return ffa_memory_access_init_permissions(receiver_id, data_access,
-						  instruction_access, 0);
+	return ffa_memory_access_init(receiver_id, data_access,
+				      instruction_access, 0, NULL);
 }