From 672d669d6c72f92c6b81464d1d421e392bc1aa3e Mon Sep 17 00:00:00 2001 From: Zelalem Aweke Date: Mon, 26 Jul 2021 21:39:05 -0500 Subject: [PATCH] fix(plat/fvp): allow changing the kernel DTB load address We currently use ARM_PRELOADED_DTB_BASE build variable to pass the kernel DTB base address to the kernel when using the ARM_LINUX_KERNEL_AS_BL33 option. However this variable doesn't actually change the DTB load address. The DTB load address is actually specified in the FW_CONFIG DTS (fvp_fw_config.dts) as 'hw_config'. This patch passes the hw_config value instead of ARM_PRELOADED_DTB_BASE allowing us to change the kernel DTB load address through fvp_fw_config.dts. With this change we don't need the ARM_PRELOADED_DTB_BASE build variable if RESET_TO_BL31 is not set. Note that the hw_config value needs to be within the ARM_DTB_DRAM_NS region specified by FVP_DTB_DRAM_MAP_START and FVP_DTB_DRAM_MAP_SIZE. This patch also expands the ARM_DTB_DRAM_NS region to 32MB. Signed-off-by: Zelalem Aweke Change-Id: Idd74cdf5d2c649bb320644392ba5d69e175a53a9 --- plat/arm/board/fvp/include/platform_def.h | 2 +- plat/arm/common/arm_bl31_setup.c | 4 ++++ plat/arm/common/arm_common.mk | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h index 541842fde..90bb13568 100644 --- a/plat/arm/board/fvp/include/platform_def.h +++ b/plat/arm/board/fvp/include/platform_def.h @@ -68,7 +68,7 @@ /* Range of kernel DTB load address */ #define FVP_DTB_DRAM_MAP_START ULL(0x82000000) -#define FVP_DTB_DRAM_MAP_SIZE ULL(0x8000) +#define FVP_DTB_DRAM_MAP_SIZE ULL(0x02000000) /* 32 MB */ #define ARM_DTB_DRAM_NS MAP_REGION_FLAT( \ FVP_DTB_DRAM_MAP_START, \ diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c index d76031282..d131bb95b 100644 --- a/plat/arm/common/arm_bl31_setup.c +++ b/plat/arm/common/arm_bl31_setup.c @@ -218,7 +218,11 @@ void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_confi * tree blob (DTB) in x0, while x1-x3 are reserved for future use and * must be 0. */ +#if RESET_TO_BL31 bl33_image_ep_info.args.arg0 = (u_register_t)ARM_PRELOADED_DTB_BASE; +#else + bl33_image_ep_info.args.arg0 = (u_register_t)hw_config; +#endif bl33_image_ep_info.args.arg1 = 0U; bl33_image_ep_info.args.arg2 = 0U; bl33_image_ep_info.args.arg3 = 0U; diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index dc8c6d01e..ae9afb795 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -94,10 +94,13 @@ ifeq (${ARM_LINUX_KERNEL_AS_BL33},1) ifndef PRELOADED_BL33_BASE $(error "PRELOADED_BL33_BASE must be set if ARM_LINUX_KERNEL_AS_BL33 is used.") endif - ifndef ARM_PRELOADED_DTB_BASE - $(error "ARM_PRELOADED_DTB_BASE must be set if ARM_LINUX_KERNEL_AS_BL33 is used.") + ifeq (${RESET_TO_BL31},1) + ifndef ARM_PRELOADED_DTB_BASE + $(error "ARM_PRELOADED_DTB_BASE must be set if ARM_LINUX_KERNEL_AS_BL33 is + used with RESET_TO_BL31.") + endif + $(eval $(call add_define,ARM_PRELOADED_DTB_BASE)) endif - $(eval $(call add_define,ARM_PRELOADED_DTB_BASE)) endif # Arm Ethos-N NPU SiP service