feat(ff-a): memory share bump to v1.1 EAC0

Hafnium was updated to match FF-A v1.1 EAC0 [1].
This is the equivalent change for FF-A memory sharing
tests.

[1] https://review.trustedfirmware.org/c/hafnium/hafnium/+/15012

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ibf39ac35e1c7e336843be848fb389401dd792516
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 8ca51d3..8ce6ed3 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -352,10 +352,10 @@
 typedef uint8_t ffa_memory_access_permissions_t;
 
 /**
- * This corresponds to table "Memory region attributes descriptor" of the FF-A
- * 1.0 specification.
+ * This corresponds to table 10.18 of the FF-A v1.1 EAC0 specification, "Memory
+ * region attributes descriptor".
  */
-typedef uint8_t ffa_memory_attributes_t;
+typedef uint16_t ffa_memory_attributes_t;
 
 #define FFA_DATA_ACCESS_OFFSET (0x0U)
 #define FFA_DATA_ACCESS_MASK ((0x3U) << FFA_DATA_ACCESS_OFFSET)
@@ -419,7 +419,8 @@
 
 /**
  * A set of contiguous pages which is part of a memory region. This corresponds
- * to table "Constituent memory region descriptor" of the FFA 1.0 specification.
+ * to table 10.14 of the FF-A v1.1 EAC0 specification, "Constituent memory
+ * region descriptor".
  */
 struct ffa_memory_region_constituent {
 	/**
@@ -434,8 +435,8 @@
 };
 
 /**
- * A set of pages comprising a memory region. This corresponds to table
- * "Composite memory region descriptor" of the FFA 1.0 specification.
+ * A set of pages comprising a memory region. This corresponds to table 10.13 of
+ * the FF-A v1.1 EAC0 specification, "Composite memory region descriptor".
  */
 struct ffa_composite_memory_region {
 	/**
@@ -520,9 +521,9 @@
 
 /**
  * Information about a set of pages which are being shared. This corresponds to
- * table "Lend, donate or share memory transaction descriptor" of the FFA
- * 1.0 specification. Note that it is also used for retrieve requests and
- * responses.
+ * table 10.20 of the FF-A v1.1 EAC0 specification, "Lend, donate or share
+ * memory transaction descriptor". Note that it is also used for retrieve
+ * requests and responses.
  */
 struct ffa_memory_region {
 	/**
@@ -531,8 +532,6 @@
 	 */
 	ffa_id_t sender;
 	ffa_memory_attributes_t attributes;
-	/** Reserved field, must be 0. */
-	uint8_t reserved_0;
 	/** Flags to control behaviour of the transaction. */
 	ffa_memory_region_flags_t flags;
 	ffa_memory_handle_t handle;
@@ -541,15 +540,22 @@
 	 * memory region.
 	 */
 	uint64_t tag;
-	/** Reserved field, must be 0. */
-	uint32_t reserved_1;
+	/** Size of the memory access descriptor. */
+	uint32_t memory_access_desc_size;
 	/**
 	 * The number of `ffa_memory_access` entries included in this
 	 * transaction.
 	 */
 	uint32_t receiver_count;
 	/**
-	 * An array of `attribute_count` endpoint memory access descriptors.
+	 * Offset of the 'receivers' field, which relates to the memory access
+	 * descriptors.
+	 */
+	uint32_t receivers_offset;
+	/** Reserved field (12 bytes) must be 0. */
+	uint32_t reserved[3];
+	/**
+	 * An array of `receiver_count` endpoint memory access descriptors.
 	 * Each one specifies a memory region offset, an endpoint and the
 	 * attributes with which this memory region should be mapped in that
 	 * endpoint's page table.
@@ -559,7 +565,8 @@
 
 /**
  * Descriptor used for FFA_MEM_RELINQUISH requests. This corresponds to table
- * "Descriptor to relinquish a memory region" of the FFA 1.0 specification.
+ * 16.25 of the FF-A v1.1 EAC0 specification, "Descriptor to relinquish a memory
+ * region".
  */
 struct ffa_mem_relinquish {
 	ffa_memory_handle_t handle;
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index 1071186..55221da 100644
--- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -155,17 +155,20 @@
 {
 	memory_region->sender = sender;
 	memory_region->attributes = attributes;
-	memory_region->reserved_0 = 0;
 	memory_region->flags = flags;
 	memory_region->handle = handle;
 	memory_region->tag = tag;
-	memory_region->reserved_1 = 0;
+	memory_region->memory_access_desc_size =
+		sizeof(struct ffa_memory_access);
 	memory_region->receiver_count = 1;
 	memory_region->receivers[0].receiver_permissions.receiver = receiver;
 	memory_region->receivers[0].receiver_permissions.permissions =
 		permissions;
 	memory_region->receivers[0].receiver_permissions.flags = 0;
 	memory_region->receivers[0].reserved_0 = 0;
+	/* Receivers at the end of the `ffa_memory_region` structure. */
+	memory_region->receivers_offset = sizeof(struct ffa_memory_region);
+	memset(memory_region->reserved, 0, sizeof(memory_region->reserved));
 }
 
 /**
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 f382ff3..9309eba 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
@@ -70,12 +70,12 @@
 	/***********************************************************************
 	 * Check if SPMC has ffa_version and expected FFA endpoints are deployed.
 	 **********************************************************************/
-	CHECK_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
+	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
 
 	GET_TFTF_MAILBOX(mb);
 
 	struct ffa_memory_region_constituent constituents[] = {
-						{(void *)share_page, 1, 0}
+						{(void *)share_page, 1, 1}
 					};
 
 	const uint32_t constituents_count = sizeof(constituents) /
@@ -151,7 +151,7 @@
 	/***********************************************************************
 	 * Check if SPMC's ffa_version and presence of expected FF-A endpoints.
 	 **********************************************************************/
-	CHECK_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
+	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
 
 	ret = cactus_req_mem_send_send_cmd(HYP_ID, sender_sp, mem_func,
 					   receiver_sp, non_secure);
@@ -183,7 +183,7 @@
 	/**********************************************************************
 	 * Check if SPMC's ffa_version and presence of expected FF-A endpoints.
 	 *********************************************************************/
-	CHECK_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
+	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
 
 	ret = cactus_req_mem_send_send_cmd(HYP_ID, sender_sp, mem_func,
 					   receiver_vm, false);
@@ -255,7 +255,7 @@
 test_result_t test_mem_share_to_sp_clear_memory(void)
 {
 	struct ffa_memory_region_constituent constituents[] = {
-						{(void *)share_page, 1, 0}};
+						{(void *)share_page, 1, 1}};
 	const uint32_t constituents_count = sizeof(constituents) /
 			sizeof(struct ffa_memory_region_constituent);
 	struct mailbox_buffers mb;
@@ -268,7 +268,7 @@
 	/* Arbitrarily write 10 words after using shared memory. */
 	const uint32_t nr_words_to_write = 10U;
 
-	CHECK_SPMC_TESTING_SETUP(1, 0, expected_sp_uuids);
+	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
 
 	GET_TFTF_MAILBOX(mb);