From 98967fb14a870e6b6fd7f87f8d13a93063c09e3c Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Fri, 13 Jul 2018 20:19:21 +0100 Subject: [PATCH] rpi3: Remove broken support of RESET_TO_BL31 There is no way to boot BL31 at the addresses specified in the platform memory map unless an extra loader is used at address 0x00000000. It is better to remove it to prevent confusion. Having it enabled was a bug. Change-Id: I3229fbc080f5996cff47efce8e799bae94e0d5cb Signed-off-by: Antonio Nino Diaz --- docs/plat/rpi3.rst | 8 -------- plat/rpi3/platform.mk | 8 ++++++-- plat/rpi3/rpi3_bl31_setup.c | 37 ------------------------------------- 3 files changed, 6 insertions(+), 47 deletions(-) diff --git a/docs/plat/rpi3.rst b/docs/plat/rpi3.rst index 0ba564d81..902da944b 100644 --- a/docs/plat/rpi3.rst +++ b/docs/plat/rpi3.rst @@ -216,12 +216,6 @@ The following build options are supported: be loaded anywhere by modifying the file ``config.txt``. It doesn't have to contain a kernel, it could have any arbitrary payload. -- ``RESET_TO_BL31``: Set to 1 by default. If using a 32-bit kernel like - `Raspbian`_, the space used by BL1 can overwritten by the kernel when it is - being loaded. Even when using a AArch64 kernel the region used by - BL1 isn't protected and the kernel could overwrite it. The space used by BL31 - is reserved by the command line passed to the kernel. - - ``RPI3_BL33_IN_AARCH32``: This port can load a AArch64 or AArch32 BL33 image. By default this option is 0, which means that TF-A will jump to BL33 in EL2 in AArch64 mode. If set to 1, it will jump to BL33 in Hypervisor in AArch32 @@ -257,8 +251,6 @@ The following is not currently supported: address by changing the file ``armstub8.bin``, so there's no point in using TF-A in this case. -- ``LOAD_IMAGE_V2=0``: Only version 2 is supported. - - ``MULTI_CONSOLE_API=0``: The multi console API must be enabled. Note that the crash console uses the internal 16550 driver functions directly in order to be able to print error messages during early crashes before setting up the diff --git a/plat/rpi3/platform.mk b/plat/rpi3/platform.mk index 5990f2753..3ad7114ce 100644 --- a/plat/rpi3/platform.mk +++ b/plat/rpi3/platform.mk @@ -90,8 +90,8 @@ WORKAROUND_CVE_2017_5715 := 0 # Disable the PSCI platform compatibility layer by default ENABLE_PLAT_COMPAT := 0 -# Enable reset to BL31 by default -RESET_TO_BL31 := 1 +# Reset to BL31 isn't supported +RESET_TO_BL31 := 0 # Have different sections for code and rodata SEPARATE_CODE_AND_RODATA := 1 @@ -138,6 +138,10 @@ ifneq (${MULTI_CONSOLE_API}, 1) $(error Error: rpi3 needs MULTI_CONSOLE_API=1) endif +ifneq (${RESET_TO_BL31}, 0) + $(error Error: rpi3 needs RESET_TO_BL31=0) +endif + ifeq (${ARCH},aarch32) $(error Error: AArch32 not supported on rpi3) endif diff --git a/plat/rpi3/rpi3_bl31_setup.c b/plat/rpi3/rpi3_bl31_setup.c index 58344ae99..4ea1bcf90 100644 --- a/plat/rpi3/rpi3_bl31_setup.c +++ b/plat/rpi3/rpi3_bl31_setup.c @@ -59,39 +59,6 @@ void bl31_early_platform_setup(void *from_bl2, /* Initialize the console to provide early debug support */ rpi3_console_init(); -#if RESET_TO_BL31 - - /* There are no parameters from BL2 if BL31 is a reset vector */ - assert(from_bl2 == NULL); - assert(plat_params_from_bl2 == NULL); - -#ifdef BL32_BASE - /* Populate entry point information for BL32 */ - SET_PARAM_HEAD(&bl32_image_ep_info, - PARAM_EP, - VERSION_1, - 0); - SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE); - bl32_image_ep_info.pc = BL32_BASE; - bl32_image_ep_info.spsr = rpi3_get_spsr_for_bl32_entry(); -#endif /* BL32_BASE */ - - /* Populate entry point information for BL33 */ - SET_PARAM_HEAD(&bl33_image_ep_info, - PARAM_EP, - VERSION_1, - 0); - /* - * Tell BL31 where the non-trusted software image - * is located and the entry state information - */ - bl33_image_ep_info.pc = plat_get_ns_image_entrypoint(); - - bl33_image_ep_info.spsr = rpi3_get_spsr_for_bl33_entry(); - SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); - -#else /* RESET_TO_BL31 */ - /* * In debug builds, we pass a special value in 'plat_params_from_bl2' * to verify platform parameters from BL2 to BL31. @@ -129,8 +96,6 @@ void bl31_early_platform_setup(void *from_bl2, if (bl33_image_ep_info.pc == 0) { panic(); } - -#endif /* RESET_TO_BL31 */ } void bl31_plat_arch_setup(void) @@ -148,12 +113,10 @@ void bl31_plat_arch_setup(void) void bl31_platform_setup(void) { -#if RESET_TO_BL31 /* * Do initial security configuration to allow DRAM/device access * (if earlier BL has not already done so). */ -#endif /* RESET_TO_BL31 */ return; }