aboutsummaryrefslogtreecommitdiff
path: root/spm/cactus/cactus_ffa_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'spm/cactus/cactus_ffa_tests.c')
-rw-r--r--spm/cactus/cactus_ffa_tests.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c
index 46813bb..2e6e446 100644
--- a/spm/cactus/cactus_ffa_tests.c
+++ b/spm/cactus/cactus_ffa_tests.c
@@ -6,6 +6,7 @@
#include <assert.h>
#include <debug.h>
#include <errno.h>
+#include <cactus_def.h>
#include <ffa_helpers.h>
#include <sp_helpers.h>
@@ -13,6 +14,10 @@
#define FFA_MAJOR 1U
#define FFA_MINOR 0U
+static const uint32_t primary_uuid[4] = PRIMARY_UUID;
+static const uint32_t secondary_uuid[4] = SECONDARY_UUID;
+static const uint32_t null_uuid[4] = {0};
+
struct feature_test {
const char *test_name;
unsigned int feature;
@@ -73,7 +78,71 @@ static void ffa_features_test(void)
announce_test_section_end(test_features);
}
-void ffa_tests(void)
+static void ffa_partition_info_helper(struct mailbox_buffers *mb, const uint32_t uuid[4],
+ const struct ffa_partition_info *expected,
+ const uint16_t expected_size)
+{
+ smc_ret_values ret = ffa_partition_info_get(uuid);
+ unsigned int i;
+ expect(ret.ret0, FFA_SUCCESS_SMC32);
+
+ struct ffa_partition_info *info = (struct ffa_partition_info *)(mb->recv);
+ for (i = 0U; i < expected_size; i++) {
+ expect(info[i].id, expected[i].id);
+ expect(info[i].exec_context, expected[i].exec_context);
+ expect(info[i].properties, expected[i].properties);
+ }
+
+ ret = ffa_rx_release();
+ expect(ret.ret0, FFA_SUCCESS_SMC32);
+}
+
+static void ffa_partition_info_wrong_test(void)
+{
+ const char *test_wrong_uuid = "Request wrong UUID";
+ uint32_t uuid[4] = {1};
+
+ announce_test_start(test_wrong_uuid);
+
+ smc_ret_values ret = ffa_partition_info_get(uuid);
+ expect(ret.ret0, FFA_ERROR);
+ expect(ret.ret2, FFA_ERROR_INVALID_PARAMETER);
+
+ announce_test_end(test_wrong_uuid);
+}
+
+static void ffa_partition_info_get_test(struct mailbox_buffers *mb)
+{
+ const char *test_partition_info = "FFA Partition info interface";
+ const char *test_primary = "Get primary partition info";
+ const char *test_secondary = "Get secondary partition info";
+ const char *test_all = "Get all partitions info";
+
+ const struct ffa_partition_info expected_info[] = {
+ {.id = SPM_VM_ID_FIRST, .exec_context = 8, .properties = 0}, /* Primary partition info */
+ {.id = 2, .exec_context = 2, .properties = 0} /* Secondary partition info */
+ };
+
+ announce_test_section_start(test_partition_info);
+
+ announce_test_start(test_secondary);
+ ffa_partition_info_helper(mb, secondary_uuid, &expected_info[1], 1);
+ announce_test_end(test_secondary);
+
+ announce_test_start(test_primary);
+ ffa_partition_info_helper(mb, primary_uuid, &expected_info[0], 1);
+ announce_test_end(test_primary);
+
+ announce_test_start(test_all);
+ ffa_partition_info_helper(mb, null_uuid, expected_info, 2);
+ announce_test_end(test_all);
+
+ ffa_partition_info_wrong_test();
+
+ announce_test_section_end(test_partition_info);
+}
+
+void ffa_tests(struct mailbox_buffers *mb)
{
const char *test_ffa = "FFA Interfaces";
const char *test_ffa_version = "FFA Version interface";
@@ -99,6 +168,7 @@ void ffa_tests(void)
announce_test_end(test_ffa_version);
ffa_features_test();
+ ffa_partition_info_get_test(mb);
announce_test_section_end(test_ffa);
}