summaryrefslogtreecommitdiff
path: root/spm/cactus
diff options
context:
space:
mode:
authorMax Shvetsov <maksims.svecovs@arm.com>2021-03-05 13:46:42 +0000
committerMaksims Svecovs <maksims.svecovs@arm.com>2021-07-15 16:40:22 +0100
commit0b7d25f4add710ba13f4f46c54f8fe23a01ed053 (patch)
tree784c6ebed5eae93c7a73201097165bc2f44e6a4c /spm/cactus
parent1e65e855cf232560f37e64aefa75afb5239e5403 (diff)
refactor(ff-a): partition info test functions
Move common ffa_partition_info_get functions to the spm_common. Secure test target now supports both sending and receiving direct messages. Changes in SP manifests to align with a new messaging method representation in partition manifests. Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: I9f6f24d6b800283a07e84a2a27708c0313b68fdc
Diffstat (limited to 'spm/cactus')
-rw-r--r--spm/cactus/cactus.mk3
-rw-r--r--spm/cactus/cactus_tests/cactus_test_ffa.c102
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts4
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts4
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus.dts2
-rw-r--r--spm/cactus/plat/arm/fvp/include/cactus_platform_def.h4
-rw-r--r--spm/cactus/plat/arm/tc0/include/cactus_platform_def.h4
7 files changed, 45 insertions, 78 deletions
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 5247fde..c21f44b 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -80,9 +80,6 @@ $(eval $(call add_define,CACTUS_DEFINES,DEBUG))
$(eval $(call add_define,CACTUS_DEFINES,ENABLE_ASSERTIONS))
$(eval $(call add_define,CACTUS_DEFINES,ENABLE_BTI))
$(eval $(call add_define,CACTUS_DEFINES,ENABLE_PAUTH))
-$(eval $(call add_define,CACTUS_DEFINES,FVP_CLUSTER_COUNT))
-$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_CPUS_PER_CLUSTER))
-$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU))
$(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL))
$(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT}))
$(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC))
diff --git a/spm/cactus/cactus_tests/cactus_test_ffa.c b/spm/cactus/cactus_tests/cactus_test_ffa.c
index 93f0403..ba069d0 100644
--- a/spm/cactus/cactus_tests/cactus_test_ffa.c
+++ b/spm/cactus/cactus_tests/cactus_test_ffa.c
@@ -22,10 +22,37 @@
static uint32_t spm_version;
-static const uint32_t primary_uuid[4] = PRIMARY_UUID;
-static const uint32_t secondary_uuid[4] = SECONDARY_UUID;
-static const uint32_t tertiary_uuid[4] = TERTIARY_UUID;
-static const uint32_t null_uuid[4] = {0};
+static const struct ffa_uuid sp_uuids[] = {
+ {PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID}
+ };
+static const struct ffa_uuid null_uuid = { .uuid = {0} };
+
+static const struct ffa_partition_info ffa_expected_partition_info[] = {
+ /* Primary partition info */
+ {
+ .id = SP_ID(1),
+ .exec_context = PRIMARY_EXEC_CTX_COUNT,
+ .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND)
+ },
+ /* Secondary partition info */
+ {
+ .id = SP_ID(2),
+ .exec_context = SECONDARY_EXEC_CTX_COUNT,
+ .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND)
+ },
+ /* Tertiary partition info */
+ {
+ .id = SP_ID(3),
+ .exec_context = TERTIARY_EXEC_CTX_COUNT,
+ .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND)
+ },
+ /* Ivy partition info */
+ {
+ .id = SP_ID(4),
+ .exec_context = IVY_EXEC_CTX_COUNT,
+ .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND)
+ }
+};
/*
* Test FFA_FEATURES interface.
@@ -64,29 +91,10 @@ static void ffa_features_test(void)
announce_test_section_end(test_features);
}
-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(ffa_func_id(ret), 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(ffa_func_id(ret), FFA_SUCCESS_SMC32);
-}
-
static void ffa_partition_info_wrong_test(void)
{
const char *test_wrong_uuid = "Request wrong UUID";
- uint32_t uuid[4] = {1};
+ const struct ffa_uuid uuid = { .uuid = {1} };
announce_test_start(test_wrong_uuid);
@@ -100,50 +108,20 @@ static void ffa_partition_info_wrong_test(void)
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_tertiary = "Get tertiary partition info";
- const char *test_all = "Get all partitions info";
-
- const struct ffa_partition_info expected_info[] = {
- /* Primary partition info */
- {
- .id = SPM_VM_ID_FIRST,
- .exec_context = CACTUS_PRIMARY_EC_COUNT,
- /* Supports receipt of direct message requests. */
- .properties = 1U
- },
- /* Secondary partition info */
- {
- .id = SPM_VM_ID_FIRST + 1U,
- .exec_context = CACTUS_SECONDARY_EC_COUNT,
- .properties = 1U
- },
- /* Tertiary partition info */
- {
- .id = SPM_VM_ID_FIRST + 2U,
- .exec_context = CACTUS_TERTIARY_EC_COUNT,
- .properties = 1U
- }
- };
announce_test_section_start(test_partition_info);
- announce_test_start(test_tertiary);
- ffa_partition_info_helper(mb, tertiary_uuid, &expected_info[2], 1);
- announce_test_end(test_tertiary);
+ expect(ffa_partition_info_helper(mb, sp_uuids[2],
+ &ffa_expected_partition_info[2], 1), true);
- announce_test_start(test_secondary);
- ffa_partition_info_helper(mb, secondary_uuid, &expected_info[1], 1);
- announce_test_end(test_secondary);
+ expect(ffa_partition_info_helper(mb, sp_uuids[1],
+ &ffa_expected_partition_info[1], 1), true);
- announce_test_start(test_primary);
- ffa_partition_info_helper(mb, primary_uuid, &expected_info[0], 1);
- announce_test_end(test_primary);
+ expect(ffa_partition_info_helper(mb, sp_uuids[0],
+ &ffa_expected_partition_info[0], 1), true);
- announce_test_start(test_all);
- ffa_partition_info_helper(mb, null_uuid, expected_info, 3);
- announce_test_end(test_all);
+ expect(ffa_partition_info_helper(mb, null_uuid,
+ ffa_expected_partition_info, 4), true);
ffa_partition_info_wrong_test();
diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts
index 661684b..2841b7c 100644
--- a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -27,7 +27,7 @@
entrypoint-offset = <0x00001000>;
xlat-granule = <0>; /* 4KiB */
boot-order = <0>;
- messaging-method = <0>; /* Direct messaging only */
+ messaging-method = <3>; /* Direct messaging only */
run-time-model = <0>; /* Run to completion */
/* Boot protocol */
diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts
index ea7d5d6..37b0576 100644
--- a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -27,7 +27,7 @@
entrypoint-offset = <0x00001000>;
xlat-granule = <0>; /* 4KiB */
boot-order = <0>;
- messaging-method = <0>; /* Direct messaging only */
+ messaging-method = <3>; /* Direct messaging only */
run-time-model = <0>; /* Run to completion */
/* Boot protocol */
diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus.dts b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
index 1c28fde..2db86c7 100644
--- a/spm/cactus/plat/arm/fvp/fdts/cactus.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
@@ -27,7 +27,7 @@
entrypoint-offset = <0x00001000>;
xlat-granule = <0>; /* 4KiB */
boot-order = <0>;
- messaging-method = <3>; /* Direct messaging with managed exit */
+ messaging-method = <11>; /* Direct messaging with managed exit */
run-time-model = <0>; /* Run to completion */
/* Boot protocol */
diff --git a/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h
index 8940c83..d35194d 100644
--- a/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h
+++ b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h
@@ -22,10 +22,6 @@
#define PLAT_CACTUS_MEMCPY_BASE ULL(0x7400000)
#define PLAT_CACTUS_MEMCPY_RANGE ULL(0x8000)
-#define CACTUS_PRIMARY_EC_COUNT (8U)
-#define CACTUS_SECONDARY_EC_COUNT (8U)
-#define CACTUS_TERTIARY_EC_COUNT (1U)
-
/* Base address of user and PRIV frames in SMMUv3TestEngine */
#define USR_BASE_FRAME ULL(0x2BFE0000)
#define PRIV_BASE_FRAME ULL(0x2BFF0000)
diff --git a/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h b/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h
index 585391d..62cb3ed 100644
--- a/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h
+++ b/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h
@@ -18,10 +18,6 @@
#define PLAT_CACTUS_RX_BASE ULL(0xfe300000)
#define PLAT_CACTUS_CORE_COUNT (8)
-#define CACTUS_PRIMARY_EC_COUNT (8U)
-#define CACTUS_SECONDARY_EC_COUNT (8U)
-#define CACTUS_TERTIARY_EC_COUNT (1U)
-
/* Scratch memory used for SMMUv3 driver testing purposes in Cactus SP */
/* SMMUv3 tests are disabled for TC platform */
#define PLAT_CACTUS_MEMCPY_BASE ULL(0xfe400000)