diff options
author | Daniel Boulby <daniel.boulby@arm.com> | 2022-05-30 17:32:00 +0100 |
---|---|---|
committer | Daniel Boulby <daniel.boulby@arm.com> | 2022-06-23 13:37:43 +0100 |
commit | 07d751ee6b699387da1ec7093c2a18c7244247de (patch) | |
tree | 5690ce1a7ef84b93d71ee78c23f07972752d2727 | |
parent | 9df3959b491bb118df63c33621470d41db4a7895 (diff) | |
download | tf-a-tests-07d751ee6b699387da1ec7093c2a18c7244247de.tar.gz |
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
3 files changed, 19 insertions, 2 deletions
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h index 12506734f..0ad8c4290 100644 --- a/include/runtime_services/ffa_helpers.h +++ b/include/runtime_services/ffa_helpers.h @@ -220,6 +220,11 @@ static inline uint32_t ffa_partition_info_count(struct ffa_value val) 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 efdaa3fdf..571242f5f 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 @@ bool ffa_partition_info_helper(struct mailbox_buffers *mb, 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 ad9da1a18..ae8e7e2f6 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 @@ test_result_t test_ffa_partition_info_v1_0(void) 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); |