xref: /optee_os/mk/config.mk (revision 003383344c26be3589383acc87c1ebb2860e9317)
1120c43adSJerome Forissier# Default configuration values for OP-TEE core (all platforms).
2120c43adSJerome Forissier#
3120c43adSJerome Forissier# Platform-specific overrides are in core/arch/arm32/plat-*/conf.mk.
4120c43adSJerome Forissier# Some subsystem-specific defaults are not here but rather in */sub.mk.
5120c43adSJerome Forissier#
6120c43adSJerome Forissier# Configuration values may be assigned from multiple sources.
7120c43adSJerome Forissier# From higher to lower priority:
8120c43adSJerome Forissier#
9120c43adSJerome Forissier#   1. Make arguments ('make CFG_FOO=bar...')
10120c43adSJerome Forissier#   2. The file specified by $(CFG_OPTEE_CONFIG) (if defined)
11120c43adSJerome Forissier#   3. The environment ('CFG_FOO=bar make...')
12120c43adSJerome Forissier#   4. The platform-specific configuration file: core/arch/arm32/plat-*/conf.mk
13120c43adSJerome Forissier#   5. This file
14120c43adSJerome Forissier#   6. Subsystem-specific makefiles (*/sub.mk)
15120c43adSJerome Forissier#
16b5569a68SPascal Brand# Actual values used during the build are output to $(out-dir)/conf.mk
17120c43adSJerome Forissier# (CFG_* variables only).
18120c43adSJerome Forissier
19a75f2e14SJerome Forissier# Cross-compiler prefix and suffix
2031bcbe52SJerome Forissierifeq ($(ARCH),arm)
21a75f2e14SJerome ForissierCROSS_COMPILE ?= arm-linux-gnueabihf-
22c879bd89SCasey Connolly# Don't cross-compile if building on aarch64 natively
23c879bd89SCasey Connollyifneq ($(shell uname -m),aarch64)
24c042fbefSJerome ForissierCROSS_COMPILE64 ?= aarch64-linux-gnu-
2531bcbe52SJerome Forissierendif
26c879bd89SCasey Connollyendif
2731bcbe52SJerome Forissierifeq ($(ARCH),riscv)
2831bcbe52SJerome ForissierCROSS_COMPILE ?= riscv-linux-gnu-
2931bcbe52SJerome ForissierCROSS_COMPILE64 ?= riscv64-linux-gnu-
3031bcbe52SJerome Forissierendif
3131bcbe52SJerome ForissierCROSS_COMPILE32 ?= $(CROSS_COMPILE)
32a75f2e14SJerome ForissierCOMPILER ?= gcc
33a75f2e14SJerome Forissier
34b09cddcaSJerome Forissier# For convenience
35b09cddcaSJerome Forissierifdef CFLAGS
36b09cddcaSJerome ForissierCFLAGS32 ?= $(CFLAGS)
37b09cddcaSJerome ForissierCFLAGS64 ?= $(CFLAGS)
38b09cddcaSJerome Forissierendif
39b09cddcaSJerome Forissier
40120c43adSJerome Forissier# Compiler warning level.
41120c43adSJerome Forissier# Supported values: undefined, 1, 2 and 3. 3 gives more warnings.
42b0104773SPascal BrandWARNS ?= 3
43b0104773SPascal Brand
44b4faf480SDick Olsson# Path to the Python interpreter used by the build system.
45b4faf480SDick Olsson# This variable is set to the default python3 interpreter in the user's
46b4faf480SDick Olsson# path. But build environments that require more explicit control can
47b4faf480SDick Olsson# set the path to a specific interpreter through this variable.
48b4faf480SDick OlssonPYTHON3 ?= python3
49b4faf480SDick Olsson
503f17b838SEtienne Carriere# Define DEBUG=1 to compile without optimization (forces -O0)
51b0104773SPascal Brand# DEBUG=1
520e6830baSEtienne Carriereifeq ($(DEBUG),1)
530e6830baSEtienne Carriere# For backwards compatibility
540e6830baSEtienne Carriere$(call force,CFG_CC_OPT_LEVEL,0)
550e6830baSEtienne Carriere$(call force,CFG_DEBUG_INFO,y)
560e6830baSEtienne Carriereendif
570e6830baSEtienne Carriere
580e6830baSEtienne Carriere# CFG_CC_OPT_LEVEL sets compiler optimization level passed with -O directive.
590e6830baSEtienne Carriere# Optimize for size by default, usually gives good performance too.
600e6830baSEtienne CarriereCFG_CC_OPT_LEVEL ?= s
610e6830baSEtienne Carriere
620e6830baSEtienne Carriere# Enabling CFG_DEBUG_INFO makes debug information embedded in core.
630e6830baSEtienne CarriereCFG_DEBUG_INFO ?= y
64b0104773SPascal Brand
654ec2358eSJerome Forissier# If y, enable debug features of the TEE core (assertions and lock checks
664ec2358eSJerome Forissier# are enabled, panic and assert messages are more verbose, data and prefetch
674ec2358eSJerome Forissier# aborts show a stack dump). When disabled, the NDEBUG directive is defined
684ec2358eSJerome Forissier# so assertions are disabled.
694ec2358eSJerome ForissierCFG_TEE_CORE_DEBUG ?= y
70b0104773SPascal Brand
713f58e4ecSOvidiu Mihalachi# Log levels for the TEE core. Defines which core messages are displayed
723f58e4ecSOvidiu Mihalachi# on the secure console. Disabling core log (level set to 0) also disables
733f58e4ecSOvidiu Mihalachi# logs from the TAs.
7409ca9f8bSJerome Forissier# 0: none
7509ca9f8bSJerome Forissier# 1: error
7614c68b3cSJerome Forissier# 2: error + info
7714c68b3cSJerome Forissier# 3: error + info + debug
7814c68b3cSJerome Forissier# 4: error + info + debug + flow
7914c68b3cSJerome ForissierCFG_TEE_CORE_LOG_LEVEL ?= 2
803f58e4ecSOvidiu Mihalachi
813f58e4ecSOvidiu Mihalachi# TA log level
823f58e4ecSOvidiu Mihalachi# If user-mode library libutils.a is built with CFG_TEE_TA_LOG_LEVEL=0,
833f58e4ecSOvidiu Mihalachi# TA tracing is disabled regardless of the value of CFG_TEE_TA_LOG_LEVEL
843f58e4ecSOvidiu Mihalachi# when the TA is built.
85e0042c88SPascal BrandCFG_TEE_TA_LOG_LEVEL ?= 1
86b0104773SPascal Brand
877c876f12SPascal Brand# TA enablement
887c876f12SPascal Brand# When defined to "y", TA traces are output according to
897c876f12SPascal Brand# CFG_TEE_TA_LOG_LEVEL. Otherwise, they are not output at all
907c876f12SPascal BrandCFG_TEE_CORE_TA_TRACE ?= y
91b0104773SPascal Brand
928c8e1441SJerome Forissier# If y, enable the memory leak detection feature in the bget memory allocator.
938c8e1441SJerome Forissier# When this feature is enabled, calling mdbg_check(1) will print a list of all
948c8e1441SJerome Forissier# the currently allocated buffers and the location of the allocation (file and
958c8e1441SJerome Forissier# line number).
968c8e1441SJerome Forissier# Note: make sure the log level is high enough for the messages to show up on
978c8e1441SJerome Forissier# the secure console! For instance:
988c8e1441SJerome Forissier# - To debug user-mode (TA) allocations: build OP-TEE *and* the TA with:
998c8e1441SJerome Forissier#   $ make CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=3
1008c8e1441SJerome Forissier# - To debug TEE core allocations: build OP-TEE with:
1018c8e1441SJerome Forissier#   $ make CFG_TEE_CORE_MALLOC_DEBUG=y CFG_TEE_CORE_LOG_LEVEL=3
1020fcbddd4SSY ChiuCFG_TEE_CORE_MALLOC_DEBUG ?= n
1030fcbddd4SSY ChiuCFG_TEE_TA_MALLOC_DEBUG ?= n
104c2ce4186SJens Wiklander# Prints an error message and dumps the stack on failed memory allocations
105c2ce4186SJens Wiklander# using malloc() and friends.
106c2ce4186SJens WiklanderCFG_CORE_DUMP_OOM ?= $(CFG_TEE_CORE_MALLOC_DEBUG)
1070fcbddd4SSY Chiu
1082bfab756SJerome Forissier# Mask to select which messages are prefixed with long debugging information
10964fad262SVolodymyr Babchuk# (severity, core ID, thread ID, component name, function name, line number)
11064fad262SVolodymyr Babchuk# based on the message level. If BIT(level) is set, the long prefix is shown.
1112bfab756SJerome Forissier# Otherwise a short prefix is used (severity and component name only).
112f4aa5b11SJerome Forissier# Levels: 0=none 1=error 2=info 3=debug 4=flow
1132bfab756SJerome ForissierCFG_MSG_LONG_PREFIX_MASK ?= 0x1a
114f4aa5b11SJerome Forissier
115120c43adSJerome Forissier# Number of threads
116120c43adSJerome ForissierCFG_NUM_THREADS ?= 2
117ab35d7adSCedric Chaumont
118ab35d7adSCedric Chaumont# API implementation version
119ab35d7adSCedric ChaumontCFG_TEE_API_VERSION ?= GPD-1.1-dev
120ab35d7adSCedric Chaumont
121ab35d7adSCedric Chaumont# Implementation description (implementation-dependent)
122ab35d7adSCedric ChaumontCFG_TEE_IMPL_DESCR ?= OPTEE
123ab35d7adSCedric Chaumont
12429cff5cfSJerome Forissier# Should OPTEE_SMC_CALL_GET_OS_REVISION return a build identifier to Normal
12529cff5cfSJerome Forissier# World?
12629cff5cfSJerome ForissierCFG_OS_REV_REPORTS_GIT_SHA1 ?= y
12729cff5cfSJerome Forissier
12835c507f2SJerome Forissier# The following values are not extracted from the "git describe" output because
12935c507f2SJerome Forissier# we might be outside of a Git environment, or the tree may have been cloned
13035c507f2SJerome Forissier# with limited depth not including any tag, so there is really no guarantee
13135c507f2SJerome Forissier# that TEE_IMPL_VERSION contains the major and minor revision numbers.
1322a5b1d12SJerome ForissierCFG_OPTEE_REVISION_MAJOR ?= 4
13386660925SJens WiklanderCFG_OPTEE_REVISION_MINOR ?= 8
1343bfa418bSJerome ForissierCFG_OPTEE_REVISION_EXTRA ?=
135ab35d7adSCedric Chaumont
13648ca43e8SJerome Forissier# Trusted OS implementation version
13748ca43e8SJerome ForissierTEE_IMPL_VERSION ?= $(shell git describe --always --dirty=-dev 2>/dev/null || \
1383bfa418bSJerome Forissier		      echo Unknown_$(CFG_OPTEE_REVISION_MAJOR).$(CFG_OPTEE_REVISION_MINOR))$(CFG_OPTEE_REVISION_EXTRA)
13948ca43e8SJerome Forissier
140ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
141ab35d7adSCedric ChaumontCFG_TEE_MANUFACTURER ?= LINARO
142ab35d7adSCedric Chaumont
143ab35d7adSCedric Chaumont# Trusted firmware version
144ab35d7adSCedric ChaumontCFG_TEE_FW_IMPL_VERSION ?= FW_IMPL_UNDEF
145ab35d7adSCedric Chaumont
146ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
147ab35d7adSCedric ChaumontCFG_TEE_FW_MANUFACTURER ?= FW_MAN_UNDEF
148ab35d7adSCedric Chaumont
149b44708c1SJerome Forissier# Rich Execution Environment (REE) file system support: normal world OS
150b44708c1SJerome Forissier# provides the actual storage.
151b44708c1SJerome Forissier# This is the default FS when enabled (i.e., the one used when
152b44708c1SJerome Forissier# TEE_STORAGE_PRIVATE is passed to the trusted storage API)
153b44708c1SJerome ForissierCFG_REE_FS ?= y
154bc420748SJens Wiklander
15589da7ffeSAnil Kumar Reddy# CFG_REE_FS_HTREE_HASH_SIZE_COMPAT, when enabled, supports the legacy
15689da7ffeSAnil Kumar Reddy# REE FS hash tree tagging implementation that uses a truncated hash.
15789da7ffeSAnil Kumar Reddy# Be warned that disabling this config could break accesses to existing
15889da7ffeSAnil Kumar Reddy# REE FS content.
15989da7ffeSAnil Kumar ReddyCFG_REE_FS_HTREE_HASH_SIZE_COMPAT ?= y
16089da7ffeSAnil Kumar Reddy
16188e6e089SJerome Forissier# RPMB file system support
16288e6e089SJerome ForissierCFG_RPMB_FS ?= n
16388e6e089SJerome Forissier
164f5411aafSJudy Wang# Enable roll-back protection of REE file system using RPMB.
165f5411aafSJudy Wang# Roll-back protection only works if CFG_RPMB_FS = y.
166f5411aafSJudy WangCFG_REE_FS_INTEGRITY_RPMB ?= $(CFG_RPMB_FS)
167f5411aafSJudy Wang$(eval $(call cfg-depends-all,CFG_REE_FS_INTEGRITY_RPMB,CFG_RPMB_FS))
168f5411aafSJudy Wang
16988e6e089SJerome Forissier# Device identifier used when CFG_RPMB_FS = y.
17088e6e089SJerome Forissier# The exact meaning of this value is platform-dependent. On Linux, the
17188e6e089SJerome Forissier# tee-supplicant process will open /dev/mmcblk<id>rpmb
17288e6e089SJerome ForissierCFG_RPMB_FS_DEV_ID ?= 0
17388e6e089SJerome Forissier
1747d97159bSManuel Huber# This config variable determines the number of entries read in from RPMB at
1757d97159bSManuel Huber# once whenever a function traverses the RPMB FS. Increasing the default value
1767d97159bSManuel Huber# has the following consequences:
1777d97159bSManuel Huber# - More memory required on heap. A single FAT entry currently has a size of
1787d97159bSManuel Huber#   256 bytes.
1797d97159bSManuel Huber# - Potentially significant speed-ups for RPMB I/O. Depending on how many
1807d97159bSManuel Huber#   entries a function needs to traverse, the number of time-consuming RPMB
1817d97159bSManuel Huber#   read-in operations can be reduced.
1827d97159bSManuel Huber# Chosing a proper value is both platform- (available memory) and use-case-
1837d97159bSManuel Huber# dependent (potential number of FAT fs entries), so overwrite in platform
1847d97159bSManuel Huber# config files
1857d97159bSManuel HuberCFG_RPMB_FS_RD_ENTRIES ?= 8
1867d97159bSManuel Huber
1875f68d784SManuel Huber# Enables caching of FAT FS entries when set to a value greater than zero.
1885f68d784SManuel Huber# When enabled, the cache stores the first 'CFG_RPMB_FS_CACHE_ENTRIES' FAT FS
1895f68d784SManuel Huber# entries. The cache is populated when FAT FS entries are initially read in.
1905f68d784SManuel Huber# When traversing the FAT FS entries, we read from the cache instead of reading
1915f68d784SManuel Huber# in the entries from RPMB storage. Consequently, when a FAT FS entry is
1925f68d784SManuel Huber# written, the cache is updated. In scenarios where an estimate of the number
1935f68d784SManuel Huber# of FAT FS entries can be made, the cache may be specifically tailored to
1945f68d784SManuel Huber# store all entries. The caching can improve RPMB I/O at the cost
1955f68d784SManuel Huber# of additional memory.
1965f68d784SManuel Huber# Without caching, we temporarily require
1975f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1985f68d784SManuel Huber# while traversing the FAT FS (e.g. in read_fat).
1995f68d784SManuel Huber# For example 8*256 bytes = 2kB while in read_fat.
2005f68d784SManuel Huber# With caching, we constantly require up to
2015f68d784SManuel Huber# CFG_RPMB_FS_CACHE_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
2025f68d784SManuel Huber# depending on how many elements are in the cache, and additional temporary
2035f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
2045f68d784SManuel Huber# in case the cache is too small to hold all elements when traversing.
2055f68d784SManuel HuberCFG_RPMB_FS_CACHE_ENTRIES ?= 0
2065f68d784SManuel Huber
2078443e88eSEtienne Carriere# Print RPMB data frames sent to and received from the RPMB device
2088443e88eSEtienne CarriereCFG_RPMB_FS_DEBUG_DATA ?= n
2098443e88eSEtienne Carriere
2108443e88eSEtienne Carriere# Clear RPMB content at cold boot
2118443e88eSEtienne CarriereCFG_RPMB_RESET_FAT ?= n
2128443e88eSEtienne Carriere
2138443e88eSEtienne Carriere# Use a hard coded RPMB key instead of deriving it from the platform HUK
2148443e88eSEtienne CarriereCFG_RPMB_TESTKEY ?= n
2158443e88eSEtienne Carriere
216ed1993b7SJerome Forissier# Enables RPMB key programming by the TEE, in case the RPMB partition has not
217ed1993b7SJerome Forissier# been configured yet.
218ed1993b7SJerome Forissier# !!! Security warning !!!
219ed1993b7SJerome Forissier# Do *NOT* enable this in product builds, as doing so would allow the TEE to
220ed1993b7SJerome Forissier# leak the RPMB key.
221ed1993b7SJerome Forissier# This option is useful in the following situations:
222ed1993b7SJerome Forissier# - Testing
223ed1993b7SJerome Forissier# - RPMB key provisioning in a controlled environment (factory setup)
224ed1993b7SJerome ForissierCFG_RPMB_WRITE_KEY ?= n
225ed1993b7SJerome Forissier
226b78dd3f2SJens Wiklander# For the kernel driver to enable in-kernel RPMB routing it must know in
227b78dd3f2SJens Wiklander# advance that OP-TEE supports it. Setting CFG_RPMB_ANNOUNCE_PROBE_CAP=y
228b78dd3f2SJens Wiklander# will announce OP-TEE's capability for RPMB probing to the kernel and it
229b78dd3f2SJens Wiklander# will use in-kernel RPMB routing, without it all RPMB commands will be
230b78dd3f2SJens Wiklander# routed to tee-supplicant. This option is intended give some control over
231b78dd3f2SJens Wiklander# how the RPMB commands are routed to simplify testing.
232b78dd3f2SJens WiklanderCFG_RPMB_ANNOUNCE_PROBE_CAP ?= y
233b78dd3f2SJens Wiklander
23407fda6c7SJerome Forissier_CFG_WITH_SECURE_STORAGE := $(call cfg-one-enabled,CFG_REE_FS CFG_RPMB_FS)
23507fda6c7SJerome Forissier
2363ecd96bbSVesa Jääskeläinen# Signing key for OP-TEE TA's
2373ecd96bbSVesa Jääskeläinen# When performing external HSM signing for TA's TA_SIGN_KEY can be set to dummy
2383ecd96bbSVesa Jääskeläinen# key and then set TA_PUBLIC_KEY to match public key from the HSM.
2393ecd96bbSVesa Jääskeläinen# TA_PUBLIC_KEY's public key will be embedded into OP-TEE OS.
240bc420748SJens WiklanderTA_SIGN_KEY ?= keys/default_ta.pem
2413ecd96bbSVesa JääskeläinenTA_PUBLIC_KEY ?= $(TA_SIGN_KEY)
242c4553de7SJerome Forissier
243c34d0d91SJens Wiklander# Subkeys is a complement to the normal TA_SIGN_KEY where a subkey is used
244c34d0d91SJens Wiklander# to verify a TA instead. To sign a TA using a previously prepared subkey
245c34d0d91SJens Wiklander# two new options are added, TA_SUBKEY_ARGS and TA_SUBKEY_DEPS.  It is
246c34d0d91SJens Wiklander# typically used by assigning the following in the TA Makefile:
247c34d0d91SJens Wiklander# BINARY = <TA-uuid-string>
248c34d0d91SJens Wiklander# TA_SIGN_KEY = subkey.pem
249c34d0d91SJens Wiklander# TA_SUBKEY_ARGS = --subkey subkey.bin --name subkey_ta
250c34d0d91SJens Wiklander# TA_SUBKEY_DEPS = subkey.bin
251c34d0d91SJens Wiklander# See the documentation for more details on subkeys.
252c34d0d91SJens Wiklander
253c4553de7SJerome Forissier# Include lib/libutils/isoc in the build? Most platforms need this, but some
254c4553de7SJerome Forissier# may not because they obtain the isoc functions from elsewhere
255c4553de7SJerome ForissierCFG_LIBUTILS_WITH_ISOC ?= y
256fce4cfa1SJens Wiklander
25748952fd4SJens Wiklander# Include lib/libutils/compiler-rt in the build. Most platforms need this.
25848952fd4SJens Wiklander# Provides some functions called "compiler builtins", which the compiler
25948952fd4SJens Wiklander# may invoke to perform low-level operations such as long long division
26048952fd4SJens Wiklander# etc. Such functions typically come with compiler runtime libraires (GCC
26148952fd4SJens Wiklander# has libgcc, Clang has compiler-rt). OP-TEE often can't use them because
26248952fd4SJens Wiklander# they may be Linux-specific or bring unwanted dependencies. Therefore,
26348952fd4SJens Wiklander# this imports and builds only what's needed.
26448952fd4SJens WiklanderCFG_LIBUTILS_WITH_COMPILER_RT ?= y
26548952fd4SJens Wiklander
2660de9a5fbSJens Wiklander# Enables floating point support for user TAs
2670de9a5fbSJens Wiklander# ARM32: EABI defines both a soft-float ABI and a hard-float ABI,
2680de9a5fbSJens Wiklander#	 hard-float is basically a super set of soft-float. Hard-float
2690de9a5fbSJens Wiklander#	 requires all the support routines provided for soft-float, but the
2700de9a5fbSJens Wiklander#	 compiler may choose to optimize to not use some of them and use
2710de9a5fbSJens Wiklander#	 the floating-point registers instead.
2720de9a5fbSJens Wiklander# ARM64: EABI doesn't define a soft-float ABI, everything is hard-float (or
2730de9a5fbSJens Wiklander#	 nothing with ` -mgeneral-regs-only`)
2740de9a5fbSJens Wiklander# With CFG_TA_FLOAT_SUPPORT enabled TA code is free use floating point types
2750de9a5fbSJens WiklanderCFG_TA_FLOAT_SUPPORT ?= y
276923c1f34SJens Wiklander
2777411e0e1SJerome Forissier# Stack unwinding: print a stack dump to the console on core or TA abort, or
2787411e0e1SJerome Forissier# when a TA panics.
27931a29642SJerome Forissier# If CFG_UNWIND is enabled, both the kernel and user mode call stacks can be
28031a29642SJerome Forissier# unwound (not paged TAs, however).
28131a29642SJerome Forissier# Note that 32-bit ARM code needs unwind tables for this to work, so enabling
28231a29642SJerome Forissier# this option will increase the size of the 32-bit TEE binary by a few KB.
28331a29642SJerome Forissier# Similarly, TAs have to be compiled with -funwind-tables (default when the
28431a29642SJerome Forissier# option is set) otherwise they can't be unwound.
2857411e0e1SJerome Forissier# Warning: since the unwind sequence for user-mode (TA) code is implemented in
2867411e0e1SJerome Forissier# the privileged layer of OP-TEE, enabling this feature will weaken the
2877411e0e1SJerome Forissier# user/kernel isolation. Therefore it should be disabled in release builds.
2883f17b838SEtienne Carriereifeq ($(CFG_TEE_CORE_DEBUG),y)
28931a29642SJerome ForissierCFG_UNWIND ?= y
290923c1f34SJens Wiklanderendif
2916fbac37eSJens Wiklander
2926fbac37eSJens Wiklander# Enable support for dynamically loaded user TAs
2936fbac37eSJens WiklanderCFG_WITH_USER_TA ?= y
2942a142248SJens Wiklander
2952c20168bSBalsam CHIHI# Build user TAs included in this source tree
2962c20168bSBalsam CHIHICFG_BUILD_IN_TREE_TA ?= y
2972c20168bSBalsam CHIHI
29824d49094SJerome Forissier# Choosing the architecture(s) of user-mode libraries (used by TAs)
29924d49094SJerome Forissier#
30024d49094SJerome Forissier# Platforms may define a list of supported architectures for user-mode code
30124d49094SJerome Forissier# by setting $(supported-ta-targets). Valid values are "ta_arm32", "ta_arm64",
30224d49094SJerome Forissier# "ta_arm32 ta_arm64" and "ta_arm64 ta_arm32".
30324d49094SJerome Forissier# $(supported-ta-targets) defaults to "ta_arm32" when the TEE core is 32-bits,
30424d49094SJerome Forissier# and "ta_arm32 ta_arm64" when it is 64-bits (that is, when CFG_ARM64_core=y).
30524d49094SJerome Forissier# The first entry in $(supported-ta-targets) has a special role, see
30624d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> below.
30724d49094SJerome Forissier#
30824d49094SJerome Forissier# CFG_USER_TA_TARGETS may be defined to restrict $(supported-ta-targets) or
30924d49094SJerome Forissier# change the order of the values.
31024d49094SJerome Forissier#
31124d49094SJerome Forissier# The list of TA architectures is ultimately stored in $(ta-targets).
31224d49094SJerome Forissier
31324d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> (for example, CFG_USER_TA_TARGET_avb), if
31424d49094SJerome Forissier# defined, selects the unique TA architecture mode for building the in-tree TA
31524d49094SJerome Forissier# <ta-name>. Can be either ta_arm32 or ta_arm64.
31624d49094SJerome Forissier# By default, in-tree TAs are built using the first architecture specified in
31724d49094SJerome Forissier# $(ta-targets).
31824d49094SJerome Forissier
3197dfff131SJerome Forissier# Address Space Layout Randomization for user-mode Trusted Applications
3207dfff131SJerome Forissier#
3217dfff131SJerome Forissier# When this flag is enabled, the ELF loader will introduce a random offset
3227dfff131SJerome Forissier# when mapping the application in user space. ASLR makes the exploitation of
3237dfff131SJerome Forissier# memory corruption vulnerabilities more difficult.
32487372da4SJens WiklanderCFG_TA_ASLR ?= y
3257dfff131SJerome Forissier
3267dfff131SJerome Forissier# How much ASLR may shift the base address (in pages). The base address is
3277dfff131SJerome Forissier# randomly shifted by an integer number of pages comprised between these two
3287dfff131SJerome Forissier# values. Bigger ranges are more secure because they make the addresses harder
3297dfff131SJerome Forissier# to guess at the expense of using more memory for the page tables.
3307dfff131SJerome ForissierCFG_TA_ASLR_MIN_OFFSET_PAGES ?= 0
3317dfff131SJerome ForissierCFG_TA_ASLR_MAX_OFFSET_PAGES ?= 128
3327dfff131SJerome Forissier
333170e9084SJens Wiklander# Address Space Layout Randomization for TEE Core
334170e9084SJens Wiklander#
335170e9084SJens Wiklander# When this flag is enabled, the early init code will introduce a random
336170e9084SJens Wiklander# offset when mapping TEE Core. ASLR makes the exploitation of memory
337170e9084SJens Wiklander# corruption vulnerabilities more difficult.
33887372da4SJens WiklanderCFG_CORE_ASLR ?= y
339170e9084SJens Wiklander
34045507d10SKhoa Hoang# Stack Protection for TEE Core
34145507d10SKhoa Hoang# This flag enables the compiler stack protection mechanisms -fstack-protector.
34245507d10SKhoa Hoang# It will check the stack canary value before returning from a function to
34345507d10SKhoa Hoang# prevent buffer overflow attacks. Stack protector canary logic will be added
34445507d10SKhoa Hoang# for vulnerable functions that contain:
34545507d10SKhoa Hoang# - A character array larger than 8 bytes.
34645507d10SKhoa Hoang# - An 8-bit integer array larger than 8 bytes.
34745507d10SKhoa Hoang# - A call to alloca() with either a variable size or a constant size bigger
34845507d10SKhoa Hoang#   than 8 bytes.
34945507d10SKhoa HoangCFG_CORE_STACK_PROTECTOR ?= n
35045507d10SKhoa Hoang# This enable stack protector flag -fstack-protector-strong. Stack protector
35145507d10SKhoa Hoang# canary logic will be added for vulnerable functions that contain:
35245507d10SKhoa Hoang# - An array of any size and type.
35345507d10SKhoa Hoang# - A call to alloca().
35445507d10SKhoa Hoang# - A local variable that has its address taken.
35545507d10SKhoa HoangCFG_CORE_STACK_PROTECTOR_STRONG ?= y
35645507d10SKhoa Hoang# This enable stack protector flag -fstack-protector-all. Stack protector canary
35745507d10SKhoa Hoang# logic will be added to all functions regardless of their vulnerability.
35845507d10SKhoa HoangCFG_CORE_STACK_PROTECTOR_ALL ?= n
35945507d10SKhoa Hoang# Stack Protection for TA
36045507d10SKhoa HoangCFG_TA_STACK_PROTECTOR ?= n
36145507d10SKhoa HoangCFG_TA_STACK_PROTECTOR_STRONG ?= y
36245507d10SKhoa HoangCFG_TA_STACK_PROTECTOR_ALL ?= n
36345507d10SKhoa Hoang
36445507d10SKhoa Hoang_CFG_CORE_STACK_PROTECTOR := $(call cfg-one-enabled, CFG_CORE_STACK_PROTECTOR \
36545507d10SKhoa Hoang						     CFG_CORE_STACK_PROTECTOR_STRONG \
36645507d10SKhoa Hoang						     CFG_CORE_STACK_PROTECTOR_ALL)
36745507d10SKhoa Hoang_CFG_TA_STACK_PROTECTOR := $(call cfg-one-enabled, CFG_TA_STACK_PROTECTOR \
36845507d10SKhoa Hoang						   CFG_TA_STACK_PROTECTOR_STRONG \
36945507d10SKhoa Hoang						   CFG_TA_STACK_PROTECTOR_ALL)
37045507d10SKhoa Hoang
371ee664c19SJerome Forissier# Load user TAs from the REE filesystem via tee-supplicant
372ee664c19SJerome ForissierCFG_REE_FS_TA ?= y
373ee664c19SJerome Forissier
3747db24ad6SJerome Forissier# Pre-authentication of TA binaries loaded from the REE filesystem
3757db24ad6SJerome Forissier#
3767db24ad6SJerome Forissier# - If CFG_REE_FS_TA_BUFFERED=y: load TA binary into a temporary buffer in the
3777db24ad6SJerome Forissier#   "Secure DDR" pool, check the signature, then process the file only if it is
3787db24ad6SJerome Forissier#   valid.
3797db24ad6SJerome Forissier# - If disabled: hash the binaries as they are being processed and verify the
3807db24ad6SJerome Forissier#   signature as a last step.
381e6e68745SJerome ForissierCFG_REE_FS_TA_BUFFERED ?= n
3827db24ad6SJerome Forissier$(eval $(call cfg-depends-all,CFG_REE_FS_TA_BUFFERED,CFG_REE_FS_TA))
3837db24ad6SJerome Forissier
384623b9bd4SJens Wiklander# When CFG_REE_FS=y:
385300faa62SEtienne Carriere# Allow secure storage in the REE FS to be entirely deleted without causing
386300faa62SEtienne Carriere# anti-rollback errors. That is, rm /data/tee/dirf.db or rm -rf /data/tee (or
387300faa62SEtienne Carriere# whatever path is configured in tee-supplicant as CFG_TEE_FS_PARENT_PATH)
388300faa62SEtienne Carriere# can be used to reset the secure storage to a clean, empty state.
3893251835dSSumit Garg# Intended to be used for testing only since it weakens storage security.
3903251835dSSumit Garg# Warning: If enabled for release build then it will break rollback protection
3913251835dSSumit Garg# of TAs and the entire REE FS secure storage.
392300faa62SEtienne CarriereCFG_REE_FS_ALLOW_RESET ?= n
393300faa62SEtienne Carriere
394d0c63614SJerome Forissier# Support for loading user TAs from a special section in the TEE binary.
395d0c63614SJerome Forissier# Such TAs are available even before tee-supplicant is available (hence their
396d0c63614SJerome Forissier# name), but note that many services exported to TAs may need tee-supplicant,
397d0c63614SJerome Forissier# so early use is limited to a subset of the TEE Internal Core API (crypto...)
398d0c63614SJerome Forissier# To use this feature, set EARLY_TA_PATHS to the paths to one or more TA ELF
399d0c63614SJerome Forissier# file(s). For example:
400d0c63614SJerome Forissier#   $ make ... \
401d0c63614SJerome Forissier#     EARLY_TA_PATHS="path/to/8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf \
402d0c63614SJerome Forissier#                     path/to/cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.stripped.elf"
403d0c63614SJerome Forissier# Typical build steps:
404d0c63614SJerome Forissier#   $ make ta_dev_kit CFG_EARLY_TA=y # Create the dev kit (user mode libraries,
405d0c63614SJerome Forissier#                                    # headers, makefiles), ready to build TAs.
406d0c63614SJerome Forissier#                                    # CFG_EARLY_TA=y is optional, it prevents
407d0c63614SJerome Forissier#                                    # later library recompilations.
408d0c63614SJerome Forissier#   <build some TAs>
409d0c63614SJerome Forissier#   $ make EARLY_TA_PATHS=<paths>    # Build OP-TEE and embbed the TA(s)
4103638ea32SJens Wiklander#
4113638ea32SJens Wiklander# Another option is CFG_IN_TREE_EARLY_TAS which is used to point at
4123638ea32SJens Wiklander# in-tree TAs. CFG_IN_TREE_EARLY_TAS is formatted as:
4133638ea32SJens Wiklander# <name-of-ta>/<uuid>
4143638ea32SJens Wiklander# for instance avb/023f8f1a-292a-432b-8fc4-de8471358067
4153638ea32SJens Wiklanderifneq ($(EARLY_TA_PATHS)$(CFG_IN_TREE_EARLY_TAS),)
416d0c63614SJerome Forissier$(call force,CFG_EARLY_TA,y)
417d0c63614SJerome Forissierelse
418d0c63614SJerome ForissierCFG_EARLY_TA ?= n
419d0c63614SJerome Forissierendif
420dea46be3SJelle Sels
42105ee04a8SJelle Selsifeq ($(CFG_EARLY_TA),y)
42205ee04a8SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
42305ee04a8SJelle Selsendif
42405ee04a8SJelle Sels
425dea46be3SJelle Selsifneq ($(SP_PATHS),)
426dea46be3SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
427dea46be3SJelle Selselse
428dea46be3SJelle SelsCFG_SECURE_PARTITION ?= n
429dea46be3SJelle Selsendif
430dea46be3SJelle Sels
43105ee04a8SJelle Selsifeq ($(CFG_SECURE_PARTITION),y)
43205ee04a8SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
43305ee04a8SJelle Selsendif
43405ee04a8SJelle Sels
435dea46be3SJelle Selsifeq ($(CFG_EMBEDDED_TS),y)
436509a9802SJerome Forissier$(call force,CFG_ZLIB,y)
437509a9802SJerome Forissierendif
438d0c63614SJerome Forissier
439c082c54dSEtienne Carriere# By default the early TAs are compressed in the TEE binary, it is possible to
440c082c54dSEtienne Carriere# not compress them with CFG_EARLY_TA_COMPRESS=n
441c082c54dSEtienne CarriereCFG_EARLY_TA_COMPRESS ?= y
442c082c54dSEtienne Carriere
443a884c935SJens Wiklander# Enable paging, requires SRAM, can't be enabled by default
444a884c935SJens WiklanderCFG_WITH_PAGER ?= n
445a884c935SJens Wiklander
446b757e307SJens Wiklander# Use the pager for user TAs
447b757e307SJens WiklanderCFG_PAGED_USER_TA ?= $(CFG_WITH_PAGER)
448b757e307SJens Wiklander
449b757e307SJens Wiklander# If paging of user TAs, that is, R/W paging default to enable paging of
450b757e307SJens Wiklander# TAG and IV in order to reduce heap usage.
451b757e307SJens WiklanderCFG_CORE_PAGE_TAG_AND_IV ?= $(CFG_PAGED_USER_TA)
452b757e307SJens Wiklander
453ab0df69eSJerome Forissier# Runtime lock dependency checker: ensures that a proper locking hierarchy is
454ab0df69eSJerome Forissier# used in the TEE core when acquiring and releasing mutexes. Any violation will
455ab0df69eSJerome Forissier# cause a panic as soon as the invalid locking condition is detected. If
4562288b071SJerome Forissier# CFG_UNWIND and CFG_LOCKDEP_RECORD_STACK are both enabled, the algorithm
4572288b071SJerome Forissier# records the call stacks when locks are taken, and prints them when a
4582288b071SJerome Forissier# potential deadlock is found.
459ab0df69eSJerome Forissier# Expect a significant performance impact when enabling this.
460ab0df69eSJerome ForissierCFG_LOCKDEP ?= n
4612288b071SJerome ForissierCFG_LOCKDEP_RECORD_STACK ?= y
462ab0df69eSJerome Forissier
463bde8a250SJoakim Bech# BestFit algorithm in bget reduces the fragmentation of the heap when running
464ab0df69eSJerome Forissier# with the pager enabled or lockdep
465ab0df69eSJerome ForissierCFG_CORE_BGET_BESTFIT ?= $(call cfg-one-enabled, CFG_WITH_PAGER CFG_LOCKDEP)
466bde8a250SJoakim Bech
467be715239SJens Wiklander# Enable support for detected undefined behavior in C
4681d171f95SJens Wiklander# Uses a lot of memory, can't be enabled by default
469be715239SJens WiklanderCFG_CORE_SANITIZE_UNDEFINED ?= n
470949b0c0cSAleksandr IashchenkoCFG_TA_SANITIZE_UNDEFINED ?= n
471b908c675SJens Wiklander
4721d171f95SJens Wiklander# Enable Kernel Address sanitizer, has a huge performance impact, uses a
4731d171f95SJens Wiklander# lot of memory and need platform specific adaptations, can't be enabled by
4741d171f95SJens Wiklander# default
4751d171f95SJens WiklanderCFG_CORE_SANITIZE_KADDRESS ?= n
4761d171f95SJens Wiklander
47783d0edeeSJerome Forissierifeq (y-y,$(CFG_CORE_SANITIZE_KADDRESS)-$(CFG_CORE_ASLR))
47883d0edeeSJerome Forissier$(error CFG_CORE_SANITIZE_KADDRESS and CFG_CORE_ASLR are not compatible)
47983d0edeeSJerome Forissierendif
48083d0edeeSJerome Forissier
48135e770dfSJerome Forissier# Add stack guards before/after stacks and periodically check them
48235e770dfSJerome ForissierCFG_WITH_STACK_CANARIES ?= y
48335e770dfSJerome Forissier
484e2f03e07SJerome Forissier# Use compiler instrumentation to troubleshoot stack overflows.
485e2f03e07SJerome Forissier# When enabled, most C functions check the stack pointer against the current
486e2f03e07SJerome Forissier# stack limits on entry and panic immediately if it is out of range.
487e2f03e07SJerome ForissierCFG_CORE_DEBUG_CHECK_STACKS ?= n
488e2f03e07SJerome Forissier
489cca7b5ebSJorge Ramirez-Ortiz# Use when the default stack allocations are not sufficient.
490cca7b5ebSJorge Ramirez-OrtizCFG_STACK_THREAD_EXTRA ?= 0
491cca7b5ebSJorge Ramirez-OrtizCFG_STACK_TMP_EXTRA ?= 0
492cca7b5ebSJorge Ramirez-Ortiz
493b908c675SJens Wiklander# Device Tree support
494c95b9511SEtienne Carriere#
495c95b9511SEtienne Carriere# When CFG_DT is enabled core embeds the FDT library (libfdt) allowing
496c95b9511SEtienne Carriere# device tree blob (DTB) parsing from the core.
497c95b9511SEtienne Carriere#
498c95b9511SEtienne Carriere# When CFG_DT is enabled, the TEE _start function expects to find
499c95b9511SEtienne Carriere# the address of a DTB in register X2/R2 provided by the early boot stage
500c95b9511SEtienne Carriere# or value 0 if boot stage provides no DTB.
501c95b9511SEtienne Carriere#
5027c2317a7SGatien Chevallier# When CFG_EXTERNAL_DT is enabled, the external device tree ABI is implemented
5037c2317a7SGatien Chevallier# and the external device tree is expected to be used/modified. Its value
5047c2317a7SGatien Chevallier# defaults to CFG_DT.
5057c2317a7SGatien Chevallier#
506bf31bf10SImre Kis# When CFG_MAP_EXT_DT_SECURE is enabled the external device tree is expected to
507bf31bf10SImre Kis# be in the secure memory.
508bf31bf10SImre Kis#
509c95b9511SEtienne Carriere# When CFG_EMBED_DTB is enabled, CFG_EMBED_DTB_SOURCE_FILE shall define the
510c95b9511SEtienne Carriere# relative path of a DTS file located in core/arch/$(ARCH)/dts.
511c95b9511SEtienne Carriere# The DTS file is compiled into a DTB file which content is embedded in a
512c95b9511SEtienne Carriere# read-only section of the core.
513c95b9511SEtienne Carriereifneq ($(strip $(CFG_EMBED_DTB_SOURCE_FILE)),)
514c95b9511SEtienne CarriereCFG_EMBED_DTB ?= y
515c95b9511SEtienne Carriereendif
5163050ae8aSJens Wiklanderifeq ($(filter y,$(CFG_EMBED_DTB) $(CFG_CORE_SEL1_SPMC) $(CFG_CORE_SEL2_SPMC) \
5173050ae8aSJens Wiklander		 $(CFG_CORE_EL3_SPMC)),y)
518c95b9511SEtienne Carriere$(call force,CFG_DT,y)
519c95b9511SEtienne Carriereendif
520c95b9511SEtienne CarriereCFG_EMBED_DTB ?= n
521b908c675SJens WiklanderCFG_DT ?= n
5227c2317a7SGatien ChevallierCFG_EXTERNAL_DT ?= $(CFG_DT)
523bf31bf10SImre KisCFG_MAP_EXT_DT_SECURE ?= n
524bf31bf10SImre Kisifeq ($(CFG_MAP_EXT_DT_SECURE),y)
525bf31bf10SImre Kis$(call force,CFG_DT,y)
526bf31bf10SImre Kisendif
52776358becSJens Wiklander
528a1222502SRaymond Mao# This option enables OP-TEE to support boot arguments handover via Transfer
529a1222502SRaymond Mao# List defined in Firmware Handoff specification.
530397d66f8SRaymond Mao# Note: This is an experimental feature and incompatible ABI changes can be
531397d66f8SRaymond Mao# expected. It should be off by default until Firmware Handoff specification
532397d66f8SRaymond Mao# has a stable release.
533a1222502SRaymond Mao# This feature requires the support of Device Tree.
534a1222502SRaymond MaoCFG_TRANSFER_LIST ?= n
535a1222502SRaymond Mao
53676358becSJens Wiklander# Maximum size of the Device Tree Blob, has to be large enough to allow
53776358becSJens Wiklander# editing of the supplied DTB.
53876358becSJens WiklanderCFG_DTB_MAX_SIZE ?= 0x10000
5394d62e91aSVictor Chong
540578bc4feSEtienne Carriere# CFG_DT_CACHED_NODE_INFO, when enabled, parses the embedded DT at boot
541578bc4feSEtienne Carriere# time and caches some information to speed up retrieve of DT node data,
542578bc4feSEtienne Carriere# more specifically those for which libfdt parses the full DTB to find
543578bc4feSEtienne Carriere# the target node information.
544578bc4feSEtienne CarriereCFG_DT_CACHED_NODE_INFO ?= $(CFG_EMBED_DTB)
545578bc4feSEtienne Carriere$(eval $(call cfg-depends-all,CFG_DT_CACHED_NODE_INFO,CFG_EMBED_DTB))
546578bc4feSEtienne Carriere
547c36d2192SBalint Dobszay# Maximum size of the init info data passed to Secure Partitions.
548c36d2192SBalint DobszayCFG_SP_INIT_INFO_MAX_SIZE ?= 0x1000
549c36d2192SBalint Dobszay
5500a3ad9b6SBryan O'Donoghue# Device Tree Overlay support.
551c4544143SClément Léger# CFG_EXTERNAL_DTB_OVERLAY allows to append a DTB overlay into an existing
552c4544143SClément Léger# external DTB. The overlay is created when no valid DTB overlay is found.
553c4544143SClément Léger# CFG_GENERATE_DTB_OVERLAY allows to create a DTB overlay at external
554c4544143SClément Léger# DTB location.
555c4544143SClément Léger# External DTB location (physical address) is provided either by boot
556c4544143SClément Léger# argument arg2 or from CFG_DT_ADDR if defined.
557c4544143SClément Léger# A subsequent boot stage can then merge the generated overlay DTB into a main
5580a3ad9b6SBryan O'Donoghue# DTB using the standard fdt_overlay_apply() method.
5590a3ad9b6SBryan O'DonoghueCFG_EXTERNAL_DTB_OVERLAY ?= n
560c4544143SClément LégerCFG_GENERATE_DTB_OVERLAY ?= n
561c4544143SClément Léger
562c4544143SClément Légerifeq (y-y,$(CFG_EXTERNAL_DTB_OVERLAY)-$(CFG_GENERATE_DTB_OVERLAY))
563c4544143SClément Léger$(error CFG_EXTERNAL_DTB_OVERLAY and CFG_GENERATE_DTB_OVERLAY are exclusive)
564c4544143SClément Légerendif
565c4544143SClément Léger_CFG_USE_DTB_OVERLAY := $(call cfg-one-enabled,CFG_EXTERNAL_DTB_OVERLAY \
566c4544143SClément Léger			  CFG_GENERATE_DTB_OVERLAY)
5670a3ad9b6SBryan O'Donoghue
568313aa2a4SJens Wiklander# All embedded tests are supposed to be disabled by default, this flag
569313aa2a4SJens Wiklander# is used to control the default value of all other embedded tests
570313aa2a4SJens WiklanderCFG_ENABLE_EMBEDDED_TESTS ?= n
571313aa2a4SJens Wiklander
57235964dc9SEtienne Carriere# Enable core self tests and related pseudo TAs
573313aa2a4SJens WiklanderCFG_TEE_CORE_EMBED_INTERNAL_TESTS ?= $(CFG_ENABLE_EMBEDDED_TESTS)
57476d920d3SRaymond Mao# Embed transfer list support self test when enabled
57576d920d3SRaymond MaoCFG_TRANSFER_LIST_TEST ?= $(call cfg-all-enabled,CFG_TRANSFER_LIST \
57676d920d3SRaymond Mao			    CFG_TEE_CORE_EMBED_INTERNAL_TESTS)
5776d96f208Syanyan-wrs
57827e8d08dSJens Wiklander# Compiles bget_main_test() to be called from a test TA
57927e8d08dSJens WiklanderCFG_TA_BGET_TEST ?= $(CFG_ENABLE_EMBEDDED_TESTS)
58027e8d08dSJens Wiklander
5812c8bb257SThomas Perrot# CFG_DT_DRIVER_EMBEDDED_TEST when enabled embedded DT driver probing tests.
5822c8bb257SThomas Perrot# This also requires embedding a DTB with expected content.
5832c8bb257SThomas Perrot# Default disable CFG_DRIVERS_CLK_EARLY_PROBE to probe clocks as other drivers.
584d783b681SEtienne Carriere# A probe deferral test mandates CFG_DRIVERS_DT_RECURSIVE_PROBE=n.
585d783b681SEtienne CarriereCFG_DT_DRIVER_EMBEDDED_TEST ?= n
586d783b681SEtienne Carriereifeq ($(CFG_DT_DRIVER_EMBEDDED_TEST),y)
587d783b681SEtienne CarriereCFG_DRIVERS_CLK ?= y
5886e2fe64aSClément LégerCFG_DRIVERS_GPIO ?= y
589d783b681SEtienne CarriereCFG_DRIVERS_RSTCTRL ?= y
590d783b681SEtienne CarriereCFG_DRIVERS_CLK_EARLY_PROBE ?= n
591d783b681SEtienne Carriere$(call force,CFG_DRIVERS_DT_RECURSIVE_PROBE,n,Mandated by CFG_DT_DRIVER_EMBEDDED_TEST)
592d783b681SEtienne Carriereendif
593d783b681SEtienne Carriere
59449d026a9SEtienne Carriere# CFG_WITH_STATS when enabled embeds PTA statistics service to allow non-secure
59549d026a9SEtienne Carriere# clients to retrieve debug and statistics information on core and loaded TAs.
59649d026a9SEtienne CarriereCFG_WITH_STATS ?= n
59749d026a9SEtienne Carriere
5984101c34aSEtienne Carriere# CFG_DRIVERS_DT_RECURSIVE_PROBE when enabled forces a recursive subnode
5994101c34aSEtienne Carriere# parsing in the embedded DTB for driver probing. The alternative is
6004101c34aSEtienne Carriere# an exploration based on compatible drivers found. It is default disabled.
6014101c34aSEtienne CarriereCFG_DRIVERS_DT_RECURSIVE_PROBE ?= n
6024101c34aSEtienne Carriere
6036d96f208Syanyan-wrs# This option enables OP-TEE to respond to SMP boot request: the Rich OS
6046d96f208Syanyan-wrs# issues this to request OP-TEE to release secondaries cores out of reset,
6056d96f208Syanyan-wrs# with specific core number and non-secure entry address.
6066d96f208Syanyan-wrsCFG_BOOT_SECONDARY_REQUEST ?= n
6076d96f208Syanyan-wrs
608f5f914aaSJens Wiklander# Default heap size for Core, 64 kB
609f5f914aaSJens WiklanderCFG_CORE_HEAP_SIZE ?= 65536
610f3bb2312SJerome Forissier
611b76b2296SJerome Forissier# Default size of nexus heap. 16 kB. Used only if CFG_NS_VIRTUALIZATION
612386fc264SVolodymyr Babchuk# is enabled
613386fc264SVolodymyr BabchukCFG_CORE_NEX_HEAP_SIZE ?= 16384
614386fc264SVolodymyr Babchuk
615883c4be3SJerome Forissier# TA profiling.
616883c4be3SJerome Forissier# When this option is enabled, OP-TEE can execute Trusted Applications
617883c4be3SJerome Forissier# instrumented with GCC's -pg flag and will output profiling information
618883c4be3SJerome Forissier# in gmon.out format to /tmp/gmon-<ta_uuid>.out (path is defined in
619883c4be3SJerome Forissier# tee-supplicant)
6208800b01dSJerome Forissier# Note: this does not work well with shared libraries at the moment for a
6218800b01dSJerome Forissier# couple of reasons:
6228800b01dSJerome Forissier# 1. The profiling code assumes a unique executable section in the TA VA space.
6238800b01dSJerome Forissier# 2. The code used to detect at run time if the TA is intrumented assumes that
6248800b01dSJerome Forissier# the TA is linked statically.
625883c4be3SJerome ForissierCFG_TA_GPROF_SUPPORT ?= n
626f3bb2312SJerome Forissier
627b02ae382SSumit Garg# TA function tracing.
628b02ae382SSumit Garg# When this option is enabled, OP-TEE can execute Trusted Applications
629b02ae382SSumit Garg# instrumented with GCC's -pg flag and will output function tracing
6305c2c0fb3SJerome Forissier# information for all functions compiled with -pg to
6315c2c0fb3SJerome Forissier# /tmp/ftrace-<ta_uuid>.out (path is defined in tee-supplicant).
632099918f6SSumit GargCFG_FTRACE_SUPPORT ?= n
633b02ae382SSumit Garg
634099918f6SSumit Garg# Core syscall function tracing.
635099918f6SSumit Garg# When this option is enabled, OP-TEE core is instrumented with GCC's
636099918f6SSumit Garg# -pg flag and will output syscall function graph in user TA ftrace
637099918f6SSumit Garg# buffer
638099918f6SSumit GargCFG_SYSCALL_FTRACE ?= n
639099918f6SSumit Garg$(call cfg-depends-all,CFG_SYSCALL_FTRACE,CFG_FTRACE_SUPPORT)
640099918f6SSumit Garg
641883c4be3SJerome Forissier# Enable to compile user TA libraries with profiling (-pg).
642099918f6SSumit Garg# Depends on CFG_TA_GPROF_SUPPORT or CFG_FTRACE_SUPPORT.
643735565dbSSumit GargCFG_ULIBS_MCOUNT ?= n
6440f8adafeSJerome Forissier# Profiling/tracing of syscall wrapper (utee_*)
6450f8adafeSJerome ForissierCFG_SYSCALL_WRAPPERS_MCOUNT ?= $(CFG_ULIBS_MCOUNT)
646883c4be3SJerome Forissier
6470f8adafeSJerome Forissierifeq (y,$(filter y,$(CFG_ULIBS_MCOUNT) $(CFG_SYSCALL_WRAPPERS_MCOUNT)))
648099918f6SSumit Gargifeq (,$(filter y,$(CFG_TA_GPROF_SUPPORT) $(CFG_FTRACE_SUPPORT)))
649883c4be3SJerome Forissier$(error Cannot instrument user libraries if user mode profiling is disabled)
650f3bb2312SJerome Forissierendif
651f3bb2312SJerome Forissierendif
652cb0b5954SJens Wiklander
6537fb525f1SJerome Forissier# Build libutee, libutils, libmbedtls as shared libraries.
65464718c93SJerome Forissier# - Static libraries are still generated when this is enabled, but TAs will use
65564718c93SJerome Forissier# the shared libraries unless explicitly linked with the -static flag.
65664718c93SJerome Forissier# - Shared libraries are made of two files: for example, libutee is
65764718c93SJerome Forissier#   libutee.so and 527f1a47-b92c-4a74-95bd-72f19f4a6f74.ta. The '.so' file
65864718c93SJerome Forissier#   is a totally standard shared object, and should be used to link against.
65964718c93SJerome Forissier#   The '.ta' file is a signed version of the '.so' and should be installed
66064718c93SJerome Forissier#   in the same way as TAs so that they can be found at runtime.
66164718c93SJerome ForissierCFG_ULIBS_SHARED ?= n
66264718c93SJerome Forissier
66339ef71afSEtienne Carriereifeq (y-y,$(CFG_TA_GPROF_SUPPORT)-$(CFG_ULIBS_SHARED))
66470aa7511SJerome Forissier$(error CFG_TA_GPROF_SUPPORT and CFG_ULIBS_SHARED are currently incompatible)
66570aa7511SJerome Forissierendif
66670aa7511SJerome Forissier
667cb0b5954SJens Wiklander# CFG_GP_SOCKETS
668cb0b5954SJens Wiklander# Enable Global Platform Sockets support
669cb0b5954SJens WiklanderCFG_GP_SOCKETS ?= y
67080a4e51dSEtienne Carriere
67180a4e51dSEtienne Carriere# Enable Secure Data Path support in OP-TEE core (TA may be invoked with
67280a4e51dSEtienne Carriere# invocation parameters referring to specific secure memories).
67380a4e51dSEtienne CarriereCFG_SECURE_DATA_PATH ?= n
67400da26ecSAndrew F. Davis
675c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
676c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
677c9720143SJens Wiklander# metadata in secure storage.
678c9720143SJens WiklanderCFG_SECSTOR_TA ?= $(call cfg-all-enabled,CFG_REE_FS CFG_WITH_USER_TA)
679c9720143SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA,CFG_REE_FS CFG_WITH_USER_TA))
680c9720143SJens Wiklander
68130668b28SJens Wiklander# Enable the pseudo TA that managages TA storage in secure storage
68230668b28SJens WiklanderCFG_SECSTOR_TA_MGMT_PTA ?= $(call cfg-all-enabled,CFG_SECSTOR_TA)
68330668b28SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA_MGMT_PTA,CFG_SECSTOR_TA))
684c9720143SJens Wiklander
6854bca302aSIgor Opaniuk# Enable the pseudo TA for misc. auxilary services, extending existing
68657e642f1SEtienne Carriere# GlobalPlatform TEE Internal Core API (for example, re-seeding RNG entropy
68757e642f1SEtienne Carriere# pool etc...)
68857e642f1SEtienne CarriereCFG_SYSTEM_PTA ?= $(CFG_WITH_USER_TA)
68957e642f1SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SYSTEM_PTA,CFG_WITH_USER_TA))
6904bca302aSIgor Opaniuk
6910b611081SSumit Garg# Enable the pseudo TA for enumeration of TEE based devices for the normal
6920b611081SSumit Garg# world OS.
6930b611081SSumit GargCFG_DEVICE_ENUM_PTA ?= y
6940b611081SSumit Garg
6957e05ec25SJerome Forissier# The attestation pseudo TA provides an interface to request measurements of
6967e05ec25SJerome Forissier# a TA or the TEE binary.
6977e05ec25SJerome ForissierCFG_ATTESTATION_PTA ?= n
6987e05ec25SJerome Forissier$(eval $(call cfg-depends-all,CFG_ATTESTATION_PTA,_CFG_WITH_SECURE_STORAGE))
6997e05ec25SJerome Forissier
7007e05ec25SJerome Forissier# RSA key size (in bits) for the attestation PTA. Must be at least 528 given
7017e05ec25SJerome Forissier# other algorithm parameters (RSA PSS with SHA-256 and 32-byte salt), but
7027e05ec25SJerome Forissier# note that such a low value is not secure.
7037e05ec25SJerome Forissier# See https://tools.ietf.org/html/rfc8017#section-8.1.1 and
7047e05ec25SJerome Forissier# https://tools.ietf.org/html/rfc8017#section-9.1.1
7057e05ec25SJerome Forissier#  emLen >= hlen + sLen + 2 = 32 + 32 + 2 = 66
7067e05ec25SJerome Forissier#  emLen = ceil((modBits - 1) / 8) => emLen is the key size in bytes
7077e05ec25SJerome ForissierCFG_ATTESTATION_PTA_KEY_SIZE ?= 3072
7087e05ec25SJerome Forissier
70900da26ecSAndrew F. Davis# Define the number of cores per cluster used in calculating core position.
71000da26ecSAndrew F. Davis# The cluster number is shifted by this value and added to the core ID,
71100da26ecSAndrew F. Davis# so its value represents log2(cores/cluster).
71200da26ecSAndrew F. Davis# Default is 2**(2) = 4 cores per cluster.
71300da26ecSAndrew F. DavisCFG_CORE_CLUSTER_SHIFT ?= 2
714d81f93a7SVolodymyr Babchuk
7158be2de1aSImre Kis# Define the number of threads per core used in calculating processing
7168be2de1aSImre Kis# element's position. The core number is shifted by this value and added to
7178be2de1aSImre Kis# the thread ID, so its value represents log2(threads/core).
7188be2de1aSImre Kis# Default is 2**(0) = 1 threads per core.
7198be2de1aSImre KisCFG_CORE_THREAD_SHIFT ?= 0
7208be2de1aSImre Kis
72137a6b717SJens Wiklander# Enable support for dynamic shared memory (shared memory anywhere in
72237a6b717SJens Wiklander# non-secure memory).
72337a6b717SJens WiklanderCFG_CORE_DYN_SHM ?= y
72437a6b717SJens Wiklander
7258aeb6c94SJens Wiklander# Enable support for reserved shared memory (shared memory in a carved out
7268aeb6c94SJens Wiklander# memory area).
7278aeb6c94SJens WiklanderCFG_CORE_RESERVED_SHM ?= y
7288aeb6c94SJens Wiklander
729dd3afbacSJens Wiklander# Enables support for larger physical addresses, that is, it will define
730dd3afbacSJens Wiklander# paddr_t as a 64-bit type.
731dd3afbacSJens WiklanderCFG_CORE_LARGE_PHYS_ADDR ?= n
732e3458e03SJerome Forissier
733e3458e03SJerome Forissier# Define the maximum size, in bits, for big numbers in the Internal Core API
734e3458e03SJerome Forissier# Arithmetical functions. This does *not* influence the key size that may be
735e3458e03SJerome Forissier# manipulated through the Cryptographic API.
736e3458e03SJerome Forissier# Set this to a lower value to reduce the TA memory footprint.
737e3458e03SJerome ForissierCFG_TA_BIGNUM_MAX_BITS ?= 2048
738409d2ff0SJerome Forissier
7397fb525f1SJerome Forissier# Not used since libmpa was removed. Force the values to catch build scripts
7407fb525f1SJerome Forissier# that would set = n.
7417fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS_MPI,y)
7427fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS,y)
743a97bc4a0SJens Wiklander
744a97bc4a0SJens Wiklander# Compile the TA library mbedTLS with self test functions, the functions
745a97bc4a0SJens Wiklander# need to be called to test anything
746a97bc4a0SJens WiklanderCFG_TA_MBEDTLS_SELF_TEST ?= y
747017dfaf8SGabor Szekely
74868689d86SJens Wiklander# By default use tomcrypt as the main crypto lib providing an implementation
74968689d86SJens Wiklander# for the API in <crypto/crypto.h>
75068689d86SJens Wiklander# CFG_CRYPTOLIB_NAME is used as libname and
75168689d86SJens Wiklander# CFG_CRYPTOLIB_DIR is used as libdir when compiling the library
75277327d7aSEdison Ai#
75377327d7aSEdison Ai# It's also possible to configure to use mbedtls instead of tomcrypt.
75477327d7aSEdison Ai# Then the variables should be assigned as "CFG_CRYPTOLIB_NAME=mbedtls" and
75577327d7aSEdison Ai# "CFG_CRYPTOLIB_DIR=lib/libmbedtls" respectively.
75668689d86SJens WiklanderCFG_CRYPTOLIB_NAME ?= tomcrypt
75768689d86SJens WiklanderCFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt
75868689d86SJens Wiklander
7597fb525f1SJerome Forissier# Not used since libmpa was removed. Force the value to catch build scripts
7607fb525f1SJerome Forissier# that would set = n.
7617fb525f1SJerome Forissier$(call force,CFG_CORE_MBEDTLS_MPI,y)
7627fb525f1SJerome Forissier
7639bc42f66SEtienne Carriere# When enabled, CFG_NS_VIRTUALIZATION embeds support for virtualization in
7649bc42f66SEtienne Carriere# the non-secure world. OP-TEE will not work without a compatible hypervisor
7659bc42f66SEtienne Carriere# in the non-secure world if this option is enabled.
7669bc42f66SEtienne Carriere#
7679bc42f66SEtienne Carriere# CFG_VIRTUALIZATION served the same purpose as CFG_NS_VIRTUALIZATION but is
7689bc42f66SEtienne Carriere# deprecated as the configuration switch name was ambiguous regarding which
7699bc42f66SEtienne Carriere# world has virtualization enabled.
7709bc42f66SEtienne Carriereifneq (undefined,$(flavor CFG_VIRTUALIZATION))
7719bc42f66SEtienne Carriere$(info WARNING: CFG_VIRTUALIZATION is deprecated, use CFG_NS_VIRTUALIZATION instead)
772b76b2296SJerome ForissierCFG_NS_VIRTUALIZATION ?= $(CFG_VIRTUALIZATION)
7739bc42f66SEtienne Carriereifneq ($(CFG_NS_VIRTUALIZATION),$(CFG_VIRTUALIZATION))
7749bc42f66SEtienne Carriere$(error Inconsistent CFG_NS_VIRTUALIZATION=$(CFG_NS_VIRTUALIZATION) and CFG_VIRTUALIZATION=$(CFG_VIRTUALIZATION))
7759bc42f66SEtienne Carriereendif
7769bc42f66SEtienne Carriereendif # CFG_VIRTUALIZATION defined
777b76b2296SJerome ForissierCFG_NS_VIRTUALIZATION ?= n
77815216d4dSVolodymyr Babchuk
779b76b2296SJerome Forissierifeq ($(CFG_NS_VIRTUALIZATION),y)
78015216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RODATA_NOEXEC,y)
78115216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RWDATA_NOEXEC,y)
782c4e8be26SVolodymyr Babchuk
783c4e8be26SVolodymyr Babchuk# Default number of virtual guests
784c4e8be26SVolodymyr BabchukCFG_VIRT_GUEST_COUNT ?= 2
78515216d4dSVolodymyr Babchukendif
78615216d4dSVolodymyr Babchuk
78717888736SJens Wiklander# Enables backwards compatible derivation of RPMB and SSK keys
78817888736SJens WiklanderCFG_CORE_HUK_SUBKEY_COMPAT ?= y
789a2087649SJerome Forissier
79033b38f8cSRuslan Piasetskyi# Use SoC specific tee_otp_get_die_id() implementation for SSK key generation.
79133b38f8cSRuslan Piasetskyi# This option depends on CFG_CORE_HUK_SUBKEY_COMPAT=y.
79233b38f8cSRuslan PiasetskyiCFG_CORE_HUK_SUBKEY_COMPAT_USE_OTP_DIE_ID ?= n
79333b38f8cSRuslan Piasetskyi
794a2087649SJerome Forissier# Compress and encode conf.mk into the TEE core, and show the encoded string on
795a2087649SJerome Forissier# boot (with severity TRACE_INFO).
796a2087649SJerome ForissierCFG_SHOW_CONF_ON_BOOT ?= n
797dd333f03SJavier Almansa Sobrino
798dd333f03SJavier Almansa Sobrino# Enables support for passing a TPM Event Log stored in secure memory
799145035ffSImre Kis# to a TA or FF-A SP, so a TPM Service could use it to extend any measurement
800dd333f03SJavier Almansa Sobrino# taken before the service was up and running.
801dd333f03SJavier Almansa SobrinoCFG_CORE_TPM_EVENT_LOG ?= n
802ae8c8068SEtienne Carriere
803ae8c8068SEtienne Carriere# When enabled, CFG_SCMI_MSG_DRIVERS embeds SCMI message drivers in the core.
804ae8c8068SEtienne Carriere# Refer to the supported SCMI features embedded upon CFG_SCMI_MSG_*
80528e51326SEtienne Carriere#
806a7a9e3baSEtienne Carriere# CFG_SCMI_MSG_CLOCK embeds SCMI clock protocol support.
80756a1f10eSEtienne Carriere# CFG_SCMI_MSG_RESET_DOMAIN embeds SCMI reset domain protocol support.
80828e51326SEtienne Carriere# CFG_SCMI_MSG_SMT embeds a SMT header in shared device memory buffers
809f37af03eSEtienne Carriere# CFG_SCMI_MSG_VOLTAGE_DOMAIN embeds SCMI voltage domain protocol support.
810f1cec17aSPascal Paillet# CFG_SCMI_MSG_PERF_DOMAIN embeds SCMI performance domain management protocol
81128e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_FASTCALL_ENTRY embeds fastcall SMC entry with SMT memory
81228e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_INTERRUPT_ENTRY embeds interrupt entry with SMT memory
81328e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_THREAD_ENTRY embeds threaded entry with SMT memory
814916cc52aSEtienne Carriere# CFG_SCMI_MSG_SHM_MSG embeds a MSG header in cached shared memory buffer
815ae8c8068SEtienne CarriereCFG_SCMI_MSG_DRIVERS ?= n
81628e51326SEtienne Carriereifeq ($(CFG_SCMI_MSG_DRIVERS),y)
817a7a9e3baSEtienne CarriereCFG_SCMI_MSG_CLOCK ?= n
81856a1f10eSEtienne CarriereCFG_SCMI_MSG_RESET_DOMAIN ?= n
819916cc52aSEtienne CarriereCFG_SCMI_MSG_SHM_MSG ?= n
820a58c4d70SEtienne CarriereCFG_SCMI_MSG_SMT ?= n
82128e51326SEtienne CarriereCFG_SCMI_MSG_SMT_FASTCALL_ENTRY ?= n
82228e51326SEtienne CarriereCFG_SCMI_MSG_SMT_INTERRUPT_ENTRY ?= n
82328e51326SEtienne CarriereCFG_SCMI_MSG_SMT_THREAD_ENTRY ?= n
82428e51326SEtienne CarriereCFG_SCMI_MSG_THREAD_ENTRY ?= n
825f37af03eSEtienne CarriereCFG_SCMI_MSG_VOLTAGE_DOMAIN ?= n
826f1cec17aSPascal PailletCFG_SCMI_MSG_PERF_DOMAIN ?= n
82728e51326SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SCMI_MSG_SMT_FASTCALL_ENTRY,CFG_SCMI_MSG_SMT))
82828e51326SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SCMI_MSG_SMT_INTERRUPT_ENTRY,CFG_SCMI_MSG_SMT))
829916cc52aSEtienne Carriere$(eval $(call cfg-depends-one,CFG_SCMI_MSG_SMT_THREAD_ENTRY,CFG_SCMI_MSG_SMT CFG_SCMI_MSG_SHM_MSG))
83016a5030fSEtienne Carriereifeq ($(CFG_SCMI_MSG_SMT),y)
83116a5030fSEtienne Carriere_CFG_SCMI_PTA_SMT_HEADER := y
83216a5030fSEtienne Carriereendif
83316a5030fSEtienne Carriereifeq ($(CFG_SCMI_MSG_SHM_MSG),y)
83416a5030fSEtienne Carriere_CFG_SCMI_PTA_MSG_HEADER := y
83516a5030fSEtienne Carriereendif
83628e51326SEtienne Carriereendif
83742471ecfSJens Wiklander
8384c4212e9SVincent Guittot# CFG_SCMI_SCPFW, when enabled, embeds the reference SCMI server implementation
8394c4212e9SVincent Guittot# from SCP-firmware package as an built-in SCMI stack in core. This
8404c4212e9SVincent Guittot# configuration mandates target product identifier is configured with
8414c4212e9SVincent Guittot# CFG_SCMI_SCPFW_PRODUCT and the SCP-firmware source tree path with
8424c4212e9SVincent Guittot# CFG_SCP_FIRMWARE.
8434c4212e9SVincent GuittotCFG_SCMI_SCPFW ?= n
8444c4212e9SVincent Guittot
8454c4212e9SVincent Guittotifeq ($(CFG_SCMI_SCPFW),y)
8464c4212e9SVincent Guittot$(call force,CFG_SCMI_PTA,y,Required by CFG_SCMI_SCPFW)
8474c4212e9SVincent Guittotifeq (,$(CFG_SCMI_SCPFW_PRODUCT))
8484c4212e9SVincent Guittot$(error CFG_SCMI_SCPFW=y requires CFG_SCMI_SCPFW_PRODUCT configuration)
8494c4212e9SVincent Guittotendif
8504c4212e9SVincent Guittotifeq (,$(wildcard $(CFG_SCP_FIRMWARE)/CMakeLists.txt))
8514c4212e9SVincent Guittot$(error CFG_SCMI_SCPFW=y requires CFG_SCP_FIRMWARE configuration)
8524c4212e9SVincent Guittotendif
8534c4212e9SVincent Guittotendif #CFG_SCMI_SCPFW
8544c4212e9SVincent Guittot
855ce6ea411SValentin Caron# CFG_SCMI_SCPFW_FROM_DT, when enabled, calls scpfw_configure() function
856ce6ea411SValentin Caron# in SCP-firmware that will retrieve resources in "scmi" fdt node.
857ce6ea411SValentin CaronCFG_SCMI_SCPFW_FROM_DT ?= n
858ce6ea411SValentin Caron$(eval $(call cfg-depends-all,CFG_SCMI_SCPFW_FROM_DT,CFG_SCMI_SCPFW CFG_EMBED_DTB))
859ce6ea411SValentin Caron
8604c4212e9SVincent Guittotifeq ($(CFG_SCMI_MSG_DRIVERS)-$(CFG_SCMI_SCPFW),y-y)
8614c4212e9SVincent Guittot$(error CFG_SCMI_MSG_DRIVERS=y and CFG_SCMI_SCPFW=y are mutually exclusive)
8624c4212e9SVincent Guittotendif
8634c4212e9SVincent Guittot
864e80130f6SClément Léger# When enabled, CFG_SCMI_MSG_USE_CLK embeds SCMI clocks registering services for
865e80130f6SClément Léger# the platform SCMI server and implements the platform plat_scmi_clock_*()
866e80130f6SClément Léger# functions.
867e80130f6SClément LégerCFG_SCMI_MSG_USE_CLK ?= n
868e80130f6SClément Léger$(eval $(call cfg-depends-all,CFG_SCMI_MSG_USE_CLK,CFG_DRIVERS_CLK CFG_SCMI_MSG_DRIVERS))
869e80130f6SClément Léger
870b0a1c250SEtienne Carriere# Enable SCMI PTA interface for REE SCMI agents
871b0a1c250SEtienne CarriereCFG_SCMI_PTA ?= n
87216a5030fSEtienne Carriereifeq ($(CFG_SCMI_PTA),y)
87316a5030fSEtienne Carriere_CFG_SCMI_PTA_SMT_HEADER ?= n
87416a5030fSEtienne Carriere_CFG_SCMI_PTA_MSG_HEADER ?= n
87516a5030fSEtienne Carriereendif
876b0a1c250SEtienne Carriere
87742471ecfSJens Wiklanderifneq ($(CFG_STMM_PATH),)
878f9cd31c5SJelle Sels$(call force,CFG_WITH_STMM_SP,y)
879aa6d7fc3SLevi Yun$(call force,CFG_EFILIB,y)
88042471ecfSJens Wiklanderelse
881f9cd31c5SJelle SelsCFG_WITH_STMM_SP ?= n
88242471ecfSJens Wiklanderendif
883f9cd31c5SJelle Selsifeq ($(CFG_WITH_STMM_SP),y)
88442471ecfSJens Wiklander$(call force,CFG_ZLIB,y)
88542471ecfSJens Wiklanderendif
8866915bbbbSJens Wiklander
8876915bbbbSJens Wiklander# When enabled checks that buffers passed to the GP Internal Core API
8886915bbbbSJens Wiklander# comply with the rules added as annotations as part of the definition of
8896915bbbbSJens Wiklander# the API. For example preventing buffers in non-secure shared memory when
8906915bbbbSJens Wiklander# not allowed.
8916915bbbbSJens WiklanderCFG_TA_STRICT_ANNOTATION_CHECKS ?= y
892c56cc686SJens Wiklander
893c56cc686SJens Wiklander# When enabled accepts the DES key sizes excluding parity bits as in
894c56cc686SJens Wiklander# the GP Internal API Specification v1.0
895c56cc686SJens WiklanderCFG_COMPAT_GP10_DES ?= y
896806a85faSJens Wiklander
897806a85faSJens Wiklander# Defines a limit for many levels TAs may call each others.
898806a85faSJens WiklanderCFG_CORE_MAX_SYSCALL_RECURSION ?= 4
899f2dad489SSergiy Kibrik
900f2dad489SSergiy Kibrik# Pseudo-TA to export hardware RNG output to Normal World
901f2dad489SSergiy Kibrik# RNG characteristics are platform specific
902f2dad489SSergiy KibrikCFG_HWRNG_PTA ?= n
903f2dad489SSergiy Kibrikifeq ($(CFG_HWRNG_PTA),y)
904f2dad489SSergiy Kibrik# Output rate of hw_get_random_bytes() in bytes per second, 0: not rate-limited
905f2dad489SSergiy KibrikCFG_HWRNG_RATE ?= 0
906f2dad489SSergiy Kibrik# Quality/entropy of hw_get_random_bytes() per 1024 bits of output data, in bits
907f2dad489SSergiy Kibrikifeq (,$(CFG_HWRNG_QUALITY))
908f2dad489SSergiy Kibrik$(error CFG_HWRNG_QUALITY not defined)
909f2dad489SSergiy Kibrikendif
910f2dad489SSergiy Kibrikendif
91188876632SEtienne Carriere
91288876632SEtienne Carriere# CFG_PREALLOC_RPC_CACHE, when enabled, makes core to preallocate
91388876632SEtienne Carriere# shared memory for each secure thread. When disabled, RPC shared
91488876632SEtienne Carriere# memory is released once the secure thread has completed is execution.
91588876632SEtienne Carriereifeq ($(CFG_WITH_PAGER),y)
91688876632SEtienne CarriereCFG_PREALLOC_RPC_CACHE ?= n
91788876632SEtienne Carriereendif
91888876632SEtienne CarriereCFG_PREALLOC_RPC_CACHE ?= y
9192305544bSClément Léger
9202305544bSClément Léger# When enabled, CFG_DRIVERS_CLK embeds a clock framework in OP-TEE core.
9212305544bSClément Léger# This clock framework allows to describe clock tree and provides functions to
9222305544bSClément Léger# get and configure the clocks.
923dbe94a85SClément Léger# CFG_DRIVERS_CLK_DT embeds devicetree clock parsing support
924804e32d7SClément Léger# CFG_DRIVERS_CLK_FIXED add support for "fixed-clock" compatible clocks
92517fd9102SEtienne Carriere# CFG_DRIVERS_CLK_EARLY_PROBE makes clocks probed at early_init initcall level.
926cd04d138SEtienne Carriere# CFG_DRIVERS_CLK_PRINT_TREE embeds a helper function to print the clock tree
9276226e120SPascal Paillet# state on OP-TEE core console with the info trace level.
9282305544bSClément LégerCFG_DRIVERS_CLK ?= n
929dbe94a85SClément LégerCFG_DRIVERS_CLK_DT ?= $(call cfg-all-enabled,CFG_DRIVERS_CLK CFG_DT)
930804e32d7SClément LégerCFG_DRIVERS_CLK_FIXED ?= $(CFG_DRIVERS_CLK_DT)
93117fd9102SEtienne CarriereCFG_DRIVERS_CLK_EARLY_PROBE ?= $(CFG_DRIVERS_CLK_DT)
932cd04d138SEtienne CarriereCFG_DRIVERS_CLK_PRINT_TREE ?= n
933dbe94a85SClément Léger
934d547c99aSEtienne Carriere$(eval $(call cfg-depends-all,CFG_DRIVERS_CLK_DT,CFG_DRIVERS_CLK CFG_DT))
935d547c99aSEtienne Carriere$(eval $(call cfg-depends-all,CFG_DRIVERS_CLK_FIXED,CFG_DRIVERS_CLK_DT))
936d547c99aSEtienne Carriere
937c78b2c66SEtienne Carriere# When enabled, CFG_DRIVERS_RSTCTRL embeds a reset controller framework in
938c78b2c66SEtienne Carriere# OP-TEE core to provide reset controls on subsystems of the devices.
939c78b2c66SEtienne CarriereCFG_DRIVERS_RSTCTRL ?= n
940c78b2c66SEtienne Carriere
9414fc179b6SThomas Perrot# When enabled, CFG_DRIVERS_GPIO embeds a GPIO controller framework in
9424fc179b6SThomas Perrot# OP-TEE core to provide GPIO support for drivers.
9434fc179b6SThomas PerrotCFG_DRIVERS_GPIO ?= n
9444fc179b6SThomas Perrot
9458bc9c9e2SClément Léger# When enabled, CFG_DRIVERS_I2C provides I2C controller and devices support.
9468bc9c9e2SClément LégerCFG_DRIVERS_I2C ?= n
9478bc9c9e2SClément Léger
948515c1ba9SClément Léger# When enabled, CFG_DRIVERS_NVMEM provides a framework to register nvmem
949515c1ba9SClément Léger# providers and allow consumer drivers to get NVMEM cells using the Device Tree.
950515c1ba9SClément LégerCFG_DRIVERS_NVMEM ?= n
951515c1ba9SClément Léger
9529aec039eSClément Léger# When enabled, CFG_DRIVERS_PINCTRL embeds a pin muxing controller framework in
9539aec039eSClément Léger# OP-TEE core to provide drivers a way to apply pin muxing configurations based
9549aec039eSClément Léger# on device-tree.
9559aec039eSClément LégerCFG_DRIVERS_PINCTRL ?= n
9569aec039eSClément Léger
9571a3d3273SEtienne Carriere# When enabled, CFG_DRIVERS_REGULATOR embeds a voltage regulator framework in
9586558b565SEtienne Carriere# OP-TEE core to provide drivers a common regulator interface and describe
9596558b565SEtienne Carriere# the regulators dependencies using an embedded device tree.
960652d2ce7SEtienne Carriere#
961652d2ce7SEtienne Carriere# When enabled, CFG_REGULATOR_FIXED embeds a voltage regulator driver for
962652d2ce7SEtienne Carriere# DT compatible "regulator-fixed" devices.
963f164f0f8SEtienne Carriere#
964f164f0f8SEtienne Carriere# When enabled, CFG_REGULATOR_GPIO embeds a voltage regulator driver for
965f164f0f8SEtienne Carriere# DT compatible "regulator-gpio" devices.
966c4292779SEtienne Carriere#
967c4292779SEtienne Carriere# CFG_DRIVERS_REGULATOR_PRINT_TREE embeds a helper function to print the
968c4292779SEtienne Carriere# regulator tree state on OP-TEE core console with the info trace level.
9691a3d3273SEtienne CarriereCFG_DRIVERS_REGULATOR ?= n
970c4292779SEtienne CarriereCFG_DRIVERS_REGULATOR_PRINT_TREE ?= n
971652d2ce7SEtienne CarriereCFG_REGULATOR_FIXED ?= n
972f164f0f8SEtienne CarriereCFG_REGULATOR_GPIO ?= n
973652d2ce7SEtienne Carriere
974652d2ce7SEtienne Carriere$(eval $(call cfg-enable-all-depends,CFG_REGULATOR_FIXED, \
975652d2ce7SEtienne Carriere	 CFG_DRIVERS_REGULATOR CFG_DT))
976f164f0f8SEtienne Carriere$(eval $(call cfg-enable-all-depends,CFG_REGULATOR_GPIO, \
977f164f0f8SEtienne Carriere	 CFG_DRIVERS_REGULATOR CFG_DT CFG_DRIVERS_GPIO))
9781a3d3273SEtienne Carriere
9799ea709a7SEtienne Carriere# When enabled, CFG_INSECURE permits insecure configuration of OP-TEE core
9809ea709a7SEtienne Carriere# and shows a print (info level) when booting up the device that
9819ea709a7SEtienne Carriere# indicates that the board runs a standard developer configuration.
9829ea709a7SEtienne Carriere#
9839ea709a7SEtienne Carriere# A developer configuration doesn't necessarily have to be secure. The intention
9849e42008dSJoakim Bech# is that the one making products based on OP-TEE should override this flag in
9859e42008dSJoakim Bech# plat-xxx/conf.mk for the platform they're basing their products on after
9869e42008dSJoakim Bech# they've finalized implementing stubbed functionality (see OP-TEE
9879e42008dSJoakim Bech# documentation/Porting guidelines) as well as vendor specific security
9889e42008dSJoakim Bech# configuration.
9899ea709a7SEtienne Carriere#
9909ea709a7SEtienne Carriere# CFG_WARN_INSECURE served the same purpose as CFG_INSECURE but is deprecated.
9919ea709a7SEtienne Carriereifneq (undefined,$(flavor CFG_WARN_INSECURE))
9929ea709a7SEtienne Carriere$(info WARNING: CFG_WARN_INSECURE is deprecated, use CFG_INSECURE instead)
9939ea709a7SEtienne CarriereCFG_INSECURE ?= $(CFG_WARN_INSECURE)
9949ea709a7SEtienne Carriereifneq ($(CFG_INSECURE),$(CFG_WARN_INSECURE))
9959ea709a7SEtienne Carriere$(error Inconsistent CFG_INSECURE=$(CFG_INSECURE) and CFG_WARN_INSECURE=$(CFG_WARN_INSECURE))
9969ea709a7SEtienne Carriereendif
9979ea709a7SEtienne Carriereendif # CFG_WARN_INSECURE defined
9989ea709a7SEtienne CarriereCFG_INSECURE ?= y
9999e42008dSJoakim Bech
100072f437a7SJens Wiklanderifneq ($(CFG_INSECURE),y)
100172f437a7SJens Wiklanderifneq ($(CFG_CORE_ASLR_SEED),)
100272f437a7SJens Wiklander$(error CFG_CORE_ASLR_SEED requires CFG_INSECURE=y)
100372f437a7SJens Wiklanderendif
100472f437a7SJens Wiklanderendif
100572f437a7SJens Wiklander
1006a748f9edSJens Wiklander# Enables warnings for declarations mixed with statements
1007a748f9edSJens WiklanderCFG_WARN_DECL_AFTER_STATEMENT ?= y
1008b7a623f8SRuchika Gupta
1009b7a623f8SRuchika Gupta# Branch Target Identification (part of the ARMv8.5 Extensions) provides a
1010b7a623f8SRuchika Gupta# mechanism to limit the set of locations to which computed branch instructions
1011b7a623f8SRuchika Gupta# such as BR or BLR can jump. To make use of BTI in TEE core and ldelf on CPU's
1012b7a623f8SRuchika Gupta# that support it, enable this option. A GCC toolchain built with
1013b7a623f8SRuchika Gupta# --enable-standard-branch-protection is needed to use this option.
1014b7a623f8SRuchika GuptaCFG_CORE_BTI ?= n
1015b7a623f8SRuchika Gupta
1016b7a623f8SRuchika Gupta$(eval $(call cfg-depends-all,CFG_CORE_BTI,CFG_ARM64_core))
1017b7a623f8SRuchika Gupta
1018b7a623f8SRuchika Gupta# To make use of BTI in user space libraries and TA's on CPU's that support it,
1019b7a623f8SRuchika Gupta# enable this option.
1020b7a623f8SRuchika GuptaCFG_TA_BTI ?= $(CFG_CORE_BTI)
1021b7a623f8SRuchika Gupta
1022b7a623f8SRuchika Gupta$(eval $(call cfg-depends-all,CFG_TA_BTI,CFG_ARM64_core))
1023b7a623f8SRuchika Gupta
1024b76b2296SJerome Forissierifeq (y-y,$(CFG_NS_VIRTUALIZATION)-$(call cfg-one-enabled, CFG_TA_BTI CFG_CORE_BTI))
1025b76b2296SJerome Forissier$(error CFG_NS_VIRTUALIZATION and BTI are currently incompatible)
1026b7a623f8SRuchika Guptaendif
1027b7a623f8SRuchika Gupta
1028b7a623f8SRuchika Guptaifeq (y-y,$(CFG_PAGED_USER_TA)-$(CFG_TA_BTI))
1029b7a623f8SRuchika Gupta$(error CFG_PAGED_USER_TA and CFG_TA_BTI are currently incompatible)
1030b7a623f8SRuchika Guptaendif
1031c2d44948SJens Wiklander
1032a0e8ffe9SJens Wiklander# Memory Tagging Extension (part of the ARMv8.5 Extensions) implements lock
1033a0e8ffe9SJens Wiklander# and key access to memory. This is a hardware supported alternative to
1034a0e8ffe9SJens Wiklander# CFG_CORE_SANITIZE_KADDRESS which covers both S-EL1 and S-EL0.
1035a0e8ffe9SJens WiklanderCFG_MEMTAG ?= n
1036a0e8ffe9SJens Wiklander
1037a0e8ffe9SJens Wiklander$(eval $(call cfg-depends-all,CFG_MEMTAG,CFG_ARM64_core))
1038a0e8ffe9SJens Wiklanderifeq (y-y,$(CFG_CORE_SANITIZE_KADDRESS)-$(CFG_MEMTAG))
1039a0e8ffe9SJens Wiklander$(error CFG_CORE_SANITIZE_KADDRESS and CFG_MEMTAG are not compatible)
1040a0e8ffe9SJens Wiklanderendif
1041a0e8ffe9SJens Wiklanderifeq (y-y,$(CFG_WITH_PAGER)-$(CFG_MEMTAG))
1042a0e8ffe9SJens Wiklander$(error CFG_WITH_PAGER and CFG_MEMTAG are not compatible)
1043a0e8ffe9SJens Wiklanderendif
1044a0e8ffe9SJens Wiklander
10456fa59c9aSSeonghyun Park# Privileged Access Never (PAN, part of the ARMv8.1 Extensions) can be
10466fa59c9aSSeonghyun Park# used to restrict accesses to unprivileged memory from privileged mode.
10473db1b3e3SAlvin Chang# For RISC-V architecture, CSR {m|s}status.SUM bit is used to implement PAN.
10486fa59c9aSSeonghyun ParkCFG_PAN ?= n
10496fa59c9aSSeonghyun Park
10503db1b3e3SAlvin Chang$(eval $(call cfg-depends-one,CFG_PAN,CFG_ARM64_core CFG_RV64_core CFG_RV32_core))
10516fa59c9aSSeonghyun Park
10522e02a737SJens Wiklanderifeq ($(filter y, $(CFG_CORE_SEL1_SPMC) $(CFG_CORE_SEL2_SPMC) \
10532e02a737SJens Wiklander		  $(CFG_CORE_EL3_SPMC)),y)
10542e02a737SJens Wiklander# FF-A case, handled via the FF-A ABI
10552e02a737SJens WiklanderCFG_CORE_ASYNC_NOTIF ?= y
10562e02a737SJens Wiklander$(call force,_CFG_CORE_ASYNC_NOTIF_DEFAULT_IMPL,n)
10572e02a737SJens Wiklanderelse
105823419643SEtienne Carriere# CFG_CORE_ASYNC_NOTIF is defined by the platform to enable support
10592e02a737SJens Wiklander# for sending asynchronous notifications to normal world.
10602e02a737SJens Wiklander# Interrupt ID must be configurged by the platform too. Currently is only
1061c2d44948SJens Wiklander# CFG_CORE_ASYNC_NOTIF_GIC_INTID defined.
1062c2d44948SJens WiklanderCFG_CORE_ASYNC_NOTIF ?= n
10632e02a737SJens Wiklander$(call force,_CFG_CORE_ASYNC_NOTIF_DEFAULT_IMPL,$(CFG_CORE_ASYNC_NOTIF))
10642e02a737SJens Wiklanderendif
1065a51d45b5SJens Wiklander
1066e9e263e8SJens Wiklanderifeq ($(CFG_CORE_SEL2_SPMC),y)
106782a84a88SJens Wiklander# Callout by default disabled for SPMC at S-EL2 since Hafnium may crash,
106882a84a88SJens Wiklander# but allow it to be overridden for testing
106982a84a88SJens WiklanderCFG_CALLOUT ?= n
107082a84a88SJens Wiklanderelse
107182631bd4SJens Wiklander# Enable callout service
107282631bd4SJens WiklanderCFG_CALLOUT ?= $(CFG_CORE_ASYNC_NOTIF)
107382a84a88SJens Wiklanderendif
107482631bd4SJens Wiklander
10753844bc98SJens Wiklander# Enable notification based test watchdog
107600b45463SJerome ForissierCFG_NOTIF_TEST_WD ?= $(call cfg-all-enabled,CFG_ENABLE_EMBEDDED_TESTS \
107700b45463SJerome Forissier		       CFG_CALLOUT CFG_CORE_ASYNC_NOTIF)
10783844bc98SJens Wiklander$(eval $(call cfg-depends-all,CFG_NOTIF_TEST_WD,CFG_CALLOUT \
10793844bc98SJens Wiklander	 CFG_CORE_ASYNC_NOTIF))
10803844bc98SJens Wiklander
1081a51d45b5SJens Wiklander$(eval $(call cfg-enable-all-depends,CFG_MEMPOOL_REPORT_LAST_OFFSET, \
1082a51d45b5SJens Wiklander	 CFG_WITH_STATS))
1083bb329115SRuchika Gupta
108493dc6b29SJens Wiklander# Pointer Authentication (part of ARMv8.3 Extensions) provides instructions
108593dc6b29SJens Wiklander# for signing and authenticating pointers against secret keys. These can
108693dc6b29SJens Wiklander# be used to mitigate ROP (Return oriented programming) attacks. This is
108793dc6b29SJens Wiklander# currently done by instructing the compiler to add paciasp/autiasp at the
108893dc6b29SJens Wiklander# begging and end of functions to sign and verify ELR.
108993dc6b29SJens Wiklander#
109093dc6b29SJens Wiklander# The CFG_CORE_PAUTH enables these instructions for the core parts
109193dc6b29SJens Wiklander# executing at EL1, with one secret key per thread and one secret key per
109293dc6b29SJens Wiklander# physical CPU.
109393dc6b29SJens Wiklander#
109493dc6b29SJens Wiklander# The CFG_TA_PAUTH option enables these instructions for TA's at EL0. When
109593dc6b29SJens Wiklander# this option is enabled, TEE core will initialize secret keys per TA.
109693dc6b29SJens WiklanderCFG_CORE_PAUTH ?= n
109793dc6b29SJens WiklanderCFG_TA_PAUTH ?= $(CFG_CORE_PAUTH)
1098bb329115SRuchika Gupta
109993dc6b29SJens Wiklander$(eval $(call cfg-depends-all,CFG_CORE_PAUTH,CFG_ARM64_core))
1100bb329115SRuchika Gupta$(eval $(call cfg-depends-all,CFG_TA_PAUTH,CFG_ARM64_core))
11016b35a0abSRuchika Gupta
1102b76b2296SJerome Forissierifeq (y-y,$(CFG_NS_VIRTUALIZATION)-$(CFG_CORE_PAUTH))
1103b76b2296SJerome Forissier$(error CFG_NS_VIRTUALIZATION and CFG_CORE_PAUTH are currently incompatible)
110493dc6b29SJens Wiklanderendif
1105b76b2296SJerome Forissierifeq (y-y,$(CFG_NS_VIRTUALIZATION)-$(CFG_TA_PAUTH))
1106b76b2296SJerome Forissier$(error CFG_NS_VIRTUALIZATION and CFG_TA_PAUTH are currently incompatible)
11076b35a0abSRuchika Guptaendif
11086b35a0abSRuchika Gupta
11096b35a0abSRuchika Guptaifeq (y-y,$(CFG_TA_GPROF_SUPPORT)-$(CFG_TA_PAUTH))
11106b35a0abSRuchika Gupta$(error CFG_TA_GPROF_SUPPORT and CFG_TA_PAUTH are currently incompatible)
11116b35a0abSRuchika Guptaendif
11126b35a0abSRuchika Gupta
11136b35a0abSRuchika Guptaifeq (y-y,$(CFG_FTRACE_SUPPORT)-$(CFG_TA_PAUTH))
11146b35a0abSRuchika Gupta$(error CFG_FTRACE_SUPPORT and CFG_TA_PAUTH are currently incompatible)
11156b35a0abSRuchika Guptaendif
1116011a8f96SClément Léger
1117011a8f96SClément Léger# Enable support for generic watchdog registration
1118011a8f96SClément Léger# This watchdog will then be usable by non-secure world through SMC calls.
1119011a8f96SClément LégerCFG_WDT ?= n
1120cb60bce4SClément Léger
1121cb60bce4SClément Léger# Enable watchdog SMC handling compatible with arm-smc-wdt Linux driver
1122cb60bce4SClément LégerCFG_WDT_SM_HANDLER ?= n
1123cb60bce4SClément Léger
1124cb60bce4SClément Léger$(eval $(call cfg-enable-all-depends,CFG_WDT_SM_HANDLER,CFG_WDT))
11257d3ac186SLionel Debieve
11267d3ac186SLionel Debieve# When CFG_WDT_SM_HANDLER=y, SMC function ID 0x82003D06 default implements
11277d3ac186SLionel Debieve# arm-smc-wdt service. Platform can also override this ID with a platform
11287d3ac186SLionel Debieve# specific SMC function ID to access arm-smc-wdt service thanks to
11297d3ac186SLionel Debieve# optional config switch CFG_WDT_SM_HANDLER_ID.
11307d3ac186SLionel DebieveCFG_WDT_SM_HANDLER_ID ?= 0x82003D06
113134d244bfSClément Léger
113234d244bfSClément Léger# Allow using the udelay/mdelay function for platforms without ARM generic timer
113334d244bfSClément Léger# extension. When set to 'n', the plat_get_freq() function must be defined by
113434d244bfSClément Léger# the platform code
113534d244bfSClément LégerCFG_CORE_HAS_GENERIC_TIMER ?= y
1136f3f9432fSClément Léger
1137f3f9432fSClément Léger# Enable RTC API
1138f3f9432fSClément LégerCFG_DRIVERS_RTC ?= n
1139cea1eb0bSClément Léger
1140cea1eb0bSClément Léger# Enable PTA for RTC access from non-secure world
1141cea1eb0bSClément LégerCFG_RTC_PTA ?= n
1142952f5260SRuchika Gupta
11431fdb1c4fSJelle Sels# Enable the FF-A SPMC tests in xtests
11441fdb1c4fSJelle SelsCFG_SPMC_TESTS ?= n
1145bfdeae23SJens Wiklander
1146bfdeae23SJens Wiklander# Allocate the translation tables needed to map the S-EL0 application
1147bfdeae23SJens Wiklander# loaded
1148bfdeae23SJens WiklanderCFG_CORE_PREALLOC_EL0_TBLS ?= n
1149bfdeae23SJens Wiklanderifeq (y-y,$(CFG_CORE_PREALLOC_EL0_TBLS)-$(CFG_WITH_PAGER))
1150bfdeae23SJens Wiklander$(error "CFG_WITH_PAGER can't support CFG_CORE_PREALLOC_EL0_TBLS")
1151bfdeae23SJens Wiklanderendif
1152cb94c145SWeizhao Jiang
1153f15052a2SEtienne Carriere# CFG_PGT_CACHE_ENTRIES defines the number of entries on the memory
1154f15052a2SEtienne Carriere# mapping page table cache used for Trusted Application mapping.
1155f15052a2SEtienne Carriere# CFG_PGT_CACHE_ENTRIES is ignored when CFG_CORE_PREALLOC_EL0_TBLS
1156f15052a2SEtienne Carriere# is enabled.
1157f15052a2SEtienne Carriere#
1158f15052a2SEtienne Carriere# A proper value for CFG_PGT_CACHE_ENTRIES depends on many factors:
1159f15052a2SEtienne Carriere# CFG_WITH_LPAE, CFG_TA_ASLR, size of TAs, size of memrefs passed
1160f15052a2SEtienne Carriere# to TA, CFG_ULIBS_SHARED and possibly others. The default value
1161f15052a2SEtienne Carriere# is based on the number of threads as an indicator on how large
1162f15052a2SEtienne Carriere# the system might be.
1163f15052a2SEtienne Carriereifeq ($(CFG_NUM_THREADS),1)
1164f15052a2SEtienne CarriereCFG_PGT_CACHE_ENTRIES ?= 4
1165f15052a2SEtienne Carriereendif
1166f15052a2SEtienne Carriereifeq ($(CFG_NUM_THREADS),2)
1167f15052a2SEtienne Carriereifneq ($(CFG_WITH_LPAE),y)
1168f15052a2SEtienne CarriereCFG_PGT_CACHE_ENTRIES ?= 8
1169f15052a2SEtienne Carriereendif
1170f15052a2SEtienne Carriereendif
1171f15052a2SEtienne CarriereCFG_PGT_CACHE_ENTRIES ?= ($(CFG_NUM_THREADS) * 2)
1172f15052a2SEtienne Carriere
1173cb94c145SWeizhao Jiang# User TA runtime context dump.
1174cb94c145SWeizhao Jiang# When this option is enabled, OP-TEE provides a debug method for
1175cb94c145SWeizhao Jiang# developer to dump user TA's runtime context, including TA's heap stats.
1176cb94c145SWeizhao Jiang# Developer can open a stats PTA session and then invoke command
1177cb94c145SWeizhao Jiang# STATS_CMD_TA_STATS to get the context of loaded TAs.
1178cb94c145SWeizhao JiangCFG_TA_STATS ?= n
11797e75ca54SJens Wiklander
11807e75ca54SJens Wiklander# Enables best effort mitigations against fault injected when the hardware
11817e75ca54SJens Wiklander# is tampered with. Details in lib/libutils/ext/include/fault_mitigation.h
11827e75ca54SJens WiklanderCFG_FAULT_MITIGATION ?= y
11838bbc2e9cSJens Wiklander
1184c7f1b4f7SJens Wiklander# Enables TEE Internal Core API v1.1 compatibility for in-tree TAs. Note
1185c7f1b4f7SJens Wiklander# that this doesn't affect libutee itself, it's only the TAs compiled with
1186c7f1b4f7SJens Wiklander# this set that are affected. Each out-of-tree must set this if to enable
1187c7f1b4f7SJens Wiklander# compatibility with version v1.1 as the value of this variable is not
1188c7f1b4f7SJens Wiklander# preserved in the TA dev-kit.
1189c7f1b4f7SJens WiklanderCFG_TA_OPTEE_CORE_API_COMPAT_1_1 ?= n
11903d70a974SIgor Opaniuk
11913d70a974SIgor Opaniuk# Change supported HMAC key size range, from 64 to 1024.
11923d70a974SIgor Opaniuk# This is needed to pass AOSP Keymaster VTS tests:
11933d70a974SIgor Opaniuk#   Link to tests : https://android.googlesource.com/platform/hardware/interfaces/+/master/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
11943d70a974SIgor Opaniuk#   Module: VtsHalKeymasterV3_0TargetTest
11953d70a974SIgor Opaniuk#   Testcases: - PerInstance/SigningOperationsTest#
11963d70a974SIgor Opaniuk#              - PerInstance/NewKeyGenerationTest#
11973d70a974SIgor Opaniuk#              - PerInstance/ImportKeyTest#
11983d70a974SIgor Opaniuk#              - PerInstance/EncryptionOperationsTest#
11993d70a974SIgor Opaniuk#              - PerInstance/AttestationTest#
12003d70a974SIgor Opaniuk# Note that this violates GP requirements of HMAC size range.
12013d70a974SIgor OpaniukCFG_HMAC_64_1024_RANGE ?= n
1202aae97333Sloubaihui
120368ac62efSSami Tolvanen# CFG_RSA_PUB_EXPONENT_3, when enabled, allows RSA public exponents in the
120468ac62efSSami Tolvanen# range 3 <= e < 2^256. This is needed to pass AOSP KeyMint VTS tests:
120568ac62efSSami Tolvanen#    Link to tests: https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/security/keymint/aidl/vts/functional/KeyMintTest.cpp
120668ac62efSSami Tolvanen#    Module: VtsAidlKeyMintTargetTest
120768ac62efSSami Tolvanen#    Testcases: - PerInstance/EncryptionOperationsTest.RsaNoPaddingSuccess
120868ac62efSSami Tolvanen# When CFG_RSA_PUB_EXPONENT_3 is disabled, RSA public exponents must conform
120968ac62efSSami Tolvanen# to NIST SP800-56B recommendation and be in the range 65537 <= e < 2^256.
121068ac62efSSami TolvanenCFG_RSA_PUB_EXPONENT_3 ?= n
121168ac62efSSami Tolvanen
1212aae97333Sloubaihui# Enable a hardware pbkdf2 function
1213aae97333Sloubaihui# By default use standard pbkdf2 implementation
1214aae97333SloubaihuiCFG_CRYPTO_HW_PBKDF2 ?= n
1215aae97333Sloubaihui$(eval $(call cfg-depends-all,CFG_CRYPTO_HW_PBKDF2,CFG_CRYPTO_PBKDF2))
12162b719df0SGatien Chevallier
12177653887eSGatien Chevallier# CFG_MULTI_CORE_HALTING, when enabled, registers an interrupt handler for the
12187653887eSGatien Chevallier# Software Generated Interrupt(SGI) specified by: CFG_HALT_CORES_SGI. Upon
12197653887eSGatien Chevallier# reception of this SGI, the CPU is halted. This feature currently relies on the
12207653887eSGatien Chevallier# GIC device.
12217653887eSGatien ChevallierCFG_MULTI_CORE_HALTING ?= n
12227653887eSGatien ChevallierCFG_HALT_CORES_SGI ?= 15
12237653887eSGatien Chevallier$(eval $(call cfg-depends-all,CFG_MULTI_CORE_HALTING,CFG_GIC))
12247653887eSGatien Chevallier
12252b719df0SGatien Chevallier# CFG_HALT_CORES_ON_PANIC, when enabled, makes any call to panic() halt the
12267653887eSGatien Chevallier# other cores. This feature relies on the SGI specified by CFG_HALT_CORES_SGI
12277653887eSGatien Chevallier# to halt the other cores.
12287653887eSGatien ChevallierCFG_HALT_CORES_ON_PANIC ?= ${CFG_MULTI_CORE_HALTING}
12297653887eSGatien Chevallier$(eval $(call cfg-depends-all,CFG_HALT_CORES_ON_PANIC,CFG_MULTI_CORE_HALTING))
12307653887eSGatien Chevallier
12311d129697SJens Wiklander
12321d129697SJens Wiklander# Enable automatic discovery of maximal PA supported by the hardware and
12331d129697SJens Wiklander# use that. Provides easier configuration of virtual platforms where the
12341d129697SJens Wiklander# maximal PA can vary.
12351d129697SJens WiklanderCFG_AUTO_MAX_PA_BITS ?= n
12365a2d2237SArnaud Pouliquen
12375a2d2237SArnaud Pouliquen# CFG_DRIVERS_REMOTEPROC, when enabled, embeds support for remote processor
12385a2d2237SArnaud Pouliquen# management including generic DT bindings for the configuration.
12395a2d2237SArnaud PouliquenCFG_DRIVERS_REMOTEPROC ?= n
1240f6c57ea4SArnaud Pouliquen
1241f6c57ea4SArnaud Pouliquen# CFG_REMOTEPROC_PTA, when enabled, embeds remote processor management PTA
1242f6c57ea4SArnaud Pouliquen# service.
1243f6c57ea4SArnaud PouliquenCFG_REMOTEPROC_PTA ?= n
1244ad194957SYi Chou
1245ad194957SYi Chou# When enabled, CFG_WIDEVINE_HUK uses the widevine HUK provided by secure
1246ad194957SYi Chou# DTB as OP-TEE HUK.
1247ad194957SYi ChouCFG_WIDEVINE_HUK ?= n
1248ad194957SYi Chou$(eval $(call cfg-depends-all,CFG_WIDEVINE_HUK,CFG_DT))
1249ad194957SYi Chou
1250ad194957SYi Chou# When enabled, CFG_WIDEVINE_PTA embeds a PTA that exposes the keys under
1251ad194957SYi Chou# DT node "/options/op-tee/widevine" to some specific TAs.
1252ad194957SYi ChouCFG_WIDEVINE_PTA ?= n
1253ad194957SYi Chou$(eval $(call cfg-depends-all,CFG_WIDEVINE_PTA,CFG_DT CFG_WIDEVINE_HUK))
12547e2a1038SAlvin Chang
1255900bf7c6SYuichi Sugiyama# When enabled, CFG_VERAISON_ATTESTATION_PTA embeds remote attestation PTA
1256900bf7c6SYuichi Sugiyama# service. Note: This is an experimental feature and should be used
1257900bf7c6SYuichi Sugiyama# with caution in production environments.
1258900bf7c6SYuichi SugiyamaCFG_VERAISON_ATTESTATION_PTA ?= n
1259900bf7c6SYuichi Sugiyamaifeq ($(CFG_VERAISON_ATTESTATION_PTA),y)
1260900bf7c6SYuichi Sugiyama$(call force,CFG_QCBOR,y)
1261900bf7c6SYuichi Sugiyamaendif
1262900bf7c6SYuichi Sugiyama
1263900bf7c6SYuichi Sugiyama# When enabled, CFG_VERAISON_ATTESTATION_PTA_TEST_KEY embeds a test key.
1264900bf7c6SYuichi Sugiyama# Note: CFG_VERAISON_ATTESTATION_PTA_TEST_KEY must be enabled for
1265900bf7c6SYuichi Sugiyama# CFG_VERAISON_ATTESTATION_PTA to work.
1266900bf7c6SYuichi SugiyamaCFG_VERAISON_ATTESTATION_PTA_TEST_KEY ?= y
1267900bf7c6SYuichi Sugiyamaifneq ($(CFG_VERAISON_ATTESTATION_PTA_TEST_KEY),y)
1268900bf7c6SYuichi Sugiyama$(error "CFG_VERAISON_ATTESTATION_PTA_TEST_KEY must be enabled")
1269900bf7c6SYuichi Sugiyamaendif
1270900bf7c6SYuichi Sugiyama
1271458ef442SAlvin Chang# CFG_SEMIHOSTING_CONSOLE, when enabled, embeds a semihosting console driver.
1272458ef442SAlvin Chang# When CFG_SEMIHOSTING_CONSOLE_FILE=NULL, OP-TEE console reads/writes
1273458ef442SAlvin Chang# trace messages from/to the debug terminal of the semihosting host computer.
1274458ef442SAlvin Chang# When CFG_SEMIHOSTING_CONSOLE_FILE="{your_log_file}", OP-TEE console
1275458ef442SAlvin Chang# outputs trace messages to that file. Output to "optee.log" by default.
1276458ef442SAlvin ChangCFG_SEMIHOSTING_CONSOLE ?= n
1277458ef442SAlvin Changifeq ($(CFG_SEMIHOSTING_CONSOLE),y)
1278458ef442SAlvin Chang$(call force,CFG_SEMIHOSTING,y)
1279458ef442SAlvin Changendif
1280458ef442SAlvin ChangCFG_SEMIHOSTING_CONSOLE_FILE ?= "optee.log"
1281458ef442SAlvin Changifeq ($(CFG_SEMIHOSTING_CONSOLE_FILE),)
1282458ef442SAlvin Chang$(error CFG_SEMIHOSTING_CONSOLE_FILE cannot be empty)
1283458ef442SAlvin Changendif
1284458ef442SAlvin Chang
12857e2a1038SAlvin Chang# Semihosting is a debugging mechanism that enables code running on an embedded
12867e2a1038SAlvin Chang# system (also called the target) to communicate with and use the I/O of the
12877e2a1038SAlvin Chang# host computer.
12887e2a1038SAlvin ChangCFG_SEMIHOSTING ?= n
1289d4a87690SSungbae Yoo
1290d4a87690SSungbae Yoo# CFG_FFA_CONSOLE, when enabled, embeds a FFA console driver. OP-TEE console
1291d4a87690SSungbae Yoo# writes trace messages via FFA interface to the SPM (Secure Partition Manager)
1292d4a87690SSungbae Yoo# like hafnium.
1293d4a87690SSungbae YooCFG_FFA_CONSOLE ?= n
1294cb034002SJerome Forissier
1295799f2000SAndrew Davis# CFG_CONSOLE_RUNTIME_SET, when enabled, reduces the trace LOG_LEVEL to the
1296799f2000SAndrew Davis# value set by CFG_CONSOLE_RUNTIME_LOG_LEVEL after OP-TEE has finished booting.
1297799f2000SAndrew Davis# This allows for a different trace level during runtime than used during boot
1298799f2000SAndrew DavisCFG_CONSOLE_RUNTIME_SET ?= n
1299799f2000SAndrew DavisCFG_CONSOLE_RUNTIME_LOG_LEVEL ?= 0
1300799f2000SAndrew Davis
1301cb034002SJerome Forissier# CFG_CORE_UNSAFE_MODEXP, when enabled, makes modular exponentiation on TEE
1302cb034002SJerome Forissier# core use 'unsafe' algorithm having better performance. To resist against
1303cb034002SJerome Forissier# timing attacks, 'safe' one is designed to take constant-time that is
1304cb034002SJerome Forissier# generally much slower.
1305cb034002SJerome ForissierCFG_CORE_UNSAFE_MODEXP ?= n
1306cb034002SJerome Forissier
1307cb034002SJerome Forissier# CFG_TA_MBEDTLS_UNSAFE_MODEXP, similar to CFG_CORE_UNSAFE_MODEXP,
1308cb034002SJerome Forissier# when enabled, makes MBedTLS library for TAs use 'unsafe' modular
1309cb034002SJerome Forissier# exponentiation algorithm.
1310e1abe7d1SAlvin ChangCFG_TA_MBEDTLS_UNSAFE_MODEXP ?= n
1311fe85eae5SJens Wiklander
1312ef0d00c1SJens Wiklander# CFG_DYN_CONFIG, when enabled, use dynamic memory allocation for translation
1313bb538722SAlvin Chang# tables and stacks. Not supported with pager.
1314ef0d00c1SJens Wiklanderifeq ($(CFG_WITH_PAGER),y)
1315ef0d00c1SJens Wiklander$(call force,CFG_DYN_CONFIG,n,conflicts with CFG_WITH_PAGER)
1316ef0d00c1SJens Wiklanderelse
1317bea90f04SAlvin ChangCFG_DYN_CONFIG ?= y
1318ef0d00c1SJens Wiklanderendif
1319325d4963SGatien Chevallier
1320325d4963SGatien Chevallier# CFG_EXTERNAL_ABORT_PLAT_HANDLER is used to implement platform-specific
1321325d4963SGatien Chevallier# handling of external abort implementing the plat_external_abort_handler()
1322325d4963SGatien Chevallier# function.
1323325d4963SGatien ChevallierCFG_EXTERNAL_ABORT_PLAT_HANDLER ?= n
13246b1c1858SJens Wiklander
13256b1c1858SJens Wiklander# CFG_TA_LIBGCC, when enabled, links user mode TAs with libgcc. Linking
13266b1c1858SJens Wiklander# TAs with libgcc is deprecated, but keep this flag while sorting out the
13276b1c1858SJens Wiklander# out remaining issues with supporting C++.
13286b1c1858SJens WiklanderCFG_TA_LIBGCC ?= y
1329*00338334SJens Wiklander
1330*00338334SJens Wiklander# CFG_CORE_DYN_PROTMEM, enables dynamic protected memory lending from
1331*00338334SJens Wiklander# normal world.
1332*00338334SJens WiklanderCFG_CORE_DYN_PROTMEM ?= n
1333*00338334SJens Wiklander$(eval $(call cfg-depends-all,CFG_CORE_DYN_PROTMEM,CFG_CORE_DYN_SHM,CFG_SECURE_DATA_PATH))
1334