xref: /optee_os/mk/config.mk (revision 7e75ca5422dc58ae35fd4ced30d204796fc8b3fb)
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
20a75f2e14SJerome ForissierCROSS_COMPILE ?= arm-linux-gnueabihf-
21c042fbefSJerome ForissierCROSS_COMPILE32 ?= $(CROSS_COMPILE)
22c042fbefSJerome ForissierCROSS_COMPILE64 ?= aarch64-linux-gnu-
23a75f2e14SJerome ForissierCOMPILER ?= gcc
24a75f2e14SJerome Forissier
25b09cddcaSJerome Forissier# For convenience
26b09cddcaSJerome Forissierifdef CFLAGS
27b09cddcaSJerome ForissierCFLAGS32 ?= $(CFLAGS)
28b09cddcaSJerome ForissierCFLAGS64 ?= $(CFLAGS)
29b09cddcaSJerome Forissierendif
30b09cddcaSJerome Forissier
31120c43adSJerome Forissier# Compiler warning level.
32120c43adSJerome Forissier# Supported values: undefined, 1, 2 and 3. 3 gives more warnings.
33b0104773SPascal BrandWARNS ?= 3
34b0104773SPascal Brand
35b4faf480SDick Olsson# Path to the Python interpreter used by the build system.
36b4faf480SDick Olsson# This variable is set to the default python3 interpreter in the user's
37b4faf480SDick Olsson# path. But build environments that require more explicit control can
38b4faf480SDick Olsson# set the path to a specific interpreter through this variable.
39b4faf480SDick OlssonPYTHON3 ?= python3
40b4faf480SDick Olsson
413f17b838SEtienne Carriere# Define DEBUG=1 to compile without optimization (forces -O0)
42b0104773SPascal Brand# DEBUG=1
430e6830baSEtienne Carriereifeq ($(DEBUG),1)
440e6830baSEtienne Carriere# For backwards compatibility
450e6830baSEtienne Carriere$(call force,CFG_CC_OPT_LEVEL,0)
460e6830baSEtienne Carriere$(call force,CFG_DEBUG_INFO,y)
470e6830baSEtienne Carriereendif
480e6830baSEtienne Carriere
490e6830baSEtienne Carriere# CFG_CC_OPT_LEVEL sets compiler optimization level passed with -O directive.
500e6830baSEtienne Carriere# Optimize for size by default, usually gives good performance too.
510e6830baSEtienne CarriereCFG_CC_OPT_LEVEL ?= s
520e6830baSEtienne Carriere
530e6830baSEtienne Carriere# Enabling CFG_DEBUG_INFO makes debug information embedded in core.
540e6830baSEtienne CarriereCFG_DEBUG_INFO ?= y
55b0104773SPascal Brand
564ec2358eSJerome Forissier# If y, enable debug features of the TEE core (assertions and lock checks
574ec2358eSJerome Forissier# are enabled, panic and assert messages are more verbose, data and prefetch
584ec2358eSJerome Forissier# aborts show a stack dump). When disabled, the NDEBUG directive is defined
594ec2358eSJerome Forissier# so assertions are disabled.
604ec2358eSJerome ForissierCFG_TEE_CORE_DEBUG ?= y
61b0104773SPascal Brand
623f58e4ecSOvidiu Mihalachi# Log levels for the TEE core. Defines which core messages are displayed
633f58e4ecSOvidiu Mihalachi# on the secure console. Disabling core log (level set to 0) also disables
643f58e4ecSOvidiu Mihalachi# logs from the TAs.
6509ca9f8bSJerome Forissier# 0: none
6609ca9f8bSJerome Forissier# 1: error
6714c68b3cSJerome Forissier# 2: error + info
6814c68b3cSJerome Forissier# 3: error + info + debug
6914c68b3cSJerome Forissier# 4: error + info + debug + flow
7014c68b3cSJerome ForissierCFG_TEE_CORE_LOG_LEVEL ?= 2
713f58e4ecSOvidiu Mihalachi
723f58e4ecSOvidiu Mihalachi# TA log level
733f58e4ecSOvidiu Mihalachi# If user-mode library libutils.a is built with CFG_TEE_TA_LOG_LEVEL=0,
743f58e4ecSOvidiu Mihalachi# TA tracing is disabled regardless of the value of CFG_TEE_TA_LOG_LEVEL
753f58e4ecSOvidiu Mihalachi# when the TA is built.
76e0042c88SPascal BrandCFG_TEE_TA_LOG_LEVEL ?= 1
77b0104773SPascal Brand
787c876f12SPascal Brand# TA enablement
797c876f12SPascal Brand# When defined to "y", TA traces are output according to
807c876f12SPascal Brand# CFG_TEE_TA_LOG_LEVEL. Otherwise, they are not output at all
817c876f12SPascal BrandCFG_TEE_CORE_TA_TRACE ?= y
82b0104773SPascal Brand
838c8e1441SJerome Forissier# If y, enable the memory leak detection feature in the bget memory allocator.
848c8e1441SJerome Forissier# When this feature is enabled, calling mdbg_check(1) will print a list of all
858c8e1441SJerome Forissier# the currently allocated buffers and the location of the allocation (file and
868c8e1441SJerome Forissier# line number).
878c8e1441SJerome Forissier# Note: make sure the log level is high enough for the messages to show up on
888c8e1441SJerome Forissier# the secure console! For instance:
898c8e1441SJerome Forissier# - To debug user-mode (TA) allocations: build OP-TEE *and* the TA with:
908c8e1441SJerome Forissier#   $ make CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=3
918c8e1441SJerome Forissier# - To debug TEE core allocations: build OP-TEE with:
928c8e1441SJerome Forissier#   $ make CFG_TEE_CORE_MALLOC_DEBUG=y CFG_TEE_CORE_LOG_LEVEL=3
930fcbddd4SSY ChiuCFG_TEE_CORE_MALLOC_DEBUG ?= n
940fcbddd4SSY ChiuCFG_TEE_TA_MALLOC_DEBUG ?= n
95c2ce4186SJens Wiklander# Prints an error message and dumps the stack on failed memory allocations
96c2ce4186SJens Wiklander# using malloc() and friends.
97c2ce4186SJens WiklanderCFG_CORE_DUMP_OOM ?= $(CFG_TEE_CORE_MALLOC_DEBUG)
980fcbddd4SSY Chiu
992bfab756SJerome Forissier# Mask to select which messages are prefixed with long debugging information
10064fad262SVolodymyr Babchuk# (severity, core ID, thread ID, component name, function name, line number)
10164fad262SVolodymyr Babchuk# based on the message level. If BIT(level) is set, the long prefix is shown.
1022bfab756SJerome Forissier# Otherwise a short prefix is used (severity and component name only).
103f4aa5b11SJerome Forissier# Levels: 0=none 1=error 2=info 3=debug 4=flow
1042bfab756SJerome ForissierCFG_MSG_LONG_PREFIX_MASK ?= 0x1a
105f4aa5b11SJerome Forissier
106120c43adSJerome Forissier# PRNG configuration
1077018ae01SSY Chiu# If CFG_WITH_SOFTWARE_PRNG is enabled, crypto provider provided
1087018ae01SSY Chiu# software PRNG implementation is used.
109391a3854SAndrew Davis# Otherwise, you need to implement hw_get_random_bytes() for your platform
1107018ae01SSY ChiuCFG_WITH_SOFTWARE_PRNG ?= y
111120c43adSJerome Forissier
112120c43adSJerome Forissier# Number of threads
113120c43adSJerome ForissierCFG_NUM_THREADS ?= 2
114ab35d7adSCedric Chaumont
115ab35d7adSCedric Chaumont# API implementation version
116ab35d7adSCedric ChaumontCFG_TEE_API_VERSION ?= GPD-1.1-dev
117ab35d7adSCedric Chaumont
118ab35d7adSCedric Chaumont# Implementation description (implementation-dependent)
119ab35d7adSCedric ChaumontCFG_TEE_IMPL_DESCR ?= OPTEE
120ab35d7adSCedric Chaumont
12129cff5cfSJerome Forissier# Should OPTEE_SMC_CALL_GET_OS_REVISION return a build identifier to Normal
12229cff5cfSJerome Forissier# World?
12329cff5cfSJerome ForissierCFG_OS_REV_REPORTS_GIT_SHA1 ?= y
12429cff5cfSJerome Forissier
12535c507f2SJerome Forissier# The following values are not extracted from the "git describe" output because
12635c507f2SJerome Forissier# we might be outside of a Git environment, or the tree may have been cloned
12735c507f2SJerome Forissier# with limited depth not including any tag, so there is really no guarantee
12835c507f2SJerome Forissier# that TEE_IMPL_VERSION contains the major and minor revision numbers.
129a83aec29SJerome ForissierCFG_OPTEE_REVISION_MAJOR ?= 3
130afacf356SJerome ForissierCFG_OPTEE_REVISION_MINOR ?= 19
1313bfa418bSJerome ForissierCFG_OPTEE_REVISION_EXTRA ?=
132ab35d7adSCedric Chaumont
13348ca43e8SJerome Forissier# Trusted OS implementation version
13448ca43e8SJerome ForissierTEE_IMPL_VERSION ?= $(shell git describe --always --dirty=-dev 2>/dev/null || \
1353bfa418bSJerome Forissier		      echo Unknown_$(CFG_OPTEE_REVISION_MAJOR).$(CFG_OPTEE_REVISION_MINOR))$(CFG_OPTEE_REVISION_EXTRA)
13648ca43e8SJerome Forissierifeq ($(CFG_OS_REV_REPORTS_GIT_SHA1),y)
13748ca43e8SJerome ForissierTEE_IMPL_GIT_SHA1 := 0x$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo 0)
13848ca43e8SJerome Forissierelse
13948ca43e8SJerome ForissierTEE_IMPL_GIT_SHA1 := 0x0
14048ca43e8SJerome Forissierendif
14148ca43e8SJerome Forissier
142ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
143ab35d7adSCedric ChaumontCFG_TEE_MANUFACTURER ?= LINARO
144ab35d7adSCedric Chaumont
145ab35d7adSCedric Chaumont# Trusted firmware version
146ab35d7adSCedric ChaumontCFG_TEE_FW_IMPL_VERSION ?= FW_IMPL_UNDEF
147ab35d7adSCedric Chaumont
148ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
149ab35d7adSCedric ChaumontCFG_TEE_FW_MANUFACTURER ?= FW_MAN_UNDEF
150ab35d7adSCedric Chaumont
151b44708c1SJerome Forissier# Rich Execution Environment (REE) file system support: normal world OS
152b44708c1SJerome Forissier# provides the actual storage.
153b44708c1SJerome Forissier# This is the default FS when enabled (i.e., the one used when
154b44708c1SJerome Forissier# TEE_STORAGE_PRIVATE is passed to the trusted storage API)
155b44708c1SJerome ForissierCFG_REE_FS ?= y
156bc420748SJens Wiklander
15788e6e089SJerome Forissier# RPMB file system support
15888e6e089SJerome ForissierCFG_RPMB_FS ?= n
15988e6e089SJerome Forissier
160f5411aafSJudy Wang# Enable roll-back protection of REE file system using RPMB.
161f5411aafSJudy Wang# Roll-back protection only works if CFG_RPMB_FS = y.
162f5411aafSJudy WangCFG_REE_FS_INTEGRITY_RPMB ?= $(CFG_RPMB_FS)
163f5411aafSJudy Wang$(eval $(call cfg-depends-all,CFG_REE_FS_INTEGRITY_RPMB,CFG_RPMB_FS))
164f5411aafSJudy Wang
16588e6e089SJerome Forissier# Device identifier used when CFG_RPMB_FS = y.
16688e6e089SJerome Forissier# The exact meaning of this value is platform-dependent. On Linux, the
16788e6e089SJerome Forissier# tee-supplicant process will open /dev/mmcblk<id>rpmb
16888e6e089SJerome ForissierCFG_RPMB_FS_DEV_ID ?= 0
16988e6e089SJerome Forissier
1707d97159bSManuel Huber# This config variable determines the number of entries read in from RPMB at
1717d97159bSManuel Huber# once whenever a function traverses the RPMB FS. Increasing the default value
1727d97159bSManuel Huber# has the following consequences:
1737d97159bSManuel Huber# - More memory required on heap. A single FAT entry currently has a size of
1747d97159bSManuel Huber#   256 bytes.
1757d97159bSManuel Huber# - Potentially significant speed-ups for RPMB I/O. Depending on how many
1767d97159bSManuel Huber#   entries a function needs to traverse, the number of time-consuming RPMB
1777d97159bSManuel Huber#   read-in operations can be reduced.
1787d97159bSManuel Huber# Chosing a proper value is both platform- (available memory) and use-case-
1797d97159bSManuel Huber# dependent (potential number of FAT fs entries), so overwrite in platform
1807d97159bSManuel Huber# config files
1817d97159bSManuel HuberCFG_RPMB_FS_RD_ENTRIES ?= 8
1827d97159bSManuel Huber
1835f68d784SManuel Huber# Enables caching of FAT FS entries when set to a value greater than zero.
1845f68d784SManuel Huber# When enabled, the cache stores the first 'CFG_RPMB_FS_CACHE_ENTRIES' FAT FS
1855f68d784SManuel Huber# entries. The cache is populated when FAT FS entries are initially read in.
1865f68d784SManuel Huber# When traversing the FAT FS entries, we read from the cache instead of reading
1875f68d784SManuel Huber# in the entries from RPMB storage. Consequently, when a FAT FS entry is
1885f68d784SManuel Huber# written, the cache is updated. In scenarios where an estimate of the number
1895f68d784SManuel Huber# of FAT FS entries can be made, the cache may be specifically tailored to
1905f68d784SManuel Huber# store all entries. The caching can improve RPMB I/O at the cost
1915f68d784SManuel Huber# of additional memory.
1925f68d784SManuel Huber# Without caching, we temporarily require
1935f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1945f68d784SManuel Huber# while traversing the FAT FS (e.g. in read_fat).
1955f68d784SManuel Huber# For example 8*256 bytes = 2kB while in read_fat.
1965f68d784SManuel Huber# With caching, we constantly require up to
1975f68d784SManuel Huber# CFG_RPMB_FS_CACHE_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1985f68d784SManuel Huber# depending on how many elements are in the cache, and additional temporary
1995f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
2005f68d784SManuel Huber# in case the cache is too small to hold all elements when traversing.
2015f68d784SManuel HuberCFG_RPMB_FS_CACHE_ENTRIES ?= 0
2025f68d784SManuel Huber
2038443e88eSEtienne Carriere# Print RPMB data frames sent to and received from the RPMB device
2048443e88eSEtienne CarriereCFG_RPMB_FS_DEBUG_DATA ?= n
2058443e88eSEtienne Carriere
2068443e88eSEtienne Carriere# Clear RPMB content at cold boot
2078443e88eSEtienne CarriereCFG_RPMB_RESET_FAT ?= n
2088443e88eSEtienne Carriere
2098443e88eSEtienne Carriere# Use a hard coded RPMB key instead of deriving it from the platform HUK
2108443e88eSEtienne CarriereCFG_RPMB_TESTKEY ?= n
2118443e88eSEtienne Carriere
212ed1993b7SJerome Forissier# Enables RPMB key programming by the TEE, in case the RPMB partition has not
213ed1993b7SJerome Forissier# been configured yet.
214ed1993b7SJerome Forissier# !!! Security warning !!!
215ed1993b7SJerome Forissier# Do *NOT* enable this in product builds, as doing so would allow the TEE to
216ed1993b7SJerome Forissier# leak the RPMB key.
217ed1993b7SJerome Forissier# This option is useful in the following situations:
218ed1993b7SJerome Forissier# - Testing
219ed1993b7SJerome Forissier# - RPMB key provisioning in a controlled environment (factory setup)
220ed1993b7SJerome ForissierCFG_RPMB_WRITE_KEY ?= n
221ed1993b7SJerome Forissier
22207fda6c7SJerome Forissier_CFG_WITH_SECURE_STORAGE := $(call cfg-one-enabled,CFG_REE_FS CFG_RPMB_FS)
22307fda6c7SJerome Forissier
2243ecd96bbSVesa Jääskeläinen# Signing key for OP-TEE TA's
2253ecd96bbSVesa Jääskeläinen# When performing external HSM signing for TA's TA_SIGN_KEY can be set to dummy
2263ecd96bbSVesa Jääskeläinen# key and then set TA_PUBLIC_KEY to match public key from the HSM.
2273ecd96bbSVesa Jääskeläinen# TA_PUBLIC_KEY's public key will be embedded into OP-TEE OS.
228bc420748SJens WiklanderTA_SIGN_KEY ?= keys/default_ta.pem
2293ecd96bbSVesa JääskeläinenTA_PUBLIC_KEY ?= $(TA_SIGN_KEY)
230c4553de7SJerome Forissier
231c34d0d91SJens Wiklander# Subkeys is a complement to the normal TA_SIGN_KEY where a subkey is used
232c34d0d91SJens Wiklander# to verify a TA instead. To sign a TA using a previously prepared subkey
233c34d0d91SJens Wiklander# two new options are added, TA_SUBKEY_ARGS and TA_SUBKEY_DEPS.  It is
234c34d0d91SJens Wiklander# typically used by assigning the following in the TA Makefile:
235c34d0d91SJens Wiklander# BINARY = <TA-uuid-string>
236c34d0d91SJens Wiklander# TA_SIGN_KEY = subkey.pem
237c34d0d91SJens Wiklander# TA_SUBKEY_ARGS = --subkey subkey.bin --name subkey_ta
238c34d0d91SJens Wiklander# TA_SUBKEY_DEPS = subkey.bin
239c34d0d91SJens Wiklander# See the documentation for more details on subkeys.
240c34d0d91SJens Wiklander
241c4553de7SJerome Forissier# Include lib/libutils/isoc in the build? Most platforms need this, but some
242c4553de7SJerome Forissier# may not because they obtain the isoc functions from elsewhere
243c4553de7SJerome ForissierCFG_LIBUTILS_WITH_ISOC ?= y
244fce4cfa1SJens Wiklander
2450de9a5fbSJens Wiklander# Enables floating point support for user TAs
2460de9a5fbSJens Wiklander# ARM32: EABI defines both a soft-float ABI and a hard-float ABI,
2470de9a5fbSJens Wiklander#	 hard-float is basically a super set of soft-float. Hard-float
2480de9a5fbSJens Wiklander#	 requires all the support routines provided for soft-float, but the
2490de9a5fbSJens Wiklander#	 compiler may choose to optimize to not use some of them and use
2500de9a5fbSJens Wiklander#	 the floating-point registers instead.
2510de9a5fbSJens Wiklander# ARM64: EABI doesn't define a soft-float ABI, everything is hard-float (or
2520de9a5fbSJens Wiklander#	 nothing with ` -mgeneral-regs-only`)
2530de9a5fbSJens Wiklander# With CFG_TA_FLOAT_SUPPORT enabled TA code is free use floating point types
2540de9a5fbSJens WiklanderCFG_TA_FLOAT_SUPPORT ?= y
255923c1f34SJens Wiklander
2567411e0e1SJerome Forissier# Stack unwinding: print a stack dump to the console on core or TA abort, or
2577411e0e1SJerome Forissier# when a TA panics.
25831a29642SJerome Forissier# If CFG_UNWIND is enabled, both the kernel and user mode call stacks can be
25931a29642SJerome Forissier# unwound (not paged TAs, however).
26031a29642SJerome Forissier# Note that 32-bit ARM code needs unwind tables for this to work, so enabling
26131a29642SJerome Forissier# this option will increase the size of the 32-bit TEE binary by a few KB.
26231a29642SJerome Forissier# Similarly, TAs have to be compiled with -funwind-tables (default when the
26331a29642SJerome Forissier# option is set) otherwise they can't be unwound.
2647411e0e1SJerome Forissier# Warning: since the unwind sequence for user-mode (TA) code is implemented in
2657411e0e1SJerome Forissier# the privileged layer of OP-TEE, enabling this feature will weaken the
2667411e0e1SJerome Forissier# user/kernel isolation. Therefore it should be disabled in release builds.
2673f17b838SEtienne Carriereifeq ($(CFG_TEE_CORE_DEBUG),y)
26831a29642SJerome ForissierCFG_UNWIND ?= y
269923c1f34SJens Wiklanderendif
2706fbac37eSJens Wiklander
2716fbac37eSJens Wiklander# Enable support for dynamically loaded user TAs
2726fbac37eSJens WiklanderCFG_WITH_USER_TA ?= y
2732a142248SJens Wiklander
27424d49094SJerome Forissier# Choosing the architecture(s) of user-mode libraries (used by TAs)
27524d49094SJerome Forissier#
27624d49094SJerome Forissier# Platforms may define a list of supported architectures for user-mode code
27724d49094SJerome Forissier# by setting $(supported-ta-targets). Valid values are "ta_arm32", "ta_arm64",
27824d49094SJerome Forissier# "ta_arm32 ta_arm64" and "ta_arm64 ta_arm32".
27924d49094SJerome Forissier# $(supported-ta-targets) defaults to "ta_arm32" when the TEE core is 32-bits,
28024d49094SJerome Forissier# and "ta_arm32 ta_arm64" when it is 64-bits (that is, when CFG_ARM64_core=y).
28124d49094SJerome Forissier# The first entry in $(supported-ta-targets) has a special role, see
28224d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> below.
28324d49094SJerome Forissier#
28424d49094SJerome Forissier# CFG_USER_TA_TARGETS may be defined to restrict $(supported-ta-targets) or
28524d49094SJerome Forissier# change the order of the values.
28624d49094SJerome Forissier#
28724d49094SJerome Forissier# The list of TA architectures is ultimately stored in $(ta-targets).
28824d49094SJerome Forissier
28924d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> (for example, CFG_USER_TA_TARGET_avb), if
29024d49094SJerome Forissier# defined, selects the unique TA architecture mode for building the in-tree TA
29124d49094SJerome Forissier# <ta-name>. Can be either ta_arm32 or ta_arm64.
29224d49094SJerome Forissier# By default, in-tree TAs are built using the first architecture specified in
29324d49094SJerome Forissier# $(ta-targets).
29424d49094SJerome Forissier
2957dfff131SJerome Forissier# Address Space Layout Randomization for user-mode Trusted Applications
2967dfff131SJerome Forissier#
2977dfff131SJerome Forissier# When this flag is enabled, the ELF loader will introduce a random offset
2987dfff131SJerome Forissier# when mapping the application in user space. ASLR makes the exploitation of
2997dfff131SJerome Forissier# memory corruption vulnerabilities more difficult.
30087372da4SJens WiklanderCFG_TA_ASLR ?= y
3017dfff131SJerome Forissier
3027dfff131SJerome Forissier# How much ASLR may shift the base address (in pages). The base address is
3037dfff131SJerome Forissier# randomly shifted by an integer number of pages comprised between these two
3047dfff131SJerome Forissier# values. Bigger ranges are more secure because they make the addresses harder
3057dfff131SJerome Forissier# to guess at the expense of using more memory for the page tables.
3067dfff131SJerome ForissierCFG_TA_ASLR_MIN_OFFSET_PAGES ?= 0
3077dfff131SJerome ForissierCFG_TA_ASLR_MAX_OFFSET_PAGES ?= 128
3087dfff131SJerome Forissier
309170e9084SJens Wiklander# Address Space Layout Randomization for TEE Core
310170e9084SJens Wiklander#
311170e9084SJens Wiklander# When this flag is enabled, the early init code will introduce a random
312170e9084SJens Wiklander# offset when mapping TEE Core. ASLR makes the exploitation of memory
313170e9084SJens Wiklander# corruption vulnerabilities more difficult.
31487372da4SJens WiklanderCFG_CORE_ASLR ?= y
315170e9084SJens Wiklander
316ee664c19SJerome Forissier# Load user TAs from the REE filesystem via tee-supplicant
317ee664c19SJerome ForissierCFG_REE_FS_TA ?= y
318ee664c19SJerome Forissier
3197db24ad6SJerome Forissier# Pre-authentication of TA binaries loaded from the REE filesystem
3207db24ad6SJerome Forissier#
3217db24ad6SJerome Forissier# - If CFG_REE_FS_TA_BUFFERED=y: load TA binary into a temporary buffer in the
3227db24ad6SJerome Forissier#   "Secure DDR" pool, check the signature, then process the file only if it is
3237db24ad6SJerome Forissier#   valid.
3247db24ad6SJerome Forissier# - If disabled: hash the binaries as they are being processed and verify the
3257db24ad6SJerome Forissier#   signature as a last step.
326e6e68745SJerome ForissierCFG_REE_FS_TA_BUFFERED ?= n
3277db24ad6SJerome Forissier$(eval $(call cfg-depends-all,CFG_REE_FS_TA_BUFFERED,CFG_REE_FS_TA))
3287db24ad6SJerome Forissier
329300faa62SEtienne Carriere# When CFG_REE_FS=y and CFG_RPMB_FS=y:
330300faa62SEtienne Carriere# Allow secure storage in the REE FS to be entirely deleted without causing
331300faa62SEtienne Carriere# anti-rollback errors. That is, rm /data/tee/dirf.db or rm -rf /data/tee (or
332300faa62SEtienne Carriere# whatever path is configured in tee-supplicant as CFG_TEE_FS_PARENT_PATH)
333300faa62SEtienne Carriere# can be used to reset the secure storage to a clean, empty state.
334300faa62SEtienne Carriere# Typically used for testing only since it weakens storage security.
335300faa62SEtienne CarriereCFG_REE_FS_ALLOW_RESET ?= n
336300faa62SEtienne Carriere
337d0c63614SJerome Forissier# Support for loading user TAs from a special section in the TEE binary.
338d0c63614SJerome Forissier# Such TAs are available even before tee-supplicant is available (hence their
339d0c63614SJerome Forissier# name), but note that many services exported to TAs may need tee-supplicant,
340d0c63614SJerome Forissier# so early use is limited to a subset of the TEE Internal Core API (crypto...)
341d0c63614SJerome Forissier# To use this feature, set EARLY_TA_PATHS to the paths to one or more TA ELF
342d0c63614SJerome Forissier# file(s). For example:
343d0c63614SJerome Forissier#   $ make ... \
344d0c63614SJerome Forissier#     EARLY_TA_PATHS="path/to/8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf \
345d0c63614SJerome Forissier#                     path/to/cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.stripped.elf"
346d0c63614SJerome Forissier# Typical build steps:
347d0c63614SJerome Forissier#   $ make ta_dev_kit CFG_EARLY_TA=y # Create the dev kit (user mode libraries,
348d0c63614SJerome Forissier#                                    # headers, makefiles), ready to build TAs.
349d0c63614SJerome Forissier#                                    # CFG_EARLY_TA=y is optional, it prevents
350d0c63614SJerome Forissier#                                    # later library recompilations.
351d0c63614SJerome Forissier#   <build some TAs>
352d0c63614SJerome Forissier#   $ make EARLY_TA_PATHS=<paths>    # Build OP-TEE and embbed the TA(s)
3533638ea32SJens Wiklander#
3543638ea32SJens Wiklander# Another option is CFG_IN_TREE_EARLY_TAS which is used to point at
3553638ea32SJens Wiklander# in-tree TAs. CFG_IN_TREE_EARLY_TAS is formatted as:
3563638ea32SJens Wiklander# <name-of-ta>/<uuid>
3573638ea32SJens Wiklander# for instance avb/023f8f1a-292a-432b-8fc4-de8471358067
3583638ea32SJens Wiklanderifneq ($(EARLY_TA_PATHS)$(CFG_IN_TREE_EARLY_TAS),)
359d0c63614SJerome Forissier$(call force,CFG_EARLY_TA,y)
360d0c63614SJerome Forissierelse
361d0c63614SJerome ForissierCFG_EARLY_TA ?= n
362d0c63614SJerome Forissierendif
363dea46be3SJelle Sels
36405ee04a8SJelle Selsifeq ($(CFG_EARLY_TA),y)
36505ee04a8SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
36605ee04a8SJelle Selsendif
36705ee04a8SJelle Sels
368dea46be3SJelle Selsifneq ($(SP_PATHS),)
369dea46be3SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
370dea46be3SJelle Selselse
371dea46be3SJelle SelsCFG_SECURE_PARTITION ?= n
372dea46be3SJelle Selsendif
373dea46be3SJelle Sels
37405ee04a8SJelle Selsifeq ($(CFG_SECURE_PARTITION),y)
37505ee04a8SJelle Sels$(call force,CFG_EMBEDDED_TS,y)
37605ee04a8SJelle Selsendif
37705ee04a8SJelle Sels
378dea46be3SJelle Selsifeq ($(CFG_EMBEDDED_TS),y)
379509a9802SJerome Forissier$(call force,CFG_ZLIB,y)
380509a9802SJerome Forissierendif
381d0c63614SJerome Forissier
382c082c54dSEtienne Carriere# By default the early TAs are compressed in the TEE binary, it is possible to
383c082c54dSEtienne Carriere# not compress them with CFG_EARLY_TA_COMPRESS=n
384c082c54dSEtienne CarriereCFG_EARLY_TA_COMPRESS ?= y
385c082c54dSEtienne Carriere
386a884c935SJens Wiklander# Enable paging, requires SRAM, can't be enabled by default
387a884c935SJens WiklanderCFG_WITH_PAGER ?= n
388a884c935SJens Wiklander
389b757e307SJens Wiklander# Use the pager for user TAs
390b757e307SJens WiklanderCFG_PAGED_USER_TA ?= $(CFG_WITH_PAGER)
391b757e307SJens Wiklander
392b757e307SJens Wiklander# If paging of user TAs, that is, R/W paging default to enable paging of
393b757e307SJens Wiklander# TAG and IV in order to reduce heap usage.
394b757e307SJens WiklanderCFG_CORE_PAGE_TAG_AND_IV ?= $(CFG_PAGED_USER_TA)
395b757e307SJens Wiklander
396ab0df69eSJerome Forissier# Runtime lock dependency checker: ensures that a proper locking hierarchy is
397ab0df69eSJerome Forissier# used in the TEE core when acquiring and releasing mutexes. Any violation will
398ab0df69eSJerome Forissier# cause a panic as soon as the invalid locking condition is detected. If
3992288b071SJerome Forissier# CFG_UNWIND and CFG_LOCKDEP_RECORD_STACK are both enabled, the algorithm
4002288b071SJerome Forissier# records the call stacks when locks are taken, and prints them when a
4012288b071SJerome Forissier# potential deadlock is found.
402ab0df69eSJerome Forissier# Expect a significant performance impact when enabling this.
403ab0df69eSJerome ForissierCFG_LOCKDEP ?= n
4042288b071SJerome ForissierCFG_LOCKDEP_RECORD_STACK ?= y
405ab0df69eSJerome Forissier
406bde8a250SJoakim Bech# BestFit algorithm in bget reduces the fragmentation of the heap when running
407ab0df69eSJerome Forissier# with the pager enabled or lockdep
408ab0df69eSJerome ForissierCFG_CORE_BGET_BESTFIT ?= $(call cfg-one-enabled, CFG_WITH_PAGER CFG_LOCKDEP)
409bde8a250SJoakim Bech
410be715239SJens Wiklander# Enable support for detected undefined behavior in C
4111d171f95SJens Wiklander# Uses a lot of memory, can't be enabled by default
412be715239SJens WiklanderCFG_CORE_SANITIZE_UNDEFINED ?= n
413b908c675SJens Wiklander
4141d171f95SJens Wiklander# Enable Kernel Address sanitizer, has a huge performance impact, uses a
4151d171f95SJens Wiklander# lot of memory and need platform specific adaptations, can't be enabled by
4161d171f95SJens Wiklander# default
4171d171f95SJens WiklanderCFG_CORE_SANITIZE_KADDRESS ?= n
4181d171f95SJens Wiklander
41935e770dfSJerome Forissier# Add stack guards before/after stacks and periodically check them
42035e770dfSJerome ForissierCFG_WITH_STACK_CANARIES ?= y
42135e770dfSJerome Forissier
422e2f03e07SJerome Forissier# Use compiler instrumentation to troubleshoot stack overflows.
423e2f03e07SJerome Forissier# When enabled, most C functions check the stack pointer against the current
424e2f03e07SJerome Forissier# stack limits on entry and panic immediately if it is out of range.
425e2f03e07SJerome ForissierCFG_CORE_DEBUG_CHECK_STACKS ?= n
426e2f03e07SJerome Forissier
427cca7b5ebSJorge Ramirez-Ortiz# Use when the default stack allocations are not sufficient.
428cca7b5ebSJorge Ramirez-OrtizCFG_STACK_THREAD_EXTRA ?= 0
429cca7b5ebSJorge Ramirez-OrtizCFG_STACK_TMP_EXTRA ?= 0
430cca7b5ebSJorge Ramirez-Ortiz
431b908c675SJens Wiklander# Device Tree support
432c95b9511SEtienne Carriere#
433c95b9511SEtienne Carriere# When CFG_DT is enabled core embeds the FDT library (libfdt) allowing
434c95b9511SEtienne Carriere# device tree blob (DTB) parsing from the core.
435c95b9511SEtienne Carriere#
436c95b9511SEtienne Carriere# When CFG_DT is enabled, the TEE _start function expects to find
437c95b9511SEtienne Carriere# the address of a DTB in register X2/R2 provided by the early boot stage
438c95b9511SEtienne Carriere# or value 0 if boot stage provides no DTB.
439c95b9511SEtienne Carriere#
4407c2317a7SGatien Chevallier# When CFG_EXTERNAL_DT is enabled, the external device tree ABI is implemented
4417c2317a7SGatien Chevallier# and the external device tree is expected to be used/modified. Its value
4427c2317a7SGatien Chevallier# defaults to CFG_DT.
4437c2317a7SGatien Chevallier#
444bf31bf10SImre Kis# When CFG_MAP_EXT_DT_SECURE is enabled the external device tree is expected to
445bf31bf10SImre Kis# be in the secure memory.
446bf31bf10SImre Kis#
447c95b9511SEtienne Carriere# When CFG_EMBED_DTB is enabled, CFG_EMBED_DTB_SOURCE_FILE shall define the
448c95b9511SEtienne Carriere# relative path of a DTS file located in core/arch/$(ARCH)/dts.
449c95b9511SEtienne Carriere# The DTS file is compiled into a DTB file which content is embedded in a
450c95b9511SEtienne Carriere# read-only section of the core.
451c95b9511SEtienne Carriereifneq ($(strip $(CFG_EMBED_DTB_SOURCE_FILE)),)
452c95b9511SEtienne CarriereCFG_EMBED_DTB ?= y
453c95b9511SEtienne Carriereendif
454c95b9511SEtienne Carriereifeq ($(CFG_EMBED_DTB),y)
455c95b9511SEtienne Carriere$(call force,CFG_DT,y)
456c95b9511SEtienne Carriereendif
457c95b9511SEtienne CarriereCFG_EMBED_DTB ?= n
458b908c675SJens WiklanderCFG_DT ?= n
4597c2317a7SGatien ChevallierCFG_EXTERNAL_DT ?= $(CFG_DT)
460bf31bf10SImre KisCFG_MAP_EXT_DT_SECURE ?= n
461bf31bf10SImre Kisifeq ($(CFG_MAP_EXT_DT_SECURE),y)
462bf31bf10SImre Kis$(call force,CFG_DT,y)
463bf31bf10SImre Kisendif
46476358becSJens Wiklander
46576358becSJens Wiklander# Maximum size of the Device Tree Blob, has to be large enough to allow
46676358becSJens Wiklander# editing of the supplied DTB.
46776358becSJens WiklanderCFG_DTB_MAX_SIZE ?= 0x10000
4684d62e91aSVictor Chong
469c36d2192SBalint Dobszay# Maximum size of the init info data passed to Secure Partitions.
470c36d2192SBalint DobszayCFG_SP_INIT_INFO_MAX_SIZE ?= 0x1000
471c36d2192SBalint Dobszay
4720a3ad9b6SBryan O'Donoghue# Device Tree Overlay support.
473c4544143SClément Léger# CFG_EXTERNAL_DTB_OVERLAY allows to append a DTB overlay into an existing
474c4544143SClément Léger# external DTB. The overlay is created when no valid DTB overlay is found.
475c4544143SClément Léger# CFG_GENERATE_DTB_OVERLAY allows to create a DTB overlay at external
476c4544143SClément Léger# DTB location.
477c4544143SClément Léger# External DTB location (physical address) is provided either by boot
478c4544143SClément Léger# argument arg2 or from CFG_DT_ADDR if defined.
479c4544143SClément Léger# A subsequent boot stage can then merge the generated overlay DTB into a main
4800a3ad9b6SBryan O'Donoghue# DTB using the standard fdt_overlay_apply() method.
4810a3ad9b6SBryan O'DonoghueCFG_EXTERNAL_DTB_OVERLAY ?= n
482c4544143SClément LégerCFG_GENERATE_DTB_OVERLAY ?= n
483c4544143SClément Léger
484c4544143SClément Légerifeq (y-y,$(CFG_EXTERNAL_DTB_OVERLAY)-$(CFG_GENERATE_DTB_OVERLAY))
485c4544143SClément Léger$(error CFG_EXTERNAL_DTB_OVERLAY and CFG_GENERATE_DTB_OVERLAY are exclusive)
486c4544143SClément Légerendif
487c4544143SClément Léger_CFG_USE_DTB_OVERLAY := $(call cfg-one-enabled,CFG_EXTERNAL_DTB_OVERLAY \
488c4544143SClément Léger			  CFG_GENERATE_DTB_OVERLAY)
4890a3ad9b6SBryan O'Donoghue
490313aa2a4SJens Wiklander# All embedded tests are supposed to be disabled by default, this flag
491313aa2a4SJens Wiklander# is used to control the default value of all other embedded tests
492313aa2a4SJens WiklanderCFG_ENABLE_EMBEDDED_TESTS ?= n
493313aa2a4SJens Wiklander
49435964dc9SEtienne Carriere# Enable core self tests and related pseudo TAs
495313aa2a4SJens WiklanderCFG_TEE_CORE_EMBED_INTERNAL_TESTS ?= $(CFG_ENABLE_EMBEDDED_TESTS)
4966d96f208Syanyan-wrs
49727e8d08dSJens Wiklander# Compiles bget_main_test() to be called from a test TA
49827e8d08dSJens WiklanderCFG_TA_BGET_TEST ?= $(CFG_ENABLE_EMBEDDED_TESTS)
49927e8d08dSJens Wiklander
500d783b681SEtienne Carriere# CFG_DT_DRIVER_EMBEDDED_TEST when enabled embedb DT driver probing tests.
501d783b681SEtienne Carriere# This also requires embeddeding a DTB with expected content.
502d783b681SEtienne Carriere# Defautl disable CFG_DRIVERS_CLK_EARLY_PROBE to probe clocks as other drivers.
503d783b681SEtienne Carriere# A probe deferral test mandates CFG_DRIVERS_DT_RECURSIVE_PROBE=n.
504d783b681SEtienne CarriereCFG_DT_DRIVER_EMBEDDED_TEST ?= n
505d783b681SEtienne Carriereifeq ($(CFG_DT_DRIVER_EMBEDDED_TEST),y)
506d783b681SEtienne CarriereCFG_DRIVERS_CLK ?= y
507d783b681SEtienne CarriereCFG_DRIVERS_RSTCTRL ?= y
508d783b681SEtienne CarriereCFG_DRIVERS_CLK_EARLY_PROBE ?= n
509d783b681SEtienne Carriere$(call force,CFG_DRIVERS_DT_RECURSIVE_PROBE,n,Mandated by CFG_DT_DRIVER_EMBEDDED_TEST)
510d783b681SEtienne Carriereendif
511d783b681SEtienne Carriere
5124101c34aSEtienne Carriere# CFG_DRIVERS_DT_RECURSIVE_PROBE when enabled forces a recursive subnode
5134101c34aSEtienne Carriere# parsing in the embedded DTB for driver probing. The alternative is
5144101c34aSEtienne Carriere# an exploration based on compatible drivers found. It is default disabled.
5154101c34aSEtienne CarriereCFG_DRIVERS_DT_RECURSIVE_PROBE ?= n
5164101c34aSEtienne Carriere
5176d96f208Syanyan-wrs# This option enables OP-TEE to respond to SMP boot request: the Rich OS
5186d96f208Syanyan-wrs# issues this to request OP-TEE to release secondaries cores out of reset,
5196d96f208Syanyan-wrs# with specific core number and non-secure entry address.
5206d96f208Syanyan-wrsCFG_BOOT_SECONDARY_REQUEST ?= n
5216d96f208Syanyan-wrs
522f5f914aaSJens Wiklander# Default heap size for Core, 64 kB
523f5f914aaSJens WiklanderCFG_CORE_HEAP_SIZE ?= 65536
524f3bb2312SJerome Forissier
525386fc264SVolodymyr Babchuk# Default size of nexus heap. 16 kB. Used only if CFG_VIRTUALIZATION
526386fc264SVolodymyr Babchuk# is enabled
527386fc264SVolodymyr BabchukCFG_CORE_NEX_HEAP_SIZE ?= 16384
528386fc264SVolodymyr Babchuk
529883c4be3SJerome Forissier# TA profiling.
530883c4be3SJerome Forissier# When this option is enabled, OP-TEE can execute Trusted Applications
531883c4be3SJerome Forissier# instrumented with GCC's -pg flag and will output profiling information
532883c4be3SJerome Forissier# in gmon.out format to /tmp/gmon-<ta_uuid>.out (path is defined in
533883c4be3SJerome Forissier# tee-supplicant)
5348800b01dSJerome Forissier# Note: this does not work well with shared libraries at the moment for a
5358800b01dSJerome Forissier# couple of reasons:
5368800b01dSJerome Forissier# 1. The profiling code assumes a unique executable section in the TA VA space.
5378800b01dSJerome Forissier# 2. The code used to detect at run time if the TA is intrumented assumes that
5388800b01dSJerome Forissier# the TA is linked statically.
539883c4be3SJerome ForissierCFG_TA_GPROF_SUPPORT ?= n
540f3bb2312SJerome Forissier
541b02ae382SSumit Garg# TA function tracing.
542b02ae382SSumit Garg# When this option is enabled, OP-TEE can execute Trusted Applications
543b02ae382SSumit Garg# instrumented with GCC's -pg flag and will output function tracing
544b02ae382SSumit Garg# information in ftrace.out format to /tmp/ftrace-<ta_uuid>.out (path is
545b02ae382SSumit Garg# defined in tee-supplicant)
546099918f6SSumit GargCFG_FTRACE_SUPPORT ?= n
547b02ae382SSumit Garg
548d408db99SJerome Forissier# How to make room when the function tracing buffer is full?
549d408db99SJerome Forissier# 'shift': shift the previously stored data by the amount needed in order
550d408db99SJerome Forissier#    to always keep the latest logs (slower, especially with big buffer sizes)
551d408db99SJerome Forissier# 'wrap': discard the previous data and start at the beginning of the buffer
552d408db99SJerome Forissier#    again (fast, but can result in a mostly empty buffer)
553d408db99SJerome Forissier# 'stop': stop logging new data
554d408db99SJerome ForissierCFG_FTRACE_BUF_WHEN_FULL ?= shift
555d408db99SJerome Forissier$(call cfg-check-value,FTRACE_BUF_WHEN_FULL,shift stop wrap)
556d408db99SJerome Forissier$(call force,_CFG_FTRACE_BUF_WHEN_FULL_$(CFG_FTRACE_BUF_WHEN_FULL),y)
557d408db99SJerome Forissier
558d1492098SJerome Forissier# Function tracing: unit to be used when displaying durations
559d1492098SJerome Forissier#  0: always display durations in microseconds
560d1492098SJerome Forissier# >0: if duration is greater or equal to the specified value (in microseconds),
561d1492098SJerome Forissier#     display it in milliseconds
562d1492098SJerome ForissierCFG_FTRACE_US_MS ?= 10000
563d1492098SJerome Forissier
564099918f6SSumit Garg# Core syscall function tracing.
565099918f6SSumit Garg# When this option is enabled, OP-TEE core is instrumented with GCC's
566099918f6SSumit Garg# -pg flag and will output syscall function graph in user TA ftrace
567099918f6SSumit Garg# buffer
568099918f6SSumit GargCFG_SYSCALL_FTRACE ?= n
569099918f6SSumit Garg$(call cfg-depends-all,CFG_SYSCALL_FTRACE,CFG_FTRACE_SUPPORT)
570099918f6SSumit Garg
571883c4be3SJerome Forissier# Enable to compile user TA libraries with profiling (-pg).
572099918f6SSumit Garg# Depends on CFG_TA_GPROF_SUPPORT or CFG_FTRACE_SUPPORT.
573735565dbSSumit GargCFG_ULIBS_MCOUNT ?= n
5740f8adafeSJerome Forissier# Profiling/tracing of syscall wrapper (utee_*)
5750f8adafeSJerome ForissierCFG_SYSCALL_WRAPPERS_MCOUNT ?= $(CFG_ULIBS_MCOUNT)
576883c4be3SJerome Forissier
5770f8adafeSJerome Forissierifeq (y,$(filter y,$(CFG_ULIBS_MCOUNT) $(CFG_SYSCALL_WRAPPERS_MCOUNT)))
578099918f6SSumit Gargifeq (,$(filter y,$(CFG_TA_GPROF_SUPPORT) $(CFG_FTRACE_SUPPORT)))
579883c4be3SJerome Forissier$(error Cannot instrument user libraries if user mode profiling is disabled)
580f3bb2312SJerome Forissierendif
581f3bb2312SJerome Forissierendif
582cb0b5954SJens Wiklander
5837fb525f1SJerome Forissier# Build libutee, libutils, libmbedtls as shared libraries.
58464718c93SJerome Forissier# - Static libraries are still generated when this is enabled, but TAs will use
58564718c93SJerome Forissier# the shared libraries unless explicitly linked with the -static flag.
58664718c93SJerome Forissier# - Shared libraries are made of two files: for example, libutee is
58764718c93SJerome Forissier#   libutee.so and 527f1a47-b92c-4a74-95bd-72f19f4a6f74.ta. The '.so' file
58864718c93SJerome Forissier#   is a totally standard shared object, and should be used to link against.
58964718c93SJerome Forissier#   The '.ta' file is a signed version of the '.so' and should be installed
59064718c93SJerome Forissier#   in the same way as TAs so that they can be found at runtime.
59164718c93SJerome ForissierCFG_ULIBS_SHARED ?= n
59264718c93SJerome Forissier
59339ef71afSEtienne Carriereifeq (y-y,$(CFG_TA_GPROF_SUPPORT)-$(CFG_ULIBS_SHARED))
59470aa7511SJerome Forissier$(error CFG_TA_GPROF_SUPPORT and CFG_ULIBS_SHARED are currently incompatible)
59570aa7511SJerome Forissierendif
59670aa7511SJerome Forissier
597cb0b5954SJens Wiklander# CFG_GP_SOCKETS
598cb0b5954SJens Wiklander# Enable Global Platform Sockets support
599cb0b5954SJens WiklanderCFG_GP_SOCKETS ?= y
60080a4e51dSEtienne Carriere
60180a4e51dSEtienne Carriere# Enable Secure Data Path support in OP-TEE core (TA may be invoked with
60280a4e51dSEtienne Carriere# invocation parameters referring to specific secure memories).
60380a4e51dSEtienne CarriereCFG_SECURE_DATA_PATH ?= n
60400da26ecSAndrew F. Davis
605c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
606c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
607c9720143SJens Wiklander# metadata in secure storage.
608c9720143SJens WiklanderCFG_SECSTOR_TA ?= $(call cfg-all-enabled,CFG_REE_FS CFG_WITH_USER_TA)
609c9720143SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA,CFG_REE_FS CFG_WITH_USER_TA))
610c9720143SJens Wiklander
61130668b28SJens Wiklander# Enable the pseudo TA that managages TA storage in secure storage
61230668b28SJens WiklanderCFG_SECSTOR_TA_MGMT_PTA ?= $(call cfg-all-enabled,CFG_SECSTOR_TA)
61330668b28SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA_MGMT_PTA,CFG_SECSTOR_TA))
614c9720143SJens Wiklander
6154bca302aSIgor Opaniuk# Enable the pseudo TA for misc. auxilary services, extending existing
61657e642f1SEtienne Carriere# GlobalPlatform TEE Internal Core API (for example, re-seeding RNG entropy
61757e642f1SEtienne Carriere# pool etc...)
61857e642f1SEtienne CarriereCFG_SYSTEM_PTA ?= $(CFG_WITH_USER_TA)
61957e642f1SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SYSTEM_PTA,CFG_WITH_USER_TA))
6204bca302aSIgor Opaniuk
6210b611081SSumit Garg# Enable the pseudo TA for enumeration of TEE based devices for the normal
6220b611081SSumit Garg# world OS.
6230b611081SSumit GargCFG_DEVICE_ENUM_PTA ?= y
6240b611081SSumit Garg
6257e05ec25SJerome Forissier# The attestation pseudo TA provides an interface to request measurements of
6267e05ec25SJerome Forissier# a TA or the TEE binary.
6277e05ec25SJerome ForissierCFG_ATTESTATION_PTA ?= n
6287e05ec25SJerome Forissier$(eval $(call cfg-depends-all,CFG_ATTESTATION_PTA,_CFG_WITH_SECURE_STORAGE))
6297e05ec25SJerome Forissier
6307e05ec25SJerome Forissier# RSA key size (in bits) for the attestation PTA. Must be at least 528 given
6317e05ec25SJerome Forissier# other algorithm parameters (RSA PSS with SHA-256 and 32-byte salt), but
6327e05ec25SJerome Forissier# note that such a low value is not secure.
6337e05ec25SJerome Forissier# See https://tools.ietf.org/html/rfc8017#section-8.1.1 and
6347e05ec25SJerome Forissier# https://tools.ietf.org/html/rfc8017#section-9.1.1
6357e05ec25SJerome Forissier#  emLen >= hlen + sLen + 2 = 32 + 32 + 2 = 66
6367e05ec25SJerome Forissier#  emLen = ceil((modBits - 1) / 8) => emLen is the key size in bytes
6377e05ec25SJerome ForissierCFG_ATTESTATION_PTA_KEY_SIZE ?= 3072
6387e05ec25SJerome Forissier
63900da26ecSAndrew F. Davis# Define the number of cores per cluster used in calculating core position.
64000da26ecSAndrew F. Davis# The cluster number is shifted by this value and added to the core ID,
64100da26ecSAndrew F. Davis# so its value represents log2(cores/cluster).
64200da26ecSAndrew F. Davis# Default is 2**(2) = 4 cores per cluster.
64300da26ecSAndrew F. DavisCFG_CORE_CLUSTER_SHIFT ?= 2
644d81f93a7SVolodymyr Babchuk
6458be2de1aSImre Kis# Define the number of threads per core used in calculating processing
6468be2de1aSImre Kis# element's position. The core number is shifted by this value and added to
6478be2de1aSImre Kis# the thread ID, so its value represents log2(threads/core).
6488be2de1aSImre Kis# Default is 2**(0) = 1 threads per core.
6498be2de1aSImre KisCFG_CORE_THREAD_SHIFT ?= 0
6508be2de1aSImre Kis
65137a6b717SJens Wiklander# Enable support for dynamic shared memory (shared memory anywhere in
65237a6b717SJens Wiklander# non-secure memory).
65337a6b717SJens WiklanderCFG_CORE_DYN_SHM ?= y
65437a6b717SJens Wiklander
6558aeb6c94SJens Wiklander# Enable support for reserved shared memory (shared memory in a carved out
6568aeb6c94SJens Wiklander# memory area).
6578aeb6c94SJens WiklanderCFG_CORE_RESERVED_SHM ?= y
6588aeb6c94SJens Wiklander
659dd3afbacSJens Wiklander# Enables support for larger physical addresses, that is, it will define
660dd3afbacSJens Wiklander# paddr_t as a 64-bit type.
661dd3afbacSJens WiklanderCFG_CORE_LARGE_PHYS_ADDR ?= n
662e3458e03SJerome Forissier
663e3458e03SJerome Forissier# Define the maximum size, in bits, for big numbers in the Internal Core API
664e3458e03SJerome Forissier# Arithmetical functions. This does *not* influence the key size that may be
665e3458e03SJerome Forissier# manipulated through the Cryptographic API.
666e3458e03SJerome Forissier# Set this to a lower value to reduce the TA memory footprint.
667e3458e03SJerome ForissierCFG_TA_BIGNUM_MAX_BITS ?= 2048
668409d2ff0SJerome Forissier
669409d2ff0SJerome Forissier# Define the maximum size, in bits, for big numbers in the TEE core (privileged
670409d2ff0SJerome Forissier# layer).
671409d2ff0SJerome Forissier# This value is an upper limit for the key size in any cryptographic algorithm
672409d2ff0SJerome Forissier# implemented by the TEE core.
673409d2ff0SJerome Forissier# Set this to a lower value to reduce the memory footprint.
674409d2ff0SJerome ForissierCFG_CORE_BIGNUM_MAX_BITS ?= 4096
675a97bc4a0SJens Wiklander
6767fb525f1SJerome Forissier# Not used since libmpa was removed. Force the values to catch build scripts
6777fb525f1SJerome Forissier# that would set = n.
6787fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS_MPI,y)
6797fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS,y)
680a97bc4a0SJens Wiklander
681a97bc4a0SJens Wiklander# Compile the TA library mbedTLS with self test functions, the functions
682a97bc4a0SJens Wiklander# need to be called to test anything
683a97bc4a0SJens WiklanderCFG_TA_MBEDTLS_SELF_TEST ?= y
684017dfaf8SGabor Szekely
68568689d86SJens Wiklander# By default use tomcrypt as the main crypto lib providing an implementation
68668689d86SJens Wiklander# for the API in <crypto/crypto.h>
68768689d86SJens Wiklander# CFG_CRYPTOLIB_NAME is used as libname and
68868689d86SJens Wiklander# CFG_CRYPTOLIB_DIR is used as libdir when compiling the library
68977327d7aSEdison Ai#
69077327d7aSEdison Ai# It's also possible to configure to use mbedtls instead of tomcrypt.
69177327d7aSEdison Ai# Then the variables should be assigned as "CFG_CRYPTOLIB_NAME=mbedtls" and
69277327d7aSEdison Ai# "CFG_CRYPTOLIB_DIR=lib/libmbedtls" respectively.
69368689d86SJens WiklanderCFG_CRYPTOLIB_NAME ?= tomcrypt
69468689d86SJens WiklanderCFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt
69568689d86SJens Wiklander
6967fb525f1SJerome Forissier# Not used since libmpa was removed. Force the value to catch build scripts
6977fb525f1SJerome Forissier# that would set = n.
6987fb525f1SJerome Forissier$(call force,CFG_CORE_MBEDTLS_MPI,y)
6997fb525f1SJerome Forissier
70015216d4dSVolodymyr Babchuk# Enable virtualization support. OP-TEE will not work without compatible
70115216d4dSVolodymyr Babchuk# hypervisor if this option is enabled.
70215216d4dSVolodymyr BabchukCFG_VIRTUALIZATION ?= n
70315216d4dSVolodymyr Babchuk
70415216d4dSVolodymyr Babchukifeq ($(CFG_VIRTUALIZATION),y)
70515216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RODATA_NOEXEC,y)
70615216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RWDATA_NOEXEC,y)
707c4e8be26SVolodymyr Babchuk
708c4e8be26SVolodymyr Babchuk# Default number of virtual guests
709c4e8be26SVolodymyr BabchukCFG_VIRT_GUEST_COUNT ?= 2
71015216d4dSVolodymyr Babchukendif
71115216d4dSVolodymyr Babchuk
71217888736SJens Wiklander# Enables backwards compatible derivation of RPMB and SSK keys
71317888736SJens WiklanderCFG_CORE_HUK_SUBKEY_COMPAT ?= y
714a2087649SJerome Forissier
71533b38f8cSRuslan Piasetskyi# Use SoC specific tee_otp_get_die_id() implementation for SSK key generation.
71633b38f8cSRuslan Piasetskyi# This option depends on CFG_CORE_HUK_SUBKEY_COMPAT=y.
71733b38f8cSRuslan PiasetskyiCFG_CORE_HUK_SUBKEY_COMPAT_USE_OTP_DIE_ID ?= n
71833b38f8cSRuslan Piasetskyi
719a2087649SJerome Forissier# Compress and encode conf.mk into the TEE core, and show the encoded string on
720a2087649SJerome Forissier# boot (with severity TRACE_INFO).
721a2087649SJerome ForissierCFG_SHOW_CONF_ON_BOOT ?= n
722dd333f03SJavier Almansa Sobrino
723dd333f03SJavier Almansa Sobrino# Enables support for passing a TPM Event Log stored in secure memory
724145035ffSImre Kis# to a TA or FF-A SP, so a TPM Service could use it to extend any measurement
725dd333f03SJavier Almansa Sobrino# taken before the service was up and running.
726dd333f03SJavier Almansa SobrinoCFG_CORE_TPM_EVENT_LOG ?= n
727ae8c8068SEtienne Carriere
728ae8c8068SEtienne Carriere# When enabled, CFG_SCMI_MSG_DRIVERS embeds SCMI message drivers in the core.
729ae8c8068SEtienne Carriere# Refer to the supported SCMI features embedded upon CFG_SCMI_MSG_*
73028e51326SEtienne Carriere#
731a7a9e3baSEtienne Carriere# CFG_SCMI_MSG_CLOCK embeds SCMI clock protocol support.
73256a1f10eSEtienne Carriere# CFG_SCMI_MSG_RESET_DOMAIN embeds SCMI reset domain protocol support.
73328e51326SEtienne Carriere# CFG_SCMI_MSG_SMT embeds a SMT header in shared device memory buffers
734f37af03eSEtienne Carriere# CFG_SCMI_MSG_VOLTAGE_DOMAIN embeds SCMI voltage domain protocol support.
73528e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_FASTCALL_ENTRY embeds fastcall SMC entry with SMT memory
73628e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_INTERRUPT_ENTRY embeds interrupt entry with SMT memory
73728e51326SEtienne Carriere# CFG_SCMI_MSG_SMT_THREAD_ENTRY embeds threaded entry with SMT memory
738916cc52aSEtienne Carriere# CFG_SCMI_MSG_SHM_MSG embeds a MSG header in cached shared memory buffer
739ae8c8068SEtienne CarriereCFG_SCMI_MSG_DRIVERS ?= n
74028e51326SEtienne Carriereifeq ($(CFG_SCMI_MSG_DRIVERS),y)
741a7a9e3baSEtienne CarriereCFG_SCMI_MSG_CLOCK ?= n
74256a1f10eSEtienne CarriereCFG_SCMI_MSG_RESET_DOMAIN ?= n
743916cc52aSEtienne CarriereCFG_SCMI_MSG_SHM_MSG ?= n
744a58c4d70SEtienne CarriereCFG_SCMI_MSG_SMT ?= n
74528e51326SEtienne CarriereCFG_SCMI_MSG_SMT_FASTCALL_ENTRY ?= n
74628e51326SEtienne CarriereCFG_SCMI_MSG_SMT_INTERRUPT_ENTRY ?= n
74728e51326SEtienne CarriereCFG_SCMI_MSG_SMT_THREAD_ENTRY ?= n
74828e51326SEtienne CarriereCFG_SCMI_MSG_THREAD_ENTRY ?= n
749f37af03eSEtienne CarriereCFG_SCMI_MSG_VOLTAGE_DOMAIN ?= n
75028e51326SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SCMI_MSG_SMT_FASTCALL_ENTRY,CFG_SCMI_MSG_SMT))
75128e51326SEtienne Carriere$(eval $(call cfg-depends-all,CFG_SCMI_MSG_SMT_INTERRUPT_ENTRY,CFG_SCMI_MSG_SMT))
752916cc52aSEtienne Carriere$(eval $(call cfg-depends-one,CFG_SCMI_MSG_SMT_THREAD_ENTRY,CFG_SCMI_MSG_SMT CFG_SCMI_MSG_SHM_MSG))
75328e51326SEtienne Carriereendif
75442471ecfSJens Wiklander
755b0a1c250SEtienne Carriere# Enable SCMI PTA interface for REE SCMI agents
756b0a1c250SEtienne CarriereCFG_SCMI_PTA ?= n
757b0a1c250SEtienne Carriere
75842471ecfSJens Wiklanderifneq ($(CFG_STMM_PATH),)
759f9cd31c5SJelle Sels$(call force,CFG_WITH_STMM_SP,y)
76042471ecfSJens Wiklanderelse
761f9cd31c5SJelle SelsCFG_WITH_STMM_SP ?= n
76242471ecfSJens Wiklanderendif
763f9cd31c5SJelle Selsifeq ($(CFG_WITH_STMM_SP),y)
76442471ecfSJens Wiklander$(call force,CFG_ZLIB,y)
76542471ecfSJens Wiklanderendif
7666915bbbbSJens Wiklander
7676915bbbbSJens Wiklander# When enabled checks that buffers passed to the GP Internal Core API
7686915bbbbSJens Wiklander# comply with the rules added as annotations as part of the definition of
7696915bbbbSJens Wiklander# the API. For example preventing buffers in non-secure shared memory when
7706915bbbbSJens Wiklander# not allowed.
7716915bbbbSJens WiklanderCFG_TA_STRICT_ANNOTATION_CHECKS ?= y
772c56cc686SJens Wiklander
773c56cc686SJens Wiklander# When enabled accepts the DES key sizes excluding parity bits as in
774c56cc686SJens Wiklander# the GP Internal API Specification v1.0
775c56cc686SJens WiklanderCFG_COMPAT_GP10_DES ?= y
776806a85faSJens Wiklander
777806a85faSJens Wiklander# Defines a limit for many levels TAs may call each others.
778806a85faSJens WiklanderCFG_CORE_MAX_SYSCALL_RECURSION ?= 4
779f2dad489SSergiy Kibrik
780f2dad489SSergiy Kibrik# Pseudo-TA to export hardware RNG output to Normal World
781f2dad489SSergiy Kibrik# RNG characteristics are platform specific
782f2dad489SSergiy KibrikCFG_HWRNG_PTA ?= n
783f2dad489SSergiy Kibrikifeq ($(CFG_HWRNG_PTA),y)
784f2dad489SSergiy Kibrik# Output rate of hw_get_random_bytes() in bytes per second, 0: not rate-limited
785f2dad489SSergiy KibrikCFG_HWRNG_RATE ?= 0
786f2dad489SSergiy Kibrik# Quality/entropy of hw_get_random_bytes() per 1024 bits of output data, in bits
787f2dad489SSergiy Kibrikifeq (,$(CFG_HWRNG_QUALITY))
788f2dad489SSergiy Kibrik$(error CFG_HWRNG_QUALITY not defined)
789f2dad489SSergiy Kibrikendif
790f2dad489SSergiy Kibrikendif
79188876632SEtienne Carriere
79288876632SEtienne Carriere# CFG_PREALLOC_RPC_CACHE, when enabled, makes core to preallocate
79388876632SEtienne Carriere# shared memory for each secure thread. When disabled, RPC shared
79488876632SEtienne Carriere# memory is released once the secure thread has completed is execution.
79588876632SEtienne Carriereifeq ($(CFG_WITH_PAGER),y)
79688876632SEtienne CarriereCFG_PREALLOC_RPC_CACHE ?= n
79788876632SEtienne Carriereendif
79888876632SEtienne CarriereCFG_PREALLOC_RPC_CACHE ?= y
7992305544bSClément Léger
8002305544bSClément Léger# When enabled, CFG_DRIVERS_CLK embeds a clock framework in OP-TEE core.
8012305544bSClément Léger# This clock framework allows to describe clock tree and provides functions to
8022305544bSClément Léger# get and configure the clocks.
803dbe94a85SClément Léger# CFG_DRIVERS_CLK_DT embeds devicetree clock parsing support
804804e32d7SClément Léger# CFG_DRIVERS_CLK_FIXED add support for "fixed-clock" compatible clocks
80517fd9102SEtienne Carriere# CFG_DRIVERS_CLK_EARLY_PROBE makes clocks probed at early_init initcall level.
8062305544bSClément LégerCFG_DRIVERS_CLK ?= n
807dbe94a85SClément LégerCFG_DRIVERS_CLK_DT ?= $(call cfg-all-enabled,CFG_DRIVERS_CLK CFG_DT)
808804e32d7SClément LégerCFG_DRIVERS_CLK_FIXED ?= $(CFG_DRIVERS_CLK_DT)
80917fd9102SEtienne CarriereCFG_DRIVERS_CLK_EARLY_PROBE ?= $(CFG_DRIVERS_CLK_DT)
810dbe94a85SClément Léger
811d547c99aSEtienne Carriere$(eval $(call cfg-depends-all,CFG_DRIVERS_CLK_DT,CFG_DRIVERS_CLK CFG_DT))
812d547c99aSEtienne Carriere$(eval $(call cfg-depends-all,CFG_DRIVERS_CLK_FIXED,CFG_DRIVERS_CLK_DT))
813d547c99aSEtienne Carriere
814c78b2c66SEtienne Carriere# When enabled, CFG_DRIVERS_RSTCTRL embeds a reset controller framework in
815c78b2c66SEtienne Carriere# OP-TEE core to provide reset controls on subsystems of the devices.
816c78b2c66SEtienne CarriereCFG_DRIVERS_RSTCTRL ?= n
817c78b2c66SEtienne Carriere
8189e42008dSJoakim Bech# The purpose of this flag is to show a print when booting up the device that
8199e42008dSJoakim Bech# indicates whether the board runs a standard developer configuration or not.
8209e42008dSJoakim Bech# A developer configuration doesn't necessarily has to be secure. The intention
8219e42008dSJoakim Bech# is that the one making products based on OP-TEE should override this flag in
8229e42008dSJoakim Bech# plat-xxx/conf.mk for the platform they're basing their products on after
8239e42008dSJoakim Bech# they've finalized implementing stubbed functionality (see OP-TEE
8249e42008dSJoakim Bech# documentation/Porting guidelines) as well as vendor specific security
8259e42008dSJoakim Bech# configuration.
8269e42008dSJoakim BechCFG_WARN_INSECURE ?= y
8279e42008dSJoakim Bech
828a748f9edSJens Wiklander# Enables warnings for declarations mixed with statements
829a748f9edSJens WiklanderCFG_WARN_DECL_AFTER_STATEMENT ?= y
830b7a623f8SRuchika Gupta
831b7a623f8SRuchika Gupta# Branch Target Identification (part of the ARMv8.5 Extensions) provides a
832b7a623f8SRuchika Gupta# mechanism to limit the set of locations to which computed branch instructions
833b7a623f8SRuchika Gupta# such as BR or BLR can jump. To make use of BTI in TEE core and ldelf on CPU's
834b7a623f8SRuchika Gupta# that support it, enable this option. A GCC toolchain built with
835b7a623f8SRuchika Gupta# --enable-standard-branch-protection is needed to use this option.
836b7a623f8SRuchika GuptaCFG_CORE_BTI ?= n
837b7a623f8SRuchika Gupta
838b7a623f8SRuchika Gupta$(eval $(call cfg-depends-all,CFG_CORE_BTI,CFG_ARM64_core))
839b7a623f8SRuchika Gupta
840b7a623f8SRuchika Gupta# To make use of BTI in user space libraries and TA's on CPU's that support it,
841b7a623f8SRuchika Gupta# enable this option.
842b7a623f8SRuchika GuptaCFG_TA_BTI ?= $(CFG_CORE_BTI)
843b7a623f8SRuchika Gupta
844b7a623f8SRuchika Gupta$(eval $(call cfg-depends-all,CFG_TA_BTI,CFG_ARM64_core))
845b7a623f8SRuchika Gupta
846b7a623f8SRuchika Guptaifeq (y-y,$(CFG_VIRTUALIZATION)-$(call cfg-one-enabled, CFG_TA_BTI CFG_CORE_BTI))
847b7a623f8SRuchika Gupta$(error CFG_VIRTUALIZATION and BTI are currently incompatible)
848b7a623f8SRuchika Guptaendif
849b7a623f8SRuchika Gupta
850b7a623f8SRuchika Guptaifeq (y-y,$(CFG_PAGED_USER_TA)-$(CFG_TA_BTI))
851b7a623f8SRuchika Gupta$(error CFG_PAGED_USER_TA and CFG_TA_BTI are currently incompatible)
852b7a623f8SRuchika Guptaendif
853c2d44948SJens Wiklander
854a0e8ffe9SJens Wiklander# Memory Tagging Extension (part of the ARMv8.5 Extensions) implements lock
855a0e8ffe9SJens Wiklander# and key access to memory. This is a hardware supported alternative to
856a0e8ffe9SJens Wiklander# CFG_CORE_SANITIZE_KADDRESS which covers both S-EL1 and S-EL0.
857a0e8ffe9SJens WiklanderCFG_MEMTAG ?= n
858a0e8ffe9SJens Wiklander
859a0e8ffe9SJens Wiklander$(eval $(call cfg-depends-all,CFG_MEMTAG,CFG_ARM64_core))
860a0e8ffe9SJens Wiklanderifeq (y-y,$(CFG_CORE_SANITIZE_KADDRESS)-$(CFG_MEMTAG))
861a0e8ffe9SJens Wiklander$(error CFG_CORE_SANITIZE_KADDRESS and CFG_MEMTAG are not compatible)
862a0e8ffe9SJens Wiklanderendif
863a0e8ffe9SJens Wiklanderifeq (y-y,$(CFG_WITH_PAGER)-$(CFG_MEMTAG))
864a0e8ffe9SJens Wiklander$(error CFG_WITH_PAGER and CFG_MEMTAG are not compatible)
865a0e8ffe9SJens Wiklanderendif
866a0e8ffe9SJens Wiklander
867c2d44948SJens Wiklander# CFG_CORE_ASYNC_NOTIF is defined by the platform to enable enables support
868c2d44948SJens Wiklander# for sending asynchronous notifications to normal world. Note that an
869c2d44948SJens Wiklander# interrupt ID must be configurged by the platform too. Currently is only
870c2d44948SJens Wiklander# CFG_CORE_ASYNC_NOTIF_GIC_INTID defined.
871c2d44948SJens WiklanderCFG_CORE_ASYNC_NOTIF ?= n
872a51d45b5SJens Wiklander
873a51d45b5SJens Wiklander$(eval $(call cfg-enable-all-depends,CFG_MEMPOOL_REPORT_LAST_OFFSET, \
874a51d45b5SJens Wiklander	 CFG_WITH_STATS))
875bb329115SRuchika Gupta
87693dc6b29SJens Wiklander# Pointer Authentication (part of ARMv8.3 Extensions) provides instructions
87793dc6b29SJens Wiklander# for signing and authenticating pointers against secret keys. These can
87893dc6b29SJens Wiklander# be used to mitigate ROP (Return oriented programming) attacks. This is
87993dc6b29SJens Wiklander# currently done by instructing the compiler to add paciasp/autiasp at the
88093dc6b29SJens Wiklander# begging and end of functions to sign and verify ELR.
88193dc6b29SJens Wiklander#
88293dc6b29SJens Wiklander# The CFG_CORE_PAUTH enables these instructions for the core parts
88393dc6b29SJens Wiklander# executing at EL1, with one secret key per thread and one secret key per
88493dc6b29SJens Wiklander# physical CPU.
88593dc6b29SJens Wiklander#
88693dc6b29SJens Wiklander# The CFG_TA_PAUTH option enables these instructions for TA's at EL0. When
88793dc6b29SJens Wiklander# this option is enabled, TEE core will initialize secret keys per TA.
88893dc6b29SJens WiklanderCFG_CORE_PAUTH ?= n
88993dc6b29SJens WiklanderCFG_TA_PAUTH ?= $(CFG_CORE_PAUTH)
890bb329115SRuchika Gupta
89193dc6b29SJens Wiklander$(eval $(call cfg-depends-all,CFG_CORE_PAUTH,CFG_ARM64_core))
892bb329115SRuchika Gupta$(eval $(call cfg-depends-all,CFG_TA_PAUTH,CFG_ARM64_core))
8936b35a0abSRuchika Gupta
89493dc6b29SJens Wiklanderifeq (y-y,$(CFG_VIRTUALIZATION)-$(CFG_CORE_PAUTH))
89593dc6b29SJens Wiklander$(error CFG_VIRTUALIZATION and CFG_CORE_PAUTH are currently incompatible)
89693dc6b29SJens Wiklanderendif
8976b35a0abSRuchika Guptaifeq (y-y,$(CFG_VIRTUALIZATION)-$(CFG_TA_PAUTH))
8986b35a0abSRuchika Gupta$(error CFG_VIRTUALIZATION and CFG_TA_PAUTH are currently incompatible)
8996b35a0abSRuchika Guptaendif
9006b35a0abSRuchika Gupta
9016b35a0abSRuchika Guptaifeq (y-y,$(CFG_TA_GPROF_SUPPORT)-$(CFG_TA_PAUTH))
9026b35a0abSRuchika Gupta$(error CFG_TA_GPROF_SUPPORT and CFG_TA_PAUTH are currently incompatible)
9036b35a0abSRuchika Guptaendif
9046b35a0abSRuchika Gupta
9056b35a0abSRuchika Guptaifeq (y-y,$(CFG_FTRACE_SUPPORT)-$(CFG_TA_PAUTH))
9066b35a0abSRuchika Gupta$(error CFG_FTRACE_SUPPORT and CFG_TA_PAUTH are currently incompatible)
9076b35a0abSRuchika Guptaendif
908011a8f96SClément Léger
909011a8f96SClément Léger# Enable support for generic watchdog registration
910011a8f96SClément Léger# This watchdog will then be usable by non-secure world through SMC calls.
911011a8f96SClément LégerCFG_WDT ?= n
912cb60bce4SClément Léger
913cb60bce4SClément Léger# Enable watchdog SMC handling compatible with arm-smc-wdt Linux driver
914cb60bce4SClément Léger# When enabled, CFG_WDT_SM_HANDLER_ID must be defined with a SMC ID
915cb60bce4SClément LégerCFG_WDT_SM_HANDLER ?= n
916cb60bce4SClément Léger
917cb60bce4SClément Léger$(eval $(call cfg-enable-all-depends,CFG_WDT_SM_HANDLER,CFG_WDT))
918cb60bce4SClément Légerifeq (y-,$(CFG_WDT_SM_HANDLER)-$(CFG_WDT_SM_HANDLER_ID))
919cb60bce4SClément Léger$(error CFG_WDT_SM_HANDLER_ID must be defined when enabling CFG_WDT_SM_HANDLER)
920cb60bce4SClément Légerendif
92134d244bfSClément Léger
92234d244bfSClément Léger# Allow using the udelay/mdelay function for platforms without ARM generic timer
92334d244bfSClément Léger# extension. When set to 'n', the plat_get_freq() function must be defined by
92434d244bfSClément Léger# the platform code
92534d244bfSClément LégerCFG_CORE_HAS_GENERIC_TIMER ?= y
926f3f9432fSClément Léger
927f3f9432fSClément Léger# Enable RTC API
928f3f9432fSClément LégerCFG_DRIVERS_RTC ?= n
929cea1eb0bSClément Léger
930cea1eb0bSClément Léger# Enable PTA for RTC access from non-secure world
931cea1eb0bSClément LégerCFG_RTC_PTA ?= n
932952f5260SRuchika Gupta
933952f5260SRuchika Gupta# Enable TPM2
934952f5260SRuchika GuptaCFG_DRIVERS_TPM2 ?= n
9355916069bSRuchika GuptaCFG_DRIVERS_TPM2_MMIO ?= n
9362e1b85feSRuchika Guptaifeq ($(CFG_CORE_TPM_EVENT_LOG),y)
9372e1b85feSRuchika GuptaCFG_CORE_TCG_PROVIDER ?= $(CFG_DRIVERS_TPM2)
9382e1b85feSRuchika Guptaendif
9391fdb1c4fSJelle Sels
9401fdb1c4fSJelle Sels# Enable the FF-A SPMC tests in xtests
9411fdb1c4fSJelle SelsCFG_SPMC_TESTS ?= n
942bfdeae23SJens Wiklander
943bfdeae23SJens Wiklander# Allocate the translation tables needed to map the S-EL0 application
944bfdeae23SJens Wiklander# loaded
945bfdeae23SJens WiklanderCFG_CORE_PREALLOC_EL0_TBLS ?= n
946bfdeae23SJens Wiklanderifeq (y-y,$(CFG_CORE_PREALLOC_EL0_TBLS)-$(CFG_WITH_PAGER))
947bfdeae23SJens Wiklander$(error "CFG_WITH_PAGER can't support CFG_CORE_PREALLOC_EL0_TBLS")
948bfdeae23SJens Wiklanderendif
949cb94c145SWeizhao Jiang
950cb94c145SWeizhao Jiang# User TA runtime context dump.
951cb94c145SWeizhao Jiang# When this option is enabled, OP-TEE provides a debug method for
952cb94c145SWeizhao Jiang# developer to dump user TA's runtime context, including TA's heap stats.
953cb94c145SWeizhao Jiang# Developer can open a stats PTA session and then invoke command
954cb94c145SWeizhao Jiang# STATS_CMD_TA_STATS to get the context of loaded TAs.
955cb94c145SWeizhao JiangCFG_TA_STATS ?= n
956*7e75ca54SJens Wiklander
957*7e75ca54SJens Wiklander# Enables best effort mitigations against fault injected when the hardware
958*7e75ca54SJens Wiklander# is tampered with. Details in lib/libutils/ext/include/fault_mitigation.h
959*7e75ca54SJens WiklanderCFG_FAULT_MITIGATION ?= y
960