summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2021-12-16 18:31:02 +0000
committerMarc Bonnici <marc.bonnici@arm.com>2022-05-19 10:57:37 +0100
commit6a0788bc0e704283e52c80990aa2bb6e047a0cc2 (patch)
tree41317e73225065c15c06833dd887e885cb01dbb5
parente0b1a6d59e57c0dbe87f5b8f8166f1123664f058 (diff)
downloadarm-trusted-firmware-6a0788bc0e704283e52c80990aa2bb6e047a0cc2.tar.gz
feat(plat/fvp): introduce accessor function to obtain datastore
In order to provide the EL3 SPMC a sufficient datastore to record memory descriptors, a accessor function is used. This allows for the backing memory to be allocated in a platform defined manner, to accommodate memory constraints and desired use cases. Provide an implementation for the Arm FVP platform to use a default value of 512KB memory allocated in the TZC RAM section. Signed-off-by: Marc Bonnici <marc.bonnici@arm.com> Change-Id: I92bc55ba6e04bdad429eb52f0d2960ceda682804
-rw-r--r--include/plat/common/platform.h4
-rw-r--r--plat/arm/board/fvp/fvp_el3_spmc.c28
-rw-r--r--plat/arm/board/fvp/platform.mk4
3 files changed, 36 insertions, 0 deletions
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index 766450901..b62a63158 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -347,6 +347,10 @@ int plat_spm_sp_get_next_address(void **sp_base, size_t *sp_size,
int plat_spm_core_manifest_load(spmc_manifest_attribute_t *manifest,
const void *pm_addr);
#endif
+#if defined(SPMC_AT_EL3)
+int plat_spmc_shmem_datastore_get(uint8_t **datastore, size_t *size);
+#endif
+
/*******************************************************************************
* Mandatory BL image load functions(may be overridden).
******************************************************************************/
diff --git a/plat/arm/board/fvp/fvp_el3_spmc.c b/plat/arm/board/fvp/fvp_el3_spmc.c
new file mode 100644
index 000000000..da090c0dc
--- /dev/null
+++ b/plat/arm/board/fvp/fvp_el3_spmc.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+/*
+ * On the FVP platform when using the EL3 SPMC implementation allocate the
+ * datastore for tracking shared memory descriptors in the TZC DRAM section
+ * to ensure sufficient storage can be allocated.
+ * Provide an implementation of the accessor method to allow the datastore
+ * details to be retrieved by the SPMC.
+ * The SPMC will take care of initializing the memory region.
+ */
+
+#define PLAT_SPMC_SHMEM_DATASTORE_SIZE 512 * 1024
+
+__section("arm_el3_tzc_dram") static uint8_t
+plat_spmc_shmem_datastore[PLAT_SPMC_SHMEM_DATASTORE_SIZE];
+
+int plat_spmc_shmem_datastore_get(uint8_t **datastore, size_t *size)
+{
+ *datastore = plat_spmc_shmem_datastore;
+ *size = PLAT_SPMC_SHMEM_DATASTORE_SIZE;
+ return 0;
+}
diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk
index 89ca18540..54c5e7545 100644
--- a/plat/arm/board/fvp/platform.mk
+++ b/plat/arm/board/fvp/platform.mk
@@ -425,3 +425,7 @@ ENABLE_SYS_REG_TRACE_FOR_NS := 1
# enable trace filter control registers access to NS by default
ENABLE_TRF_FOR_NS := 1
+
+ifeq (${SPMC_AT_EL3}, 1)
+PLAT_BL_COMMON_SOURCES += plat/arm/board/fvp/fvp_el3_spmc.c
+endif