From 6a0788bc0e704283e52c80990aa2bb6e047a0cc2 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Thu, 16 Dec 2021 18:31:02 +0000 Subject: [PATCH] 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 Change-Id: I92bc55ba6e04bdad429eb52f0d2960ceda682804 --- include/plat/common/platform.h | 4 ++++ plat/arm/board/fvp/fvp_el3_spmc.c | 28 ++++++++++++++++++++++++++++ plat/arm/board/fvp/platform.mk | 4 ++++ 3 files changed, 36 insertions(+) create mode 100644 plat/arm/board/fvp/fvp_el3_spmc.c 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 + +/* + * 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