fix: UUID field for PARTITION_INFO_GET
The EAC0 v1.1 FF-A spec now requires that the UUID field in the
partition information descriptors is only populated when
FFA_PARTITION_INFO_GET is supplied with a null uuid (Table 13.37).
This patch implements this change and updates the tests to check
for this.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I221f2378655874c9e3ac17235f2529cafa9328e8
diff --git a/src/api.c b/src/api.c
index 019b719..c73e7d3 100644
--- a/src/api.c
+++ b/src/api.c
@@ -441,7 +441,7 @@
bool count_flag = (flags && FFA_PARTITION_COUNT_FLAG_MASK) ==
FFA_PARTITION_COUNT_FLAG;
bool uuid_is_null = ffa_uuid_is_null(uuid);
- struct ffa_partition_info partitions[2 * MAX_VMS];
+ struct ffa_partition_info partitions[2 * MAX_VMS] = {0};
struct vm_locked vm_locked;
struct ffa_value ret;
@@ -482,7 +482,9 @@
vm_are_notifications_enabled(vm)
? FFA_PARTITION_NOTIFICATION
: 0;
- partitions[array_index].uuid = vm->uuid;
+ if (uuid_is_null) {
+ partitions[array_index].uuid = vm->uuid;
+ }
}
}
}
diff --git a/test/vmapi/ffa_secure_partitions/setup_and_discovery.c b/test/vmapi/ffa_secure_partitions/setup_and_discovery.c
index 466c81e..73c49c1 100644
--- a/test/vmapi/ffa_secure_partitions/setup_and_discovery.c
+++ b/test/vmapi/ffa_secure_partitions/setup_and_discovery.c
@@ -157,10 +157,15 @@
EXPECT_EQ(partitions[0].vm_id, HF_SPMC_VM_ID + 1);
EXPECT_TRUE(partitions[0].vcpu_count == 8 ||
partitions[0].vcpu_count == 1);
- EXPECT_EQ(partitions[0].uuid.uuid[0], uuid.uuid[0]);
- EXPECT_EQ(partitions[0].uuid.uuid[1], uuid.uuid[1]);
- EXPECT_EQ(partitions[0].uuid.uuid[2], uuid.uuid[2]);
- EXPECT_EQ(partitions[0].uuid.uuid[3], uuid.uuid[3]);
+
+ /*
+ * If a uuid is specified (not null) ensure the uuid returned in the
+ * partition info descriptor is zeroed.
+ */
+ EXPECT_EQ(partitions[0].uuid.uuid[0], 0);
+ EXPECT_EQ(partitions[0].uuid.uuid[1], 0);
+ EXPECT_EQ(partitions[0].uuid.uuid[2], 0);
+ EXPECT_EQ(partitions[0].uuid.uuid[3], 0);
EXPECT_EQ(ffa_rx_release().func, FFA_SUCCESS_32);
}