mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-18 02:24:18 +00:00

This patch adds architectural features detection procedure to ensure features enabled are present in the given hardware implementation. It verifies whether the architecture build flags passed during compilation match the respective features by reading their ID registers. It reads through all the enabled feature specific ID registers at once and panics in case of mismatch(feature enabled but not implemented in PE). Feature flags are used at sections (context_management, save and restore routines of registers) during context switch. If the enabled feature flag is not supported by the PE, it causes an exception while saving or restoring the registers guarded by them. With this mechanism, the build flags are validated at an early phase prior to their usage, thereby preventing any undefined action under their control. This implementation is based on tristate approach for each feature and currently FEAT_STATE=0 and FEAT_STATE=1 are covered as part of this patch. FEAT_STATE=2 is planned for phase-2 implementation and will be taken care separately. The patch has been explicitly tested, by adding a new test_config with build config enabling majority of the features and detected all of them under FVP launched with parameters enabling v8.7 features. Note: This is an experimental procedure and the mechanism itself is guarded by a macro "FEATURE_DETECTION", which is currently being disabled by default. The "FEATURE_DETECTION" macro is documented and the platforms are encouraged to make use of this diagnostic tool by enabling this "FEATURE_DETECTION" flag explicitly and get used to its behaviour during booting before the procedure gets mandated. Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> Change-Id: Ia23d95430fe82d417a938b672bfb5edc401b0f43
155 lines
3.7 KiB
Makefile
155 lines
3.7 KiB
Makefile
#
|
|
# Copyright (c) 2013-2022, ARM Limited and Contributors. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
#
|
|
|
|
################################################################################
|
|
# Include Makefile for the SPM-MM implementation
|
|
################################################################################
|
|
ifeq (${SUPPORT_UNKNOWN_MPID},1)
|
|
ifeq (${DEBUG},0)
|
|
$(warning WARNING: SUPPORT_UNKNOWN_MPID enabled)
|
|
endif
|
|
endif
|
|
|
|
ifeq (${SPM_MM},1)
|
|
ifeq (${EL3_EXCEPTION_HANDLING},0)
|
|
$(error EL3_EXCEPTION_HANDLING must be 1 for SPM-MM support)
|
|
else
|
|
$(info Including SPM Management Mode (MM) makefile)
|
|
include services/std_svc/spm_mm/spm_mm.mk
|
|
endif
|
|
endif
|
|
|
|
include lib/extensions/amu/amu.mk
|
|
include lib/mpmm/mpmm.mk
|
|
include lib/psci/psci_lib.mk
|
|
|
|
BL31_SOURCES += bl31/bl31_main.c \
|
|
bl31/interrupt_mgmt.c \
|
|
bl31/aarch64/bl31_entrypoint.S \
|
|
bl31/aarch64/crash_reporting.S \
|
|
bl31/aarch64/ea_delegate.S \
|
|
bl31/aarch64/runtime_exceptions.S \
|
|
bl31/bl31_context_mgmt.c \
|
|
common/runtime_svc.c \
|
|
lib/cpus/aarch64/dsu_helpers.S \
|
|
plat/common/aarch64/platform_mp_stack.S \
|
|
services/arm_arch_svc/arm_arch_svc_setup.c \
|
|
services/std_svc/std_svc_setup.c \
|
|
${PSCI_LIB_SOURCES} \
|
|
${SPMD_SOURCES} \
|
|
${SPM_SOURCES}
|
|
|
|
ifeq (${DISABLE_MTPMU},1)
|
|
BL31_SOURCES += lib/extensions/mtpmu/aarch64/mtpmu.S
|
|
endif
|
|
|
|
ifeq (${ENABLE_PMF}, 1)
|
|
BL31_SOURCES += lib/pmf/pmf_main.c
|
|
endif
|
|
|
|
include lib/debugfs/debugfs.mk
|
|
ifeq (${USE_DEBUGFS},1)
|
|
BL31_SOURCES += $(DEBUGFS_SRCS)
|
|
endif
|
|
|
|
ifeq (${EL3_EXCEPTION_HANDLING},1)
|
|
BL31_SOURCES += bl31/ehf.c
|
|
endif
|
|
|
|
ifeq (${SDEI_SUPPORT},1)
|
|
ifeq (${EL3_EXCEPTION_HANDLING},0)
|
|
$(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
|
|
endif
|
|
BL31_SOURCES += services/std_svc/sdei/sdei_dispatch.S \
|
|
services/std_svc/sdei/sdei_event.c \
|
|
services/std_svc/sdei/sdei_intr_mgmt.c \
|
|
services/std_svc/sdei/sdei_main.c \
|
|
services/std_svc/sdei/sdei_state.c
|
|
endif
|
|
|
|
ifeq (${TRNG_SUPPORT},1)
|
|
BL31_SOURCES += services/std_svc/trng/trng_main.c \
|
|
services/std_svc/trng/trng_entropy_pool.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_SPE_FOR_LOWER_ELS},1)
|
|
BL31_SOURCES += lib/extensions/spe/spe.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_AMU},1)
|
|
BL31_SOURCES += ${AMU_SOURCES}
|
|
endif
|
|
|
|
ifeq (${ENABLE_MPMM},1)
|
|
BL31_SOURCES += ${MPMM_SOURCES}
|
|
endif
|
|
|
|
ifeq (${ENABLE_SME_FOR_NS},1)
|
|
BL31_SOURCES += lib/extensions/sme/sme.c
|
|
BL31_SOURCES += lib/extensions/sve/sve.c
|
|
else
|
|
ifeq (${ENABLE_SVE_FOR_NS},1)
|
|
BL31_SOURCES += lib/extensions/sve/sve.c
|
|
endif
|
|
endif
|
|
|
|
ifeq (${ENABLE_MPAM_FOR_LOWER_ELS},1)
|
|
BL31_SOURCES += lib/extensions/mpam/mpam.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_TRBE_FOR_NS},1)
|
|
BL31_SOURCES += lib/extensions/trbe/trbe.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_SYS_REG_TRACE_FOR_NS},1)
|
|
BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_TRF_FOR_NS},1)
|
|
BL31_SOURCES += lib/extensions/trf/aarch64/trf.c
|
|
endif
|
|
|
|
ifeq (${WORKAROUND_CVE_2017_5715},1)
|
|
BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \
|
|
lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
|
|
endif
|
|
|
|
ifeq ($(SMC_PCI_SUPPORT),1)
|
|
BL31_SOURCES += services/std_svc/pci_svc.c
|
|
endif
|
|
|
|
ifeq (${ENABLE_RME},1)
|
|
include lib/gpt_rme/gpt_rme.mk
|
|
|
|
BL31_SOURCES += ${GPT_LIB_SRCS} \
|
|
${RMMD_SOURCES}
|
|
endif
|
|
|
|
ifeq ($(FEATURE_DETECTION),1)
|
|
BL31_SOURCES += common/feat_detect.c
|
|
endif
|
|
|
|
BL31_LINKERFILE := bl31/bl31.ld.S
|
|
|
|
# Flag used to indicate if Crash reporting via console should be included
|
|
# in BL31. This defaults to being present in DEBUG builds only
|
|
ifndef CRASH_REPORTING
|
|
CRASH_REPORTING := $(DEBUG)
|
|
endif
|
|
|
|
$(eval $(call assert_booleans,\
|
|
$(sort \
|
|
CRASH_REPORTING \
|
|
EL3_EXCEPTION_HANDLING \
|
|
SDEI_SUPPORT \
|
|
)))
|
|
|
|
$(eval $(call add_defines,\
|
|
$(sort \
|
|
CRASH_REPORTING \
|
|
EL3_EXCEPTION_HANDLING \
|
|
SDEI_SUPPORT \
|
|
)))
|