diff --git a/Makefile b/Makefile index a11e55f9f..59d14ba02 100644 --- a/Makefile +++ b/Makefile @@ -529,6 +529,10 @@ ifneq (${SPD},none) ifneq ($(ARM_BL2_SP_LIST_DTS),) DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) endif + + ifneq ($(SP_LAYOUT_FILE),) + BL2_ENABLE_SP_LOAD := 1 + endif else # All other SPDs in spd directory SPD_DIR := spd @@ -902,6 +906,7 @@ endif $(eval $(call assert_booleans,\ $(sort \ ALLOW_RO_XLAT_TABLES \ + BL2_ENABLE_SP_LOAD \ COLD_BOOT_SINGLE_CPU \ CREATE_KEYS \ CTX_INCLUDE_AARCH32_REGS \ @@ -1003,6 +1008,7 @@ $(eval $(call add_defines,\ ALLOW_RO_XLAT_TABLES \ ARM_ARCH_MAJOR \ ARM_ARCH_MINOR \ + BL2_ENABLE_SP_LOAD \ COLD_BOOT_SINGLE_CPU \ CTX_INCLUDE_AARCH32_REGS \ CTX_INCLUDE_FPREGS \ @@ -1105,9 +1111,6 @@ endif # Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined ifeq (${SPD},spmd) ifdef SP_LAYOUT_FILE - ifeq (${SPMD_SPM_AT_SEL2},0) - $(error "SPMD with SPM at S-EL1 does not require SP_LAYOUT_FILE") - endif -include $(BUILD_PLAT)/sp_gen.mk FIP_DEPS += sp CRT_DEPS += sp diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst index 0ec10f5db..7fe6ccd8a 100644 --- a/docs/getting_started/build-options.rst +++ b/docs/getting_started/build-options.rst @@ -55,6 +55,9 @@ Common build options - ``BL2_AT_EL3``: This is an optional build option that enables the use of BL2 at EL3 execution level. +- ``BL2_ENABLE_SP_LOAD``: Boolean option to enable loading SP packages from the + FIP. Automatically enabled if ``SP_LAYOUT_FILE`` is provided. + - ``BL2_IN_XIP_MEM``: In some use-cases BL2 will be stored in eXecute In Place (XIP) memory, like BL1. In these use-cases, it is necessary to initialize the RW sections in RAM, while leaving the RO sections in place. This option diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk index 18092e7fa..8b350db7b 100644 --- a/make_helpers/defaults.mk +++ b/make_helpers/defaults.mk @@ -32,6 +32,9 @@ BASE_COMMIT := origin/master # Execute BL2 at EL3 BL2_AT_EL3 := 0 +# Only use SP packages if SP layout JSON is defined +BL2_ENABLE_SP_LOAD := 0 + # BL2 image is stored in XIP memory, for now, this option is only supported # when BL2_AT_EL3 is 1. BL2_IN_XIP_MEM := 0 diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c index 26af38344..5b26a1d3b 100644 --- a/plat/arm/common/arm_bl2_setup.c +++ b/plat/arm/common/arm_bl2_setup.c @@ -233,7 +233,7 @@ int arm_bl2_handle_post_image_load(unsigned int image_id) ******************************************************************************/ int arm_bl2_plat_handle_post_image_load(unsigned int image_id) { -#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2 +#if defined(SPD_spmd) && BL2_ENABLE_SP_LOAD /* For Secure Partitions we don't need post processing */ if ((image_id >= (MAX_NUMBER_IDS - MAX_SP_IDS)) && (image_id < MAX_NUMBER_IDS)) { diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 4d5e8b4b1..58060dbcf 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -217,7 +217,7 @@ endif ARM_IO_SOURCES += plat/arm/common/arm_io_storage.c \ plat/arm/common/fconf/arm_fconf_io.c ifeq (${SPD},spmd) - ifeq (${SPMD_SPM_AT_SEL2},1) + ifeq (${BL2_ENABLE_SP_LOAD},1) ARM_IO_SOURCES += plat/arm/common/fconf/arm_fconf_sp.c endif endif diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c index ebf6dfff8..c411c6cbb 100644 --- a/plat/arm/common/arm_image_load.c +++ b/plat/arm/common/arm_image_load.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -32,7 +32,7 @@ void plat_flush_next_bl_params(void) next_bl_params_cpy_ptr); } -#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2 +#if defined(SPD_spmd) && BL2_ENABLE_SP_LOAD /******************************************************************************* * This function appends Secure Partitions to list of loadable images. ******************************************************************************/ @@ -76,7 +76,7 @@ static void plat_add_sp_images_load_info(struct bl_load_info *load_info) ******************************************************************************/ struct bl_load_info *plat_get_bl_image_load_info(void) { -#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2 +#if defined(SPD_spmd) && BL2_ENABLE_SP_LOAD bl_load_info_t *bl_load_info; bl_load_info = get_bl_load_info_from_mem_params_desc();