test(ff-a): check w3 for ffa_partition_info_get
Check that the size of the partition info descriptor is correctly
populated when calling ffa_partition_info_get.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I56fa0e82e52c1ed35fc2ea0208d69eabc5800935
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 1250673..0ad8c42 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -220,6 +220,11 @@
return (uint32_t)val.arg2;
}
+static inline uint32_t ffa_partition_info_desc_size(struct ffa_value val)
+{
+ return (uint32_t)val.arg3;
+}
+
static inline uint32_t ffa_feature_intid(struct ffa_value val)
{
return (uint32_t)val.arg2;
diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c
index efdaa3f..571242f 100644
--- a/tftf/tests/runtime_services/secure_service/spm_common.c
+++ b/tftf/tests/runtime_services/secure_service/spm_common.c
@@ -530,8 +530,14 @@
if (ffa_func_id(ret) == FFA_SUCCESS_SMC32) {
if (ffa_partition_info_count(ret) != expected_size) {
- ERROR("Unexpected number of partitions %ld\n",
- ret.arg2);
+ ERROR("Unexpected number of partitions %d\n",
+ ffa_partition_info_count(ret));
+ return false;
+ }
+ if (ffa_partition_info_desc_size(ret) !=
+ sizeof(struct ffa_partition_info)) {
+ ERROR("Unexpected partition info descriptor size %d\n",
+ ffa_partition_info_desc_size(ret));
return false;
}
const struct ffa_partition_info *info =
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
index ad9da1a..ae8e7e2 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_setup_and_discovery.c
@@ -390,6 +390,12 @@
ffa_partition_info_count(ret));
return TEST_RESULT_FAIL;
}
+ if (ffa_partition_info_desc_size(ret) !=
+ sizeof(struct ffa_partition_info_v1_0)) {
+ ERROR("Unexepcted partition info descriptor size %d\n",
+ ffa_partition_info_desc_size(ret));
+ return TEST_RESULT_FAIL;
+ }
const struct ffa_partition_info_v1_0 *info =
(const struct ffa_partition_info_v1_0 *)(mb.recv);