Merge "feat(cm): test integrity of el1_ctx registers" into integration
diff --git a/Makefile b/Makefile
index 465e115..b0363cb 100644
--- a/Makefile
+++ b/Makefile
@@ -256,10 +256,12 @@
-Wlogical-op
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
-TF_CFLAGS += $(call cc_option, --param=min-pagesize=0)
+TF_CFLAGS_MIN_PAGE_SIZE := $(call cc_option, --param=min-pagesize=0)
+TF_CFLAGS += $(TF_CFLAGS_MIN_PAGE_SIZE)
ifeq ($(HARDEN_SLS), 1)
- TF_CFLAGS_aarch64 += $(call cc_option, -mharden-sls=all)
+ TF_CFLAGS_MHARDEN_SLS := $(call cc_option, -mharden-sls=all)
+ TF_CFLAGS_aarch64 += $(TF_CFLAGS_MHARDEN_SLS)
endif
else
diff --git a/make_helpers/arch_features.mk b/make_helpers/arch_features.mk
index d378a55..57609d5 100644
--- a/make_helpers/arch_features.mk
+++ b/make_helpers/arch_features.mk
@@ -84,7 +84,7 @@
# Enable the features which are mandatory from ARCH version 8.8 and upwards.
ifeq "8.8" "$(word 1, $(sort 8.8 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
# 8.7 Compliant
-armv8-7-a-feats += ${armv8-7-a-feats}
+armv8-8-a-feats += ${armv8-7-a-feats}
FEAT_LIST := ${armv8-8-a-feats}
endif
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index f523074..d454efd 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -96,6 +96,10 @@
# Convenience function to check for a given compiler option. A call to
# $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler
+# NOTE: consider assigning to an immediately expanded temporary variable before
+# assigning. This is because variables like TF_CFLAGS are recursively expanded
+# and assigning this directly will cause it to be expanded every time the
+# variable is used, potentially thrashing multicore performance.
define cc_option
$(shell if $($(ARCH)-cc) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi )
endef
@@ -183,7 +187,7 @@
define TOOL_ADD_IMG_PAYLOAD
-$(eval PRE_TOOL_FILTER := $($(call uppercase,$(1))_PRE_TOOL_FILTER))
+$(eval PRE_TOOL_FILTER := $($(1)_PRE_TOOL_FILTER))
ifneq ($(PRE_TOOL_FILTER),)
@@ -220,7 +224,8 @@
define TOOL_ADD_IMG
# Build option to specify the image filename (SCP_BL2, BL33, etc)
# This is the uppercase form of the first parameter
- $(eval _V := $(call uppercase,$(1)))
+ $(eval BL := $(call uppercase,$(1)))
+ $(eval _V := $(BL))
# $(check_$(1)_cmd) variable is executed in the check_$(1) target and also
# is put into the ${CHECK_$(3)FIP_CMD} variable which is executed by the
@@ -235,10 +240,10 @@
ifeq ($(4),1)
$(eval ENC_BIN := ${BUILD_PLAT}/$(1)_enc.bin)
$(call ENCRYPT_FW,$(value $(_V)),$(ENC_BIN))
- $(call TOOL_ADD_IMG_PAYLOAD,$(1),$(value $(_V)),$(2),$(ENC_BIN),$(3), \
+ $(call TOOL_ADD_IMG_PAYLOAD,$(BL),$(value $(_V)),$(2),$(ENC_BIN),$(3), \
$(ENC_BIN))
else
- $(call TOOL_ADD_IMG_PAYLOAD,$(1),$(value $(_V)),$(2),$(if $(wildcard $(value $(_V))),$(value $(_V)),FORCE),$(3))
+ $(call TOOL_ADD_IMG_PAYLOAD,$(BL),$(value $(_V)),$(2),$(if $(wildcard $(value $(_V))),$(value $(_V)),FORCE),$(3))
endif
.PHONY: check_$(1)
@@ -284,10 +289,11 @@
# $(1) = output directory
# $(2) = source file (%.c)
# $(3) = library name
+# $(4) = uppercase name of the library
define MAKE_C_LIB
$(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2))))
$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
-$(eval LIB := $(call uppercase, $(notdir $(1))))
+$(eval LIB := $(notdir $(1)))
$(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/
$$(s)echo " CC $$<"
@@ -301,6 +307,7 @@
# $(1) = output directory
# $(2) = source file (%.S)
# $(3) = library name
+# $(4) = uppercase name of the library
define MAKE_S_LIB
$(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2))))
$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
@@ -318,15 +325,16 @@
# $(1) = output directory
# $(2) = source file (%.c)
# $(3) = BL stage
+# $(4) = uppercase BL stage
define MAKE_C
$(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2))))
$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
-$(eval BL_DEFINES := IMAGE_$(call uppercase,$(3)) $($(call uppercase,$(3))_DEFINES) $(PLAT_BL_COMMON_DEFINES))
-$(eval BL_INCLUDE_DIRS := $($(call uppercase,$(3))_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
-$(eval BL_CPPFLAGS := $($(call uppercase,$(3))_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
-$(eval BL_CFLAGS := $($(call uppercase,$(3))_CFLAGS) $(PLAT_BL_COMMON_CFLAGS))
+$(eval BL_DEFINES := IMAGE_$(4) $($(4)_DEFINES) $(PLAT_BL_COMMON_DEFINES))
+$(eval BL_INCLUDE_DIRS := $($(4)_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
+$(eval BL_CPPFLAGS := $($(4)_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
+$(eval BL_CFLAGS := $($(4)_CFLAGS) $(PLAT_BL_COMMON_CFLAGS))
$(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/
$$(s)echo " CC $$<"
@@ -341,15 +349,16 @@
# $(1) = output directory
# $(2) = assembly file (%.S)
# $(3) = BL stage
+# $(4) = uppercase BL stage
define MAKE_S
$(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2))))
$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
-$(eval BL_DEFINES := IMAGE_$(call uppercase,$(3)) $($(call uppercase,$(3))_DEFINES) $(PLAT_BL_COMMON_DEFINES))
-$(eval BL_INCLUDE_DIRS := $($(call uppercase,$(3))_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
-$(eval BL_CPPFLAGS := $($(call uppercase,$(3))_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
-$(eval BL_ASFLAGS := $($(call uppercase,$(3))_ASFLAGS) $(PLAT_BL_COMMON_ASFLAGS))
+$(eval BL_DEFINES := IMAGE_$(4) $($(4)_DEFINES) $(PLAT_BL_COMMON_DEFINES))
+$(eval BL_INCLUDE_DIRS := $($(4)_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
+$(eval BL_CPPFLAGS := $($(4)_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
+$(eval BL_ASFLAGS := $($(4)_ASFLAGS) $(PLAT_BL_COMMON_ASFLAGS))
$(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/
$$(s)echo " AS $$<"
@@ -364,13 +373,14 @@
# $(1) = output linker script
# $(2) = input template
# $(3) = BL stage
+# $(4) = uppercase BL stage
define MAKE_LD
$(eval DEP := $(1).d)
-$(eval BL_DEFINES := IMAGE_$(call uppercase,$(3)) $($(call uppercase,$(3))_DEFINES) $(PLAT_BL_COMMON_DEFINES))
-$(eval BL_INCLUDE_DIRS := $($(call uppercase,$(3))_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
-$(eval BL_CPPFLAGS := $($(call uppercase,$(3))_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
+$(eval BL_DEFINES := IMAGE_$(4) $($(4)_DEFINES) $(PLAT_BL_COMMON_DEFINES))
+$(eval BL_INCLUDE_DIRS := $($(4)_INCLUDE_DIRS) $(PLAT_BL_COMMON_INCLUDE_DIRS))
+$(eval BL_CPPFLAGS := $($(4)_CPPFLAGS) $(addprefix -D,$(BL_DEFINES)) $(addprefix -I,$(BL_INCLUDE_DIRS)) $(PLAT_BL_COMMON_CPPFLAGS))
$(1): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/
$$(s)echo " PP $$<"
@@ -384,14 +394,15 @@
# $(1) = output directory
# $(2) = list of source files
# $(3) = name of the library
+# $(4) = uppercase name of the library
define MAKE_LIB_OBJS
$(eval C_OBJS := $(filter %.c,$(2)))
$(eval REMAIN := $(filter-out %.c,$(2)))
- $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C_LIB,$(1),$(obj),$(3))))
+ $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C_LIB,$(1),$(obj),$(3),$(4))))
$(eval S_OBJS := $(filter %.S,$(REMAIN)))
$(eval REMAIN := $(filter-out %.S,$(REMAIN)))
- $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S_LIB,$(1),$(obj),$(3))))
+ $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S_LIB,$(1),$(obj),$(3),$(4))))
$(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
endef
@@ -401,14 +412,15 @@
# $(1) = output directory
# $(2) = list of source files (both C and assembly)
# $(3) = BL stage
+# $(4) = uppercase BL stage
define MAKE_OBJS
$(eval C_OBJS := $(filter %.c,$(2)))
$(eval REMAIN := $(filter-out %.c,$(2)))
- $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C,$(1),$(obj),$(3))))
+ $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C,$(1),$(obj),$(3),$(4))))
$(eval S_OBJS := $(filter %.S,$(REMAIN)))
$(eval REMAIN := $(filter-out %.S,$(REMAIN)))
- $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S,$(1),$(obj),$(3))))
+ $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S,$(1),$(obj),$(3),$(4))))
$(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
endef
@@ -428,13 +440,14 @@
# Arguments:
# $(1) = Library name
define MAKE_LIB
+ $(eval BL := $(call uppercase,$(1)))
$(eval BUILD_DIR := ${BUILD_PLAT}/lib$(1))
$(eval LIB_DIR := ${BUILD_PLAT}/lib)
$(eval ROMLIB_DIR := ${BUILD_PLAT}/romlib)
- $(eval SOURCES := $(LIB$(call uppercase,$(1))_SRCS))
+ $(eval SOURCES := $(LIB$(BL)_SRCS))
$(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))))
-$(eval $(call MAKE_LIB_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
+$(eval $(call MAKE_LIB_OBJS,$(BUILD_DIR),$(SOURCES),$(1),$(BL)))
libraries: ${LIB_DIR}/lib$(1).a
ifeq ($($(ARCH)-ld-id),arm-link)
@@ -476,8 +489,9 @@
# $(3) = FIP prefix (optional) (if FWU_, target is fwu_fip instead of fip)
# $(4) = BL encryption flag (optional) (0, 1)
define MAKE_BL
+ $(eval BL := $(call uppercase,$(1)))
$(eval BUILD_DIR := ${BUILD_PLAT}/$(1))
- $(eval BL_SOURCES := $($(call uppercase,$(1))_SOURCES))
+ $(eval BL_SOURCES := $($(BL)_SOURCES))
$(eval SOURCES := $(sort $(BL_SOURCES) $(BL_COMMON_SOURCES) $(PLAT_BL_COMMON_SOURCES)))
$(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))))
$(eval MAPFILE := $(call IMG_MAPFILE,$(1)))
@@ -485,21 +499,21 @@
$(eval DUMP := $(call IMG_DUMP,$(1)))
$(eval BIN := $(call IMG_BIN,$(1)))
$(eval ENC_BIN := $(call IMG_ENC_BIN,$(1)))
- $(eval BL_LIBS := $($(call uppercase,$(1))_LIBS))
+ $(eval BL_LIBS := $($(BL)_LIBS))
- $(eval DEFAULT_LINKER_SCRIPT_SOURCE := $($(call uppercase,$(1))_DEFAULT_LINKER_SCRIPT_SOURCE))
+ $(eval DEFAULT_LINKER_SCRIPT_SOURCE := $($(BL)_DEFAULT_LINKER_SCRIPT_SOURCE))
$(eval DEFAULT_LINKER_SCRIPT := $(call linker_script_path,$(DEFAULT_LINKER_SCRIPT_SOURCE)))
- $(eval LINKER_SCRIPT_SOURCES := $($(call uppercase,$(1))_LINKER_SCRIPT_SOURCES))
+ $(eval LINKER_SCRIPT_SOURCES := $($(BL)_LINKER_SCRIPT_SOURCES))
$(eval LINKER_SCRIPTS := $(call linker_script_path,$(LINKER_SCRIPT_SOURCES)))
-$(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
+$(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1),$(BL)))
# Generate targets to preprocess each required linker script
$(eval $(foreach source,$(DEFAULT_LINKER_SCRIPT_SOURCE) $(LINKER_SCRIPT_SOURCES), \
- $(call MAKE_LD,$(call linker_script_path,$(source)),$(source),$(1))))
+ $(call MAKE_LD,$(call linker_script_path,$(source)),$(source),$(1),$(BL))))
-$(eval BL_LDFLAGS := $($(call uppercase,$(1))_LDFLAGS))
+$(eval BL_LDFLAGS := $($(BL)_LDFLAGS))
ifeq ($(USE_ROMLIB),1)
$(ELF): romlib.bin | $$$$(@D)/
@@ -554,10 +568,10 @@
ifeq ($(4),1)
$(call ENCRYPT_FW,$(BIN),$(ENC_BIN))
-$(if $(2),$(call TOOL_ADD_IMG_PAYLOAD,$(1),$(BIN),--$(2),$(ENC_BIN),$(3), \
+$(if $(2),$(call TOOL_ADD_IMG_PAYLOAD,$(BL),$(BIN),--$(2),$(ENC_BIN),$(3), \
$(ENC_BIN)))
else
-$(if $(2),$(call TOOL_ADD_IMG_PAYLOAD,$(1),$(BIN),--$(2),$(BIN),$(3)))
+$(if $(2),$(call TOOL_ADD_IMG_PAYLOAD,$(BL),$(BIN),--$(2),$(BIN),$(3)))
endif
endef
diff --git a/make_helpers/common.mk b/make_helpers/common.mk
index 75d9f71..848e4e9 100644
--- a/make_helpers/common.mk
+++ b/make_helpers/common.mk
@@ -9,9 +9,9 @@
include $(dir $(common-mk))utilities.mk
- silent = $(call bool,$(findstring s,$(firstword ~$(MAKEFLAGS))))
- verbose = $(if $(silent),,$(call bool,$(V)))
+ silent := $(call bool,$(findstring s,$(firstword ~$(MAKEFLAGS))))
+ verbose := $(if $(silent),,$(call bool,$(V)))
- s = @$(if $(or $(verbose),$(silent)),: )
- q = $(if $(verbose),,@)
+ s := @$(if $(or $(verbose),$(silent)),: )
+ q := $(if $(verbose),,@)
endif
diff --git a/plat/arm/board/arm_fpga/platform.mk b/plat/arm/board/arm_fpga/platform.mk
index c1dc5f5..967bf21 100644
--- a/plat/arm/board/arm_fpga/platform.mk
+++ b/plat/arm/board/arm_fpga/platform.mk
@@ -128,9 +128,9 @@
BL31_SOURCES += ${FDT_WRAPPERS_SOURCES}
-$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/rom_trampoline.S,bl31))
-$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/kernel_trampoline.S,bl31))
-$(eval $(call MAKE_LD,$(BUILD_PLAT)/build_axf.ld,plat/arm/board/arm_fpga/build_axf.ld.S,bl31))
+$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/rom_trampoline.S,bl31,BL31))
+$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/kernel_trampoline.S,bl31,BL31))
+$(eval $(call MAKE_LD,$(BUILD_PLAT)/build_axf.ld,plat/arm/board/arm_fpga/build_axf.ld.S,bl31,BL31))
ifeq ($($(ARCH)-ld-id),gnu-gcc)
AXF_LDFLAGS += -Wl,--build-id=none -mno-fix-cortex-a53-843419
diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c
index 3650854..0a8dd37 100644
--- a/plat/arm/common/arm_bl31_setup.c
+++ b/plat/arm/common/arm_bl31_setup.c
@@ -367,9 +367,6 @@
struct transfer_list_entry *te __unused;
#if TRANSFER_LIST && !RESET_TO_BL31
- /* Initialise the non-secure world tl, BL31 may modify the HW_CONFIG so defer
- * copying it until later.
- */
ns_tl = transfer_list_init((void *)FW_NS_HANDOFF_BASE,
PLAT_ARM_FW_HANDOFF_SIZE);
@@ -378,12 +375,23 @@
panic();
}
-#if !RESET_TO_BL2
te = transfer_list_find(secure_tl, TL_TAG_FDT);
assert(te != NULL);
+ /*
+ * A pre-existing assumption is that FCONF is unsupported w/ RESET_TO_BL2 and
+ * RESET_TO_BL31. In the case of RESET_TO_BL31 this makes sense because there
+ * isn't a prior stage to load the device tree, but the reasoning for RESET_TO_BL2 is
+ * less clear. For the moment hardware properties that would normally be
+ * derived from the DT are statically defined.
+ */
+#if !RESET_TO_BL2
fconf_populate("HW_CONFIG", (uintptr_t)transfer_list_entry_data(te));
-#endif /* !(RESET_TO_BL2 && RESET_TO_BL31) */
+#endif
+
+ te = transfer_list_add(ns_tl, TL_TAG_FDT, te->data_size,
+ transfer_list_entry_data(te));
+ assert(te != NULL);
#endif /* TRANSFER_LIST */
/* Initialize the GIC driver, cpu and distributor interfaces */
@@ -433,13 +441,6 @@
arm_console_runtime_init();
#if TRANSFER_LIST && !RESET_TO_BL31
- te = transfer_list_find(secure_tl, TL_TAG_FDT);
- assert(te != NULL);
-
- te = transfer_list_add(ns_tl, TL_TAG_FDT, te->data_size,
- transfer_list_entry_data(te));
- assert(te != NULL);
-
/*
* We assume BL31 has added all TE's required by BL33 at this stage, ensure
* that data is visible to all observers by performing a flush operation, so