From cf952b0fb54e91e3668e2fdd68cfb8ecfa8ee703 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Tue, 2 Feb 2021 16:00:27 +0900 Subject: [PATCH] qemu/qemu_sbsa: spm_mm supports 512 cores sbsa-ref in QEMU may create up to 512 cores. This commit prepares the MP information to support 512 cores. The number of xlat tables for spm_mm is also increased. Signed-off-by: Masahisa Kojima Change-Id: I2788eaf6d14e188e9b5d1102d359b2899e02df7c --- plat/qemu/common/qemu_spm.c | 37 ++++++++++++++-------- plat/qemu/qemu_sbsa/include/platform_def.h | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/plat/qemu/common/qemu_spm.c b/plat/qemu/common/qemu_spm.c index 93dd2b37d..c66f47ebc 100644 --- a/plat/qemu/common/qemu_spm.c +++ b/plat/qemu/common/qemu_spm.c @@ -29,20 +29,8 @@ mmap_region_t plat_qemu_secure_partition_mmap[] = { {0} }; -/* - * Boot information passed to a secure partition during initialisation. - * Linear indices in MP information will be filled at runtime. - */ -static spm_mm_mp_info_t sp_mp_info[] = { - [0] = {0x80000000, 0}, - [1] = {0x80000001, 0}, - [2] = {0x80000002, 0}, - [3] = {0x80000003, 0}, - [4] = {0x80000004, 0}, - [5] = {0x80000005, 0}, - [6] = {0x80000006, 0}, - [7] = {0x80000007, 0} -}; +/* Boot information passed to a secure partition during initialisation. */ +static spm_mm_mp_info_t sp_mp_info[PLATFORM_CORE_COUNT]; spm_mm_boot_info_t plat_qemu_secure_partition_boot_info = { .h.type = PARAM_SP_IMAGE_BOOT_INFO, @@ -71,6 +59,25 @@ ehf_pri_desc_t qemu_exceptions[] = { EHF_PRI_DESC(QEMU_PRI_BITS, PLAT_SP_PRI) }; +static void qemu_initialize_mp_info(spm_mm_mp_info_t *mp_info) +{ + unsigned int i, j; + spm_mm_mp_info_t *tmp = mp_info; + + for (i = 0; i < PLATFORM_CLUSTER_COUNT; i++) { + for (j = 0; j < PLATFORM_MAX_CPUS_PER_CLUSTER; j++) { + tmp->mpidr = (0x80000000 | (i << MPIDR_AFF1_SHIFT)) + j; + /* + * Linear indices and flags will be filled + * in the spm_mm service. + */ + tmp->linear_id = 0; + tmp->flags = 0; + tmp++; + } + } +} + int dt_add_ns_buf_node(uintptr_t *base) { uintptr_t addr; @@ -134,5 +141,7 @@ const mmap_region_t *plat_get_secure_partition_mmap(void *cookie) const spm_mm_boot_info_t * plat_get_secure_partition_boot_info(void *cookie) { + qemu_initialize_mp_info(sp_mp_info); + return &plat_qemu_secure_partition_boot_info; } diff --git a/plat/qemu/qemu_sbsa/include/platform_def.h b/plat/qemu/qemu_sbsa/include/platform_def.h index b69c2ebef..e8bf4d9b4 100644 --- a/plat/qemu/qemu_sbsa/include/platform_def.h +++ b/plat/qemu/qemu_sbsa/include/platform_def.h @@ -171,7 +171,7 @@ #if SPM_MM && defined(IMAGE_BL31) # define PLAT_SP_IMAGE_MMAP_REGIONS 30 -# define PLAT_SP_IMAGE_MAX_XLAT_TABLES 20 +# define PLAT_SP_IMAGE_MAX_XLAT_TABLES 50 #endif /*