diff --git a/core/arch/arm/plat-mediatek/conf.mk b/core/arch/arm/plat-mediatek/conf.mk index 72555a1c046..bd83bdc9be7 100644 --- a/core/arch/arm/plat-mediatek/conf.mk +++ b/core/arch/arm/plat-mediatek/conf.mk @@ -14,6 +14,10 @@ CFG_DRAM_BASE ?= 0x40000000 # default DRAM size 1 GiB CFG_DRAM_SIZE ?= 0x40000000 +# When need to create a virtual memory pool for mapping other +# physical address, enable the config to increase MAX_XLAT_TABLES. +CFG_MTK_RESERVED_VA ?= n + ifeq ($(PLATFORM_FLAVOR),mt8173) # 2**1 = 2 cores per cluster $(call force,CFG_TEE_CORE_NB_CORE,4) diff --git a/core/arch/arm/plat-mediatek/platform_config.h b/core/arch/arm/plat-mediatek/platform_config.h index ced421f64f2..c85b0d0b722 100644 --- a/core/arch/arm/plat-mediatek/platform_config.h +++ b/core/arch/arm/plat-mediatek/platform_config.h @@ -123,8 +123,9 @@ #error "Unknown platform flavor" #endif -#ifdef CFG_WITH_LPAE -#define MAX_XLAT_TABLES 5 +#ifdef CFG_MTK_RESERVED_VA +#define MAX_XLAT_TABLES (30 + (CFG_RESERVED_VASPACE_SIZE) / \ + (CORE_MMU_PGDIR_SIZE) + 1) #endif #endif /*PLATFORM_CONFIG_H*/