feat(spm): add STMM cactus partition
Add another instance of cactus S-EL1 partition, using
StMM manifest.
This is to validate HOB generation at build-time.
The manifest contains memory region nodes using the
same node names as in the StMM partition manifest,
but changed the ranges to align with memory map of
base FVP. The device region nodes have been dropped,
as they didn't affect the creation of the HOB list.
Defined the UUID for the partition in the test code,
and refactored slightly some of the code paths,
so it has an RXTX buffer and is able to do the basic
FF-A setup tests.
Also added the cactus-stmm node to the sp_layout
file.
Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Change-Id: I05971fc9d63f03bd7ea43b3bcaba5b6362a44ca0
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index c15ee4e..48af7ca 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -308,7 +308,12 @@
cactus_print_boot_info(boot_info_header);
}
- if (ffa_id == (SPM_VM_ID_FIRST + 2)) {
+ /*
+ * Cactus-tertiary and cactus-stmm make use of FFA_RXTX_MAP API
+ * instead of specifying `rx_tx-info` in their manifests, as done by the
+ * primary and secondary cactus partitions.
+ */
+ if (ffa_id == SP_ID(3) || ffa_id == SP_ID(5)) {
VERBOSE("Mapping RXTX Region\n");
CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret);
if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) {
@@ -323,7 +328,7 @@
ret = register_secondary_entrypoint();
/* FFA_SECONDARY_EP_REGISTER interface is not supported for UP SP. */
- if (ffa_id == (SPM_VM_ID_FIRST + 2)) {
+ if (ffa_id == SP_ID(3) || ffa_id == SP_ID(5)) {
EXPECT(ffa_func_id(ret), FFA_ERROR);
EXPECT(ffa_error_code(ret), FFA_ERROR_NOT_SUPPORTED);
} else {
diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-stmm.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-stmm.dts
new file mode 100644
index 0000000..e8e9f0c
--- /dev/null
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus-stmm.dts
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+
+ /*
+ * FF-A compatible Secure Partition Manager parses the
+ * config file and fetch the following booting arguments to
+ * pass on to the StandAloneMM(StMM) Secure Partition.
+ */
+ compatible = "arm,ffa-manifest-1.0";
+
+ description = "FVP Base StandaloneMm";
+ ffa-version = <0x00010002>; /* 31:16 - Major, 15:0 - Minor */
+ uuid = <0xdcae8d37 0x46446bf0 0xab401483 0xa3873c93>;
+ id = <0x8001>;
+ execution-ctx-count = <1>;
+ exception-level = <0x2>; /* SEL1*/
+ execution-state = <0>; /* AArch64*/
+ load-address = <0x0 0x7700000>;
+ entrypoint-offset = <0x00003000>; /*Image after manifest and HOB list. */
+ image-size = <0x0 0x00300000>;
+ xlat-granule = <0>; /* 4KiB */
+ boot_info_reg = <0>; /* x0 */
+ boot-order = <5>;
+ messaging-method = <0x3>;
+ power-management-messages = <0>;
+ gp-register-num = <0>;
+
+ /* Boot Info */
+ boot-info {
+ compatible = "arm,ffa-manifest-boot-info";
+ hob_list;
+ };
+
+ /*
+ * Device regions of StMM manifest not included, given they
+ * are not used in the hob.
+ */
+ memory-regions {
+ compatible = "arm,ffa-manifest-memory-regions";
+ /*
+ * SPM Payload memory. Mapped as code region for S-EL0
+ * Similar to ARM_SP_IMAGE_MMAP.
+ */
+ stmm_region {
+ description = "image";
+ base-address = <0x0 0xfd200000>;
+ pages-count = <0x300>;
+ /* StMM will remap the regions during runtime */
+ attributes = <0x5>;
+ };
+
+ /*
+ * Memory shared between EL3 and S-EL0.
+ * Similar to ARM_SPM_BUF_EL0_MMAP.
+ */
+ rx-tx-buffers {
+ description = "shared-buff";
+ base-address = <0x0 0xfd500000>;
+ pages-count = <0x100>;
+ attributes = <0x3>;
+ };
+
+ /*
+ * Memory shared between Normal world and S-EL0.
+ * Similar to ARM_SP_IMAGE_NS_BUF_MMAP.
+ */
+ ns_comm_buffer {
+ /*
+ * Description is needed for StMM to identify
+ * ns-communication buffer.
+ */
+ description = "ns-comm";
+ base-address = <0x80000000>;
+ pages-count = <0x1>;
+ attributes = <0xB>;
+ };
+
+ /*
+ * Heap used by SP to allocate memory for DMA.
+ */
+ heap {
+ /*
+ * Description is needed for StMM to identify
+ * heap buffer.
+ */
+ description = "heap";
+ base-address = <0x0 0xff100000>;
+ pages-count = <0x7>;
+ attributes = <0x3>;
+ };
+ };
+};
+
diff --git a/spm/cactus/plat/arm/fvp/platform.mk b/spm/cactus/plat/arm/fvp/platform.mk
index c7b01bb..0125d00 100644
--- a/spm/cactus/plat/arm/fvp/platform.mk
+++ b/spm/cactus/plat/arm/fvp/platform.mk
@@ -15,3 +15,4 @@
FDTS_CP_LIST = ${FVP_CACTUS_BASE}/fdts/cactus.dts
FDTS_CP_LIST += ${FVP_CACTUS_BASE}/fdts/cactus-secondary.dts
FDTS_CP_LIST += ${FVP_CACTUS_BASE}/fdts/cactus-tertiary.dts
+FDTS_CP_LIST += ${FVP_CACTUS_BASE}/fdts/cactus-stmm.dts
diff --git a/spm/common/sp_tests/sp_test_ffa.c b/spm/common/sp_tests/sp_test_ffa.c
index e7dd720..a63fa5e 100644
--- a/spm/common/sp_tests/sp_test_ffa.c
+++ b/spm/common/sp_tests/sp_test_ffa.c
@@ -22,8 +22,9 @@
static uint32_t spm_version;
static const struct ffa_uuid sp_uuids[] = {
- {PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID}, {IVY_UUID}, {EL3_SPMD_LP_UUID}
- };
+ {PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID}, {IVY_UUID},
+ {STMM_UUID}, {EL3_SPMD_LP_UUID}
+};
static const struct ffa_partition_info ffa_expected_partition_info[] = {
/* Primary partition info */
@@ -66,6 +67,14 @@
FFA_PARTITION_DIRECT_REQ_SEND),
.uuid = {IVY_UUID}
},
+ {
+ .id = SP_ID(5),
+ .exec_context = 1,
+ .properties = (FFA_PARTITION_AARCH64_EXEC |
+ FFA_PARTITION_DIRECT_REQ_RECV |
+ FFA_PARTITION_DIRECT_REQ_SEND),
+ .uuid = {STMM_UUID}
+ },
/* EL3 SPMD logical partition */
{
.id = SP_ID(0x7FC0),
@@ -160,7 +169,7 @@
* we assume they dont exist and skip further tests to avoid
* failures on platforms without el3 spmd logical partitions.
*/
- ret = ffa_partition_info_get_regs(sp_uuids[4], 0, 0);
+ ret = ffa_partition_info_get_regs(sp_uuids[5], 0, 0);
if ((ffa_func_id(ret) == FFA_ERROR) &&
((ffa_error_code(ret) == FFA_ERROR_NOT_SUPPORTED) ||
(ffa_error_code(ret) == FFA_ERROR_INVALID_PARAMETER))) {