From 302f05354f5aab340c315e0d04915367c65c6b27 Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Mon, 17 Jan 2022 09:48:28 +0100 Subject: [PATCH] feat(qemu): support el3 spmc Introduce additional defines needed when compiling the QEMU platform with SPMC at EL3. Signed-off-by: Jens Wiklander Change-Id: If6dbe41fa8761637e39579a1f6818dabc769c139 --- plat/qemu/common/qemu_common.c | 30 ++++++++++++++++++++++++- plat/qemu/qemu/include/platform_def.h | 32 +++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/plat/qemu/common/qemu_common.c b/plat/qemu/common/qemu_common.c index 0c184f49b..23ac5813e 100644 --- a/plat/qemu/common/qemu_common.c +++ b/plat/qemu/common/qemu_common.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "qemu_private.h" @@ -100,7 +101,7 @@ static const mmap_region_t plat_qemu_mmap[] = { #if SPM_MM MAP_NS_DRAM0, QEMU_SPM_BUF_EL3_MMAP, -#else +#elif !SPMC_AT_EL3 MAP_BL32_MEM, #endif {0} @@ -167,3 +168,30 @@ int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size) return get_mbedtls_heap_helper(heap_addr, heap_size); } #endif + +#if SPMC_AT_EL3 +/* + * When using the EL3 SPMC implementation allocate the datastore + * for tracking shared memory descriptors in normal memory. + */ +#define PLAT_SPMC_SHMEM_DATASTORE_SIZE 64 * 1024 + +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; +} + +int plat_spmc_shmem_begin(struct ffa_mtd *desc) +{ + return 0; +} + +int plat_spmc_shmem_reclaim(struct ffa_mtd *desc) +{ + return 0; +} +#endif diff --git a/plat/qemu/qemu/include/platform_def.h b/plat/qemu/qemu/include/platform_def.h index 490c2dc7c..18c57469f 100644 --- a/plat/qemu/qemu/include/platform_def.h +++ b/plat/qemu/qemu/include/platform_def.h @@ -188,8 +188,8 @@ #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) -#define MAX_MMAP_REGIONS 11 -#define MAX_XLAT_TABLES 6 +#define MAX_MMAP_REGIONS (11 + MAX_MMAP_REGIONS_SPMC) +#define MAX_XLAT_TABLES (6 + MAX_XLAT_TABLES_SPMC) #define MAX_IO_DEVICES 4 #define MAX_IO_HANDLES 4 @@ -280,4 +280,32 @@ */ #define PLAT_EVENT_LOG_MAX_SIZE UL(0x400) +#if SPMC_AT_EL3 +/* + * Number of Secure Partitions supported. + * SPMC at EL3, uses this count to configure the maximum number of + * supported secure partitions. + */ +#define SECURE_PARTITION_COUNT 1 + +/* + * Number of Logical Partitions supported. + * SPMC at EL3, uses this count to configure the maximum number of + * supported logical partitions. + */ +#define MAX_EL3_LP_DESCS_COUNT 0 + +/* + * Number of Normal World Partitions supported. + * SPMC at EL3, uses this count to configure the maximum number of + * supported normal world partitions. + */ +#define NS_PARTITION_COUNT 1 + +#define MAX_MMAP_REGIONS_SPMC 2 +#define MAX_XLAT_TABLES_SPMC 4 +#else +#define MAX_MMAP_REGIONS_SPMC 0 +#define MAX_XLAT_TABLES_SPMC 0 +#endif #endif /* PLATFORM_DEF_H */ -- 2.39.5