1CFG_LTC_OPTEE_THREAD ?= y 2# Size of emulated TrustZone protected SRAM, 448 kB. 3# Only applicable when paging is enabled. 4CFG_CORE_TZSRAM_EMUL_SIZE ?= 458752 5CFG_LPAE_ADDR_SPACE_SIZE ?= (1ull << 32) 6 7CFG_MMAP_REGIONS ?= 13 8CFG_RESERVED_VASPACE_SIZE ?= (1024 * 1024 * 10) 9 10ifeq ($(CFG_ARM64_core),y) 11CFG_KERN_LINKER_FORMAT ?= elf64-littleaarch64 12CFG_KERN_LINKER_ARCH ?= aarch64 13else 14ifeq ($(CFG_ARM32_core),y) 15CFG_KERN_LINKER_FORMAT ?= elf32-littlearm 16CFG_KERN_LINKER_ARCH ?= arm 17else 18$(error Error: CFG_ARM64_core or CFG_ARM32_core should be defined) 19endif 20endif 21 22ifeq ($(CFG_TA_FLOAT_SUPPORT),y) 23# Use hard-float for floating point support in user TAs instead of 24# soft-float 25CFG_WITH_VFP ?= y 26ifeq ($(CFG_ARM64_core),y) 27# AArch64 has no fallback to soft-float 28$(call force,CFG_WITH_VFP,y) 29endif 30ifeq ($(CFG_WITH_VFP),y) 31arm64-platform-hard-float-enabled := y 32ifneq ($(CFG_TA_ARM32_NO_HARD_FLOAT_SUPPORT),y) 33arm32-platform-hard-float-enabled := y 34endif 35endif 36endif 37 38# Adds protection against CVE-2017-5715 also know as Spectre 39# (https://spectreattack.com) 40# See also https://developer.arm.com/-/media/Files/pdf/Cache_Speculation_Side-channels.pdf 41# Variant 2 42CFG_CORE_WORKAROUND_SPECTRE_BP ?= y 43# Same as CFG_CORE_WORKAROUND_SPECTRE_BP but targeting exceptions from 44# secure EL0 instead of non-secure world. 45CFG_CORE_WORKAROUND_SPECTRE_BP_SEC ?= $(CFG_CORE_WORKAROUND_SPECTRE_BP) 46 47CFG_CORE_RWDATA_NOEXEC ?= y 48CFG_CORE_RODATA_NOEXEC ?= n 49ifeq ($(CFG_CORE_RODATA_NOEXEC),y) 50$(call force,CFG_CORE_RWDATA_NOEXEC,y) 51endif 52# 'y' to set the Alignment Check Enable bit in SCTLR/SCTLR_EL1, 'n' to clear it 53CFG_SCTLR_ALIGNMENT_CHECK ?= y 54 55ifeq ($(CFG_CORE_LARGE_PHYS_ADDR),y) 56$(call force,CFG_WITH_LPAE,y) 57endif 58 59# Unmaps all kernel mode code except the code needed to take exceptions 60# from user space and restore kernel mode mapping again. This gives more 61# strict control over what is accessible while in user mode. 62# Addresses CVE-2017-5715 (aka Meltdown) known to affect Arm Cortex-A75 63CFG_CORE_UNMAP_CORE_AT_EL0 ?= y 64 65# Initialize PMCR.DP to 1 to prohibit cycle counting in secure state, and 66# save/restore PMCR during world switch. 67CFG_SM_NO_CYCLE_COUNTING ?= y 68 69ifeq ($(CFG_ARM32_core),y) 70# Configration directive related to ARMv7 optee boot arguments. 71# CFG_PAGEABLE_ADDR: if defined, forces pageable data physical address. 72# CFG_NS_ENTRY_ADDR: if defined, forces NS World physical entry address. 73# CFG_DT_ADDR: if defined, forces Device Tree data physical address. 74endif 75 76core-platform-cppflags += -I$(arch-dir)/include 77core-platform-subdirs += \ 78 $(addprefix $(arch-dir)/, kernel crypto mm tee pta) $(platform-dir) 79 80ifneq ($(CFG_WITH_ARM_TRUSTED_FW),y) 81core-platform-subdirs += $(arch-dir)/sm 82endif 83 84arm64-platform-cppflags += -DARM64=1 -D__LP64__=1 85arm32-platform-cppflags += -DARM32=1 -D__ILP32__=1 86 87platform-cflags-generic ?= -ffunction-sections -fdata-sections -pipe 88platform-aflags-generic ?= -pipe 89 90arm32-platform-cflags-no-hard-float ?= -mfloat-abi=soft 91arm32-platform-cflags-hard-float ?= -mfloat-abi=hard -funsafe-math-optimizations 92arm32-platform-cflags-generic-thumb ?= -mthumb -mthumb-interwork \ 93 -fno-short-enums -fno-common -mno-unaligned-access 94arm32-platform-cflags-generic-arm ?= -marm -fno-omit-frame-pointer -mapcs \ 95 -fno-short-enums -fno-common -mno-unaligned-access 96arm32-platform-aflags-no-hard-float ?= 97 98arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only 99arm64-platform-cflags-hard-float ?= 100arm64-platform-cflags-generic ?= -mstrict-align 101 102ifeq ($(DEBUG),1) 103# For backwards compatibility 104$(call force,CFG_CC_OPTIMIZE_FOR_SIZE,n) 105$(call force,CFG_DEBUG_INFO,y) 106endif 107 108CFG_CC_OPTIMIZE_FOR_SIZE ?= y 109ifeq ($(CFG_CC_OPTIMIZE_FOR_SIZE),y) 110platform-cflags-optimization ?= -Os 111else 112platform-cflags-optimization ?= -O0 113endif 114 115CFG_DEBUG_INFO ?= y 116ifeq ($(CFG_DEBUG_INFO),y) 117platform-cflags-debug-info ?= -g3 118platform-aflags-debug-info ?= -g 119endif 120 121core-platform-cflags += $(platform-cflags-optimization) 122core-platform-cflags += $(platform-cflags-generic) 123core-platform-cflags += $(platform-cflags-debug-info) 124 125core-platform-aflags += $(platform-aflags-generic) 126core-platform-aflags += $(platform-aflags-debug-info) 127 128ifeq ($(CFG_ARM64_core),y) 129arch-bits-core := 64 130core-platform-cppflags += $(arm64-platform-cppflags) 131core-platform-cflags += $(arm64-platform-cflags) 132core-platform-cflags += $(arm64-platform-cflags-generic) 133core-platform-cflags += $(arm64-platform-cflags-no-hard-float) 134core-platform-aflags += $(arm64-platform-aflags) 135else 136arch-bits-core := 32 137core-platform-cppflags += $(arm32-platform-cppflags) 138core-platform-cflags += $(arm32-platform-cflags) 139core-platform-cflags += $(arm32-platform-cflags-no-hard-float) 140ifeq ($(CFG_UNWIND),y) 141core-platform-cflags += -funwind-tables 142endif 143core-platform-cflags += $(arm32-platform-cflags-generic-thumb) 144core-platform-aflags += $(core_arm32-platform-aflags) 145core-platform-aflags += $(arm32-platform-aflags) 146endif 147 148# Provide default supported-ta-targets if not set by the platform config 149ifeq (,$(supported-ta-targets)) 150supported-ta-targets = ta_arm32 151ifeq ($(CFG_ARM64_core),y) 152supported-ta-targets += ta_arm64 153endif 154endif 155 156ta-targets := $(if $(CFG_USER_TA_TARGETS),$(filter $(supported-ta-targets),$(CFG_USER_TA_TARGETS)),$(supported-ta-targets)) 157unsup-targets := $(filter-out $(ta-targets),$(CFG_USER_TA_TARGETS)) 158ifneq (,$(unsup-targets)) 159$(error CFG_USER_TA_TARGETS contains unsupported value(s): $(unsup-targets). Valid values: $(supported-ta-targets)) 160endif 161 162ifneq ($(filter ta_arm32,$(ta-targets)),) 163# Variables for ta-target/sm "ta_arm32" 164CFG_ARM32_ta_arm32 := y 165arch-bits-ta_arm32 := 32 166ta_arm32-platform-cppflags += $(arm32-platform-cppflags) 167ta_arm32-platform-cflags += $(arm32-platform-cflags) 168ta_arm32-platform-cflags += $(platform-cflags-optimization) 169ta_arm32-platform-cflags += $(platform-cflags-debug-info) 170ta_arm32-platform-cflags += -fpic 171 172# Thumb mode doesn't support function graph tracing due to missing 173# frame pointer support required to trace function call chain. So 174# rather compile in ARM mode if function tracing is enabled. 175ifeq ($(CFG_TA_FTRACE_SUPPORT),y) 176ta_arm32-platform-cflags += $(arm32-platform-cflags-generic-arm) 177else 178ta_arm32-platform-cflags += $(arm32-platform-cflags-generic-thumb) 179endif 180 181ifeq ($(arm32-platform-hard-float-enabled),y) 182ta_arm32-platform-cflags += $(arm32-platform-cflags-hard-float) 183else 184ta_arm32-platform-cflags += $(arm32-platform-cflags-no-hard-float) 185endif 186ifeq ($(CFG_UNWIND),y) 187ta_arm32-platform-cflags += -funwind-tables 188endif 189ta_arm32-platform-aflags += $(platform-aflags-generic) 190ta_arm32-platform-aflags += $(platform-aflags-debug-info) 191ta_arm32-platform-aflags += $(arm32-platform-aflags) 192 193ta-mk-file-export-vars-ta_arm32 += CFG_ARM32_ta_arm32 194ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cppflags 195ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-cflags 196ta-mk-file-export-vars-ta_arm32 += ta_arm32-platform-aflags 197 198ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE ?= arm-linux-gnueabihf-_nl_ 199ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE32 ?= $$(CROSS_COMPILE)_nl_ 200ta-mk-file-export-add-ta_arm32 += CROSS_COMPILE_ta_arm32 ?= $$(CROSS_COMPILE32)_nl_ 201endif 202 203ifneq ($(filter ta_arm64,$(ta-targets)),) 204# Variables for ta-target/sm "ta_arm64" 205CFG_ARM64_ta_arm64 := y 206arch-bits-ta_arm64 := 64 207ta_arm64-platform-cppflags += $(arm64-platform-cppflags) 208ta_arm64-platform-cflags += $(arm64-platform-cflags) 209ta_arm64-platform-cflags += $(platform-cflags-optimization) 210ta_arm64-platform-cflags += $(platform-cflags-debug-info) 211ta_arm64-platform-cflags += -fpic 212ta_arm64-platform-cflags += $(arm64-platform-cflags-generic) 213ifeq ($(arm64-platform-hard-float-enabled),y) 214ta_arm64-platform-cflags += $(arm64-platform-cflags-hard-float) 215else 216ta_arm64-platform-cflags += $(arm64-platform-cflags-no-hard-float) 217endif 218ta_arm64-platform-aflags += $(platform-aflags-generic) 219ta_arm64-platform-aflags += $(platform-aflags-debug-info) 220ta_arm64-platform-aflags += $(arm64-platform-aflags) 221 222ta-mk-file-export-vars-ta_arm64 += CFG_ARM64_ta_arm64 223ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cppflags 224ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-cflags 225ta-mk-file-export-vars-ta_arm64 += ta_arm64-platform-aflags 226 227ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE64 ?= $$(CROSS_COMPILE)_nl_ 228ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE_ta_arm64 ?= $$(CROSS_COMPILE64)_nl_ 229endif 230 231# Set cross compiler prefix for each submodule 232$(foreach sm, core $(ta-targets), $(eval CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE$(arch-bits-$(sm))))) 233 234arm32-sysreg-txt = core/arch/arm/kernel/arm32_sysreg.txt 235arm32-sysregs-$(arm32-sysreg-txt)-h := arm32_sysreg.h 236arm32-sysregs-$(arm32-sysreg-txt)-s := arm32_sysreg.S 237arm32-sysregs += $(arm32-sysreg-txt) 238 239ifeq ($(CFG_ARM_GICV3),y) 240arm32-gicv3-sysreg-txt = core/arch/arm/kernel/arm32_gicv3_sysreg.txt 241arm32-sysregs-$(arm32-gicv3-sysreg-txt)-h := arm32_gicv3_sysreg.h 242arm32-sysregs-$(arm32-gicv3-sysreg-txt)-s := arm32_gicv3_sysreg.S 243arm32-sysregs += $(arm32-gicv3-sysreg-txt) 244endif 245 246arm32-sysregs-out := $(out-dir)/$(sm)/include/generated 247 248define process-arm32-sysreg 249FORCE-GENSRC$(sm): $$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-h) 250cleanfiles := $$(cleanfiles) $$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-h) 251 252$$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-h): $(1) scripts/arm32_sysreg.py 253 @$(cmd-echo-silent) ' GEN $$@' 254 $(q)mkdir -p $$(dir $$@) 255 $(q)scripts/arm32_sysreg.py --guard __$$(arm32-sysregs-$(1)-h) \ 256 < $$< > $$@ 257 258FORCE-GENSRC$(sm): $$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-s) 259cleanfiles := $$(cleanfiles) $$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-s) 260 261$$(arm32-sysregs-out)/$$(arm32-sysregs-$(1)-s): $(1) scripts/arm32_sysreg.py 262 @$(cmd-echo-silent) ' GEN $$@' 263 $(q)mkdir -p $$(dir $$@) 264 $(q)scripts/arm32_sysreg.py --s_file < $$< > $$@ 265endef #process-arm32-sysreg 266 267$(foreach sr, $(arm32-sysregs), $(eval $(call process-arm32-sysreg,$(sr)))) 268