xref: /rk3399_ARM-atf/make_helpers/constraints.mk (revision ef397720a44e5caea76b9093644c27453af166b8)
1b14987cfSBoyan Karatotev#
2b14987cfSBoyan Karatotev# Copyright (c) 2025, Arm Limited. All rights reserved.
3b14987cfSBoyan Karatotev#
4b14987cfSBoyan Karatotev# SPDX-License-Identifier: BSD-3-Clause
5b14987cfSBoyan Karatotev#
6b14987cfSBoyan Karatotev
7b14987cfSBoyan Karatotevifneq ($(AARCH32_INSTRUCTION_SET),$(filter $(AARCH32_INSTRUCTION_SET),A32 T32))
8b14987cfSBoyan Karatotev         $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET})
9b14987cfSBoyan Karatotevendif
10b14987cfSBoyan Karatotev
115e827bf0STimothy Hayes# Make sure RME configuration is valid
125e827bf0STimothy Hayesifeq (${ENABLE_RME},1)
135e827bf0STimothy Hayes	ifneq (${SEPARATE_CODE_AND_RODATA},1)
145e827bf0STimothy Hayes                $(error ENABLE_RME requires SEPARATE_CODE_AND_RODATA)
155e827bf0STimothy Hayes	endif
165e827bf0STimothy Hayes
17b14987cfSBoyan Karatotev	ifneq (${ARCH},aarch64)
18b14987cfSBoyan Karatotev                $(error ENABLE_RME requires AArch64)
19b14987cfSBoyan Karatotev	endif
205e827bf0STimothy Hayes
21b14987cfSBoyan Karatotev	ifeq ($(SPMC_AT_EL3),1)
22b14987cfSBoyan Karatotev                $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.)
23b14987cfSBoyan Karatotev	endif
24b14987cfSBoyan Karatotev
25b14987cfSBoyan Karatotev	ifneq (${SPD}, none)
26b14987cfSBoyan Karatotev		ifneq (${SPD}, spmd)
27b14987cfSBoyan Karatotev                        $(error ENABLE_RME is incompatible with SPD=${SPD}. Use SPD=spmd)
28b14987cfSBoyan Karatotev		endif
29b14987cfSBoyan Karatotev	endif
305e827bf0STimothy Hayeselse
315e827bf0STimothy Hayes	ifeq (${ENABLE_FEAT_RME_GDI},1)
325e827bf0STimothy Hayes                $(error ENABLE_FEAT_RME_GDI requires ENABLE_RME)
335e827bf0STimothy Hayes	endif
34b14987cfSBoyan Karatotevendif
35b14987cfSBoyan Karatotev
36b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_EL2_REGS}, 1)
37b14987cfSBoyan Karatotev	ifeq (${SPD},none)
38b14987cfSBoyan Karatotev		ifeq (${ENABLE_RME},0)
39b14987cfSBoyan Karatotev                        $(error CTX_INCLUDE_EL2_REGS is available only when SPD \
40b14987cfSBoyan Karatotev                        or RME is enabled)
41b14987cfSBoyan Karatotev		endif
42b14987cfSBoyan Karatotev	endif
43b14987cfSBoyan Karatotevendif
44b14987cfSBoyan Karatotev
45b14987cfSBoyan Karatotev################################################################################
46b14987cfSBoyan Karatotev# Verify FEAT_RME, FEAT_SCTLR2 and FEAT_TCR2 are enabled if FEAT_MEC is enabled.
47b14987cfSBoyan Karatotev################################################################################
48b14987cfSBoyan Karatotev
49b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_MEC},0)
50b14987cfSBoyan Karatotev    ifeq (${ENABLE_RME},0)
51b14987cfSBoyan Karatotev        $(error FEAT_RME must be enabled when FEAT_MEC is enabled.)
52b14987cfSBoyan Karatotev    endif
53b14987cfSBoyan Karatotev    ifeq (${ENABLE_FEAT_TCR2},0)
54b14987cfSBoyan Karatotev        $(error FEAT_TCR2 must be enabled when FEAT_MEC is enabled.)
55b14987cfSBoyan Karatotev    endif
56b14987cfSBoyan Karatotev    ifeq (${ENABLE_FEAT_SCTLR2},0)
57b14987cfSBoyan Karatotev        $(error FEAT_SCTLR2 must be enabled when FEAT_MEC is enabled.)
58b14987cfSBoyan Karatotev    endif
59b14987cfSBoyan Karatotevendif
60b14987cfSBoyan Karatotev
61b14987cfSBoyan Karatotev# Handle all invalid build configurations with SPMD usage.
62b14987cfSBoyan Karatotevifeq (${ENABLE_SPMD_LP}, 1)
63b14987cfSBoyan Karatotevifneq (${SPD},spmd)
64b14987cfSBoyan Karatotev        $(error Error: ENABLE_SPMD_LP requires SPD=spmd.)
65b14987cfSBoyan Karatotevendif
66b14987cfSBoyan Karatotevifeq ($(SPMC_AT_EL3),1)
67b14987cfSBoyan Karatotev        $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.)
68b14987cfSBoyan Karatotevendif
69b14987cfSBoyan Karatotevendif
70b14987cfSBoyan Karatotev
71b14987cfSBoyan Karatotevifneq (${SPD},none)
72b14987cfSBoyan Karatotevifeq (${ARCH},aarch32)
73b14987cfSBoyan Karatotev        $(error "Error: SPD is incompatible with AArch32.")
74b14987cfSBoyan Karatotevendif
75b14987cfSBoyan Karatotevifdef EL3_PAYLOAD_BASE
76b14987cfSBoyan Karatotev        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
77b14987cfSBoyan Karatotev        $(warning "The SPD and its BL32 companion will be present but ignored.")
78b14987cfSBoyan Karatotevendif
79b14987cfSBoyan Karatotevifeq (${SPD},spmd)
80b14987cfSBoyan Karatotevifeq ($(SPMD_SPM_AT_SEL2),1)
81b14987cfSBoyan Karatotev        ifeq ($(SPMC_AT_EL3),1)
82b14987cfSBoyan Karatotev                $(error SPM cannot be enabled in both S-EL2 and EL3.)
83b14987cfSBoyan Karatotev        endif
84b14987cfSBoyan Karatotev        ifeq ($(CTX_INCLUDE_SVE_REGS),1)
85b14987cfSBoyan Karatotev                $(error SVE context management not needed with Hafnium SPMC.)
86b14987cfSBoyan Karatotev        endif
87b14987cfSBoyan Karatotevendif
88b14987cfSBoyan Karatotev
89b14987cfSBoyan Karatotevifeq ($(SPMC_AT_EL3_SEL0_SP),1)
90b14987cfSBoyan Karatotev        ifneq ($(SPMC_AT_EL3),1)
91b14987cfSBoyan Karatotev                $(error SEL0 SP cannot be enabled without SPMC at EL3)
92b14987cfSBoyan Karatotev        endif
93b14987cfSBoyan Karatotevendif
94b14987cfSBoyan Karatotevendif #(SPD=spmd)
95b14987cfSBoyan Karatotevendif #(SPD!=none)
96b14987cfSBoyan Karatotev
97b14987cfSBoyan Karatotev# USE_DEBUGFS experimental feature recommended only in debug builds
98b14987cfSBoyan Karatotevifeq (${USE_DEBUGFS},1)
99b14987cfSBoyan Karatotev        ifeq (${DEBUG},1)
100b14987cfSBoyan Karatotev                $(warning DEBUGFS experimental feature is enabled.)
101b14987cfSBoyan Karatotev        else
102b14987cfSBoyan Karatotev                $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY)
103b14987cfSBoyan Karatotev        endif
104b14987cfSBoyan Karatotevendif #(USE_DEBUGFS)
105b14987cfSBoyan Karatotev
106b14987cfSBoyan Karatotev# USE_SPINLOCK_CAS requires AArch64 build
107b14987cfSBoyan Karatotevifeq (${USE_SPINLOCK_CAS},1)
108b14987cfSBoyan Karatotev        ifneq (${ARCH},aarch64)
109b14987cfSBoyan Karatotev               $(error USE_SPINLOCK_CAS requires AArch64)
110b14987cfSBoyan Karatotev        endif
111b14987cfSBoyan Karatotevendif #(USE_SPINLOCK_CAS)
112b14987cfSBoyan Karatotev
113b14987cfSBoyan Karatotevifdef EL3_PAYLOAD_BASE
114b14987cfSBoyan Karatotev	ifdef PRELOADED_BL33_BASE
115b14987cfSBoyan Karatotev                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
116b14987cfSBoyan Karatotev                incompatible build options. EL3_PAYLOAD_BASE has priority.")
117b14987cfSBoyan Karatotev	endif
118b14987cfSBoyan Karatotev	ifneq (${GENERATE_COT},0)
119b14987cfSBoyan Karatotev                $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible \
120b14987cfSBoyan Karatotev                build options.")
121b14987cfSBoyan Karatotev	endif
122b14987cfSBoyan Karatotev	ifneq (${TRUSTED_BOARD_BOOT},0)
123b14987cfSBoyan Karatotev                $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are \
124b14987cfSBoyan Karatotev                incompatible \ build options.")
125b14987cfSBoyan Karatotev	endif
126b14987cfSBoyan Karatotevendif #(EL3_PAYLOAD_BASE)
127b14987cfSBoyan Karatotev
128b14987cfSBoyan Karatotevifeq (${NEED_BL33},yes)
129b14987cfSBoyan Karatotev	ifdef EL3_PAYLOAD_BASE
130b14987cfSBoyan Karatotev                $(warning "BL33 image is not needed when option \
131b14987cfSBoyan Karatotev                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
132b14987cfSBoyan Karatotev	endif
133b14987cfSBoyan Karatotev	ifdef PRELOADED_BL33_BASE
134b14987cfSBoyan Karatotev                $(warning "BL33 image is not needed when option \
135b14987cfSBoyan Karatotev                PRELOADED_BL33_BASE is used and won't be added to the FIP file.")
136b14987cfSBoyan Karatotev	endif
137b14987cfSBoyan Karatotevendif #(NEED_BL33)
138b14987cfSBoyan Karatotev
139b14987cfSBoyan Karatotev# When building for systems with hardware-assisted coherency, there's no need to
140b14987cfSBoyan Karatotev# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
141b14987cfSBoyan Karatotevifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1)
142b14987cfSBoyan Karatotev        $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
143b14987cfSBoyan Karatotevendif
144b14987cfSBoyan Karatotev
145b14987cfSBoyan Karatotev#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1.
146b14987cfSBoyan Karatotevifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1)
147b14987cfSBoyan Karatotev        $(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled")
148b14987cfSBoyan Karatotevendif
149b14987cfSBoyan Karatotev
150b14987cfSBoyan Karatotev# RAS_EXTENSION is deprecated, provide alternate build options
151b14987cfSBoyan Karatotevifeq ($(RAS_EXTENSION),1)
152b14987cfSBoyan Karatotev        $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS \
153b14987cfSBoyan Karatotev        and HANDLE_EA_EL3_FIRST_NS instead")
154b14987cfSBoyan Karatotevendif
155b14987cfSBoyan Karatotev
156b14987cfSBoyan Karatotev
157b14987cfSBoyan Karatotev# When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled
158b14987cfSBoyan Karatotevifeq ($(FAULT_INJECTION_SUPPORT),1)
159b14987cfSBoyan Karatotev	ifeq ($(ENABLE_FEAT_RAS),0)
160b14987cfSBoyan Karatotev                $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0)
161b14987cfSBoyan Karatotev	endif
162b14987cfSBoyan Karatotevendif #(FAULT_INJECTION_SUPPORT)
163b14987cfSBoyan Karatotev
164b14987cfSBoyan Karatotev# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1
165b14987cfSBoyan Karatotevifeq ($(DYN_DISABLE_AUTH), 1)
166b14987cfSBoyan Karatotev	ifeq (${TRUSTED_BOARD_BOOT}, 0)
167b14987cfSBoyan Karatotev                $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH \
168b14987cfSBoyan Karatotev                to be set.")
169b14987cfSBoyan Karatotev	endif
170b14987cfSBoyan Karatotevendif #(DYN_DISABLE_AUTH)
171b14987cfSBoyan Karatotev
172b14987cfSBoyan Karatotev# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
173b14987cfSBoyan Karatotevifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
174b14987cfSBoyan Karatotev        $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled")
175b14987cfSBoyan Karatotevendif
176b14987cfSBoyan Karatotev
177b14987cfSBoyan Karatotev# If pointer authentication is used in the firmware, make sure that all the
178b14987cfSBoyan Karatotev# registers associated to it are also saved and restored.
179b14987cfSBoyan Karatotev# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
180b14987cfSBoyan Karatotevifneq ($(ENABLE_PAUTH),0)
181b14987cfSBoyan Karatotev	ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
182b14987cfSBoyan Karatotev                $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS to be enabled)
183b14987cfSBoyan Karatotev	endif
184b14987cfSBoyan Karatotevendif #(ENABLE_PAUTH)
185b14987cfSBoyan Karatotev
186b14987cfSBoyan Karatotevifneq ($(CTX_INCLUDE_PAUTH_REGS),0)
187b14987cfSBoyan Karatotev	ifneq (${ARCH},aarch64)
188b14987cfSBoyan Karatotev                $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
189b14987cfSBoyan Karatotev	endif
190b14987cfSBoyan Karatotevendif #(CTX_INCLUDE_PAUTH_REGS)
191b14987cfSBoyan Karatotev
192b14987cfSBoyan Karatotev# Check ENABLE_FEAT_PAUTH_LR
193b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_PAUTH_LR},0)
194b14987cfSBoyan Karatotev
195b14987cfSBoyan Karatotev# Make sure PAUTH is enabled
196b14987cfSBoyan Karatotevifeq (${ENABLE_PAUTH},0)
197b14987cfSBoyan Karatotev        $(error Error: PAUTH_LR cannot be used without PAUTH (see BRANCH_PROTECTION))
198b14987cfSBoyan Karatotevendif
199b14987cfSBoyan Karatotev
200b14987cfSBoyan Karatotev# Make sure SCTLR2 is enabled
201b14987cfSBoyan Karatotevifeq (${ENABLE_FEAT_SCTLR2},0)
202b14987cfSBoyan Karatotev        $(error Error: PAUTH_LR cannot be used without ENABLE_FEAT_SCTLR2)
203b14987cfSBoyan Karatotevendif
204b14987cfSBoyan Karatotev
205b14987cfSBoyan Karatotev# FEAT_PAUTH_LR is only supported in aarch64 state
206b14987cfSBoyan Karatotevifneq (${ARCH},aarch64)
207b14987cfSBoyan Karatotev        $(error ENABLE_FEAT_PAUTH_LR requires AArch64)
208b14987cfSBoyan Karatotevendif
209b14987cfSBoyan Karatotev
210b14987cfSBoyan Karatotevendif # ${ENABLE_FEAT_PAUTH_LR}
211b14987cfSBoyan Karatotev
212b14987cfSBoyan Karatotevifeq ($(FEATURE_DETECTION),1)
213b14987cfSBoyan Karatotev        $(info FEATURE_DETECTION is an experimental feature)
214b14987cfSBoyan Karatotevendif #(FEATURE_DETECTION)
215b14987cfSBoyan Karatotev
216b14987cfSBoyan Karatotevifneq ($(ENABLE_SME2_FOR_NS), 0)
217b14987cfSBoyan Karatotev	ifeq (${ENABLE_SME_FOR_NS}, 0)
218b14987cfSBoyan Karatotev                $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also \
219b14987cfSBoyan Karatotev                to be set")
220b14987cfSBoyan Karatotev                $(warning "Forced ENABLE_SME_FOR_NS=1")
221b14987cfSBoyan Karatotev                override ENABLE_SME_FOR_NS	:= 1
222b14987cfSBoyan Karatotev	endif
223b14987cfSBoyan Karatotevendif #(ENABLE_SME2_FOR_NS)
224b14987cfSBoyan Karatotev
225b14987cfSBoyan Karatotevifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
226b14987cfSBoyan Karatotev	ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
227b14987cfSBoyan Karatotev                $(error "ALLOW_RO_XLAT_TABLES requires translation tables \
228b14987cfSBoyan Karatotev                library v2")
229b14987cfSBoyan Karatotev	endif
230b14987cfSBoyan Karatotevendif #(ARM_XLAT_TABLES_LIB_V1)
231b14987cfSBoyan Karatotev
232b14987cfSBoyan Karatotevifneq (${DECRYPTION_SUPPORT},none)
233b14987cfSBoyan Karatotev	ifeq (${TRUSTED_BOARD_BOOT}, 0)
234b14987cfSBoyan Karatotev                $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT \
235b14987cfSBoyan Karatotev                to be set)
236b14987cfSBoyan Karatotev	endif
237b14987cfSBoyan Karatotevendif #(DECRYPTION_SUPPORT)
238b14987cfSBoyan Karatotev
239b14987cfSBoyan Karatotev# Ensure that no Aarch64-only features are enabled in Aarch32 build
240b14987cfSBoyan Karatotevifeq (${ARCH},aarch32)
241dccfb7c1SBoyan Karatotev        ifneq (${ENABLE_LTO},0)
242dccfb7c1SBoyan Karatotev                $(error "ENABLE_LTO is not supported with ARCH=aarch32")
243dccfb7c1SBoyan Karatotev        endif
24401b3d394SBoyan Karatotev        ifneq (${EL3_EXCEPTION_HANDLING},0)
24501b3d394SBoyan Karatotev                $(error "EL3_EXCEPTION_HANDLING is not supported outside BL31")
24601b3d394SBoyan Karatotev        endif
24701b3d394SBoyan Karatotev
24801b3d394SBoyan Karatotev        ifeq (${CRASH_REPORTING},1)
24901b3d394SBoyan Karatotev                $(error "CRASH_REPORTING is not supported with ARCH=aarch32")
25001b3d394SBoyan Karatotev        endif
251b14987cfSBoyan Karatotev
252b14987cfSBoyan Karatotev	# SME/SVE only supported on AArch64
253b14987cfSBoyan Karatotev	ifneq (${ENABLE_SME_FOR_NS},0)
254b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32")
255b14987cfSBoyan Karatotev	endif
256b14987cfSBoyan Karatotev
257b14987cfSBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_NS},1)
258b14987cfSBoyan Karatotev		# Warning instead of error due to CI dependency on this
259b14987cfSBoyan Karatotev                $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32")
260b14987cfSBoyan Karatotev	endif
261b14987cfSBoyan Karatotev
262b14987cfSBoyan Karatotev	# BRBE is not supported in AArch32
263b14987cfSBoyan Karatotev	ifeq (${ENABLE_BRBE_FOR_NS},1)
264b14987cfSBoyan Karatotev                $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32")
265b14987cfSBoyan Karatotev	endif
266b14987cfSBoyan Karatotev
267b14987cfSBoyan Karatotev	# FEAT_RNG_TRAP is not supported in AArch32
268b14987cfSBoyan Karatotev	ifneq (${ENABLE_FEAT_RNG_TRAP},0)
269b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32")
270b14987cfSBoyan Karatotev	endif
271b14987cfSBoyan Karatotev
272b14987cfSBoyan Karatotev	ifneq (${ENABLE_FEAT_FPMR},0)
273b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_FPMR cannot be used with ARCH=aarch32")
274b14987cfSBoyan Karatotev	endif
275b14987cfSBoyan Karatotev
276b14987cfSBoyan Karatotev	ifeq (${ARCH_FEATURE_AVAILABILITY},1)
277b14987cfSBoyan Karatotev                $(error "ARCH_FEATURE_AVAILABILITY cannot be used with ARCH=aarch32")
278b14987cfSBoyan Karatotev	endif
279b14987cfSBoyan Karatotev	# FEAT_MOPS is only supported on AArch64
280b14987cfSBoyan Karatotev	ifneq (${ENABLE_FEAT_MOPS},0)
281b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_MOPS cannot be used with ARCH=aarch32")
282b14987cfSBoyan Karatotev	endif
283b14987cfSBoyan Karatotev	ifneq (${ENABLE_FEAT_GCIE},0)
284b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_GCIE cannot be used with ARCH=aarch32")
285b14987cfSBoyan Karatotev	endif
286a1032bebSJohn Powell	ifneq (${ENABLE_FEAT_CPA2},0)
287a1032bebSJohn Powell                $(error "ENABLE_FEAT_CPA2 cannot be used with ARCH=aarch32")
288a1032bebSJohn Powell	endif
2897256cf0aSRohit Mathew	ifneq (${PLATFORM_NODE_COUNT},1)
2907256cf0aSRohit Mathew                $(error "NUMA AWARE PER CPU is not supported with ARCH=aarch32")
2917256cf0aSRohit Mathew	endif
292b14987cfSBoyan Karatotevendif #(ARCH=aarch32)
293b14987cfSBoyan Karatotev
294b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_FPMR},0)
295b14987cfSBoyan Karatotev	ifeq (${ENABLE_FEAT_FGT},0)
296b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_FGT")
297b14987cfSBoyan Karatotev	endif
298b14987cfSBoyan Karatotev	ifeq (${ENABLE_FEAT_HCX},0)
299b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_HCX")
300b14987cfSBoyan Karatotev	endif
301b14987cfSBoyan Karatotevendif #(ENABLE_FEAT_FPMR)
302b14987cfSBoyan Karatotev
303a1032bebSJohn Powellifneq (${ENABLE_FEAT_CPA2},0)
304a1032bebSJohn Powell	ifeq (${ENABLE_FEAT_SCTLR2},0)
305a1032bebSJohn Powell                $(error "Error: ENABLE_FEAT_CPA2 cannot be used without ENABLE_FEAT_SCTLR2")
306a1032bebSJohn Powell	endif
307a1032bebSJohn Powellendif #${ENABLE_FEAT_CPA2}
308a1032bebSJohn Powell
309b14987cfSBoyan Karatotevifneq (${ENABLE_SME_FOR_NS},0)
310b14987cfSBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_NS},0)
311b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS")
312b14987cfSBoyan Karatotev	endif
313b14987cfSBoyan Karatotevendif #(ENABLE_SME_FOR_NS)
314b14987cfSBoyan Karatotev
315b14987cfSBoyan Karatotev# Secure SME/SVE requires the non-secure component as well
316b14987cfSBoyan Karatotevifeq (${ENABLE_SME_FOR_SWD},1)
317b14987cfSBoyan Karatotev	ifeq (${ENABLE_SME_FOR_NS},0)
318b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
319b14987cfSBoyan Karatotev	endif
320b14987cfSBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_SWD},0)
321b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD")
322b14987cfSBoyan Karatotev	endif
323b14987cfSBoyan Karatotevendif #(ENABLE_SME_FOR_SWD)
324b14987cfSBoyan Karatotev
325b14987cfSBoyan Karatotev# Enabling SVE for SWD requires enabling SVE for NWD due to ENABLE_FEAT
326b14987cfSBoyan Karatotev# mechanism.
327b14987cfSBoyan Karatotevifeq (${ENABLE_SVE_FOR_SWD},1)
328b14987cfSBoyan Karatotev    ifeq (${ENABLE_SVE_FOR_NS},0)
329b14987cfSBoyan Karatotev        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
330b14987cfSBoyan Karatotev    endif
331b14987cfSBoyan Karatotevendif
332b14987cfSBoyan Karatotev
333b14987cfSBoyan Karatotev# Enabling FEAT_MOPS requires access to hcrx_el2 registers which is
334b14987cfSBoyan Karatotev# available only when FEAT_HCX is enabled.
335b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_MOPS},0)
336b14987cfSBoyan Karatotev    ifeq (${ENABLE_FEAT_HCX},0)
337b14987cfSBoyan Karatotev        $(error "ENABLE_FEAT_MOPS requires ENABLE_FEAT_HCX")
338b14987cfSBoyan Karatotev    endif
339b14987cfSBoyan Karatotevendif
340b14987cfSBoyan Karatotev
341b14987cfSBoyan Karatotev# Enabling SVE for both the worlds typically requires the context
342b14987cfSBoyan Karatotev# management of SVE registers. The only exception being SPMC at S-EL2.
343b14987cfSBoyan Karatotevifeq (${ENABLE_SVE_FOR_SWD}, 1)
344b14987cfSBoyan Karatotev    ifneq (${ENABLE_SVE_FOR_NS}, 0)
345b14987cfSBoyan Karatotev        ifeq (${CTX_INCLUDE_SVE_REGS}-$(SPMD_SPM_AT_SEL2),0-0)
346b14987cfSBoyan Karatotev            $(warning "ENABLE_SVE_FOR_SWD and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
347b14987cfSBoyan Karatotev        endif
348b14987cfSBoyan Karatotev    endif
349b14987cfSBoyan Karatotevendif
350b14987cfSBoyan Karatotev
351b14987cfSBoyan Karatotev# Enabling SVE in either world while enabling CTX_INCLUDE_FPREGS requires
352b14987cfSBoyan Karatotev# CTX_INCLUDE_SVE_REGS to be enabled due to architectural dependency between FP
353b14987cfSBoyan Karatotev# and SVE registers.
354b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_FPREGS}, 1)
355b14987cfSBoyan Karatotev    ifneq (${ENABLE_SVE_FOR_NS},0)
356b14987cfSBoyan Karatotev        ifeq (${CTX_INCLUDE_SVE_REGS},0)
357b14987cfSBoyan Karatotev            # Warning instead of error due to CI dependency on this
358b14987cfSBoyan Karatotev            $(warning "CTX_INCLUDE_FPREGS and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
359b14987cfSBoyan Karatotev            $(warning "Forced ENABLE_SVE_FOR_NS=0")
360b14987cfSBoyan Karatotev            override ENABLE_SVE_FOR_NS	:= 0
361b14987cfSBoyan Karatotev        endif
362b14987cfSBoyan Karatotev    endif
363b14987cfSBoyan Karatotevendif #(CTX_INCLUDE_FPREGS)
364b14987cfSBoyan Karatotev
365b14987cfSBoyan Karatotev# SVE context management is only required if secure world has access to SVE/FP
366b14987cfSBoyan Karatotev# functionality.
367da81d45dSMadhukar Pappireddy# Enabling CTX_INCLUDE_SVE_REGS requires CTX_INCLUDE_FPREGS to be enabled due
368da81d45dSMadhukar Pappireddy# to architectural dependency between FP and SVE registers.
369b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_SVE_REGS},1)
370b14987cfSBoyan Karatotev    ifeq (${ENABLE_SVE_FOR_SWD},0)
371b14987cfSBoyan Karatotev        $(error "CTX_INCLUDE_SVE_REGS requires ENABLE_SVE_FOR_SWD to also be enabled")
372b14987cfSBoyan Karatotev    endif
373da81d45dSMadhukar Pappireddy    ifeq (${CTX_INCLUDE_FPREGS},0)
374da81d45dSMadhukar Pappireddy        $(error "CTX_INCLUDE_SVE_REGS requires CTX_INCLUDE_FPREGS to also be enabled")
375da81d45dSMadhukar Pappireddy    endif #(CTX_INCLUDE_FPREGS)
376da81d45dSMadhukar Pappireddyendif #(CTX_INCLUDE_SVE_REGS)
377b14987cfSBoyan Karatotev
378b14987cfSBoyan Karatotev# SME cannot be used with CTX_INCLUDE_FPREGS since SPM does its own context
379b14987cfSBoyan Karatotev# management including FPU registers.
380b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_FPREGS},1)
381b14987cfSBoyan Karatotev    ifneq (${ENABLE_SME_FOR_NS},0)
382b14987cfSBoyan Karatotev        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
383b14987cfSBoyan Karatotev    endif
384b14987cfSBoyan Karatotevendif #(CTX_INCLUDE_FPREGS)
385b14987cfSBoyan Karatotev
386b14987cfSBoyan Karatotevifeq ($(DRTM_SUPPORT),1)
387b14987cfSBoyan Karatotev        $(info DRTM_SUPPORT is an experimental feature)
388b14987cfSBoyan Karatotevendif
389b14987cfSBoyan Karatotev
390b14987cfSBoyan Karatotevifeq (${HOB_LIST},1)
391b14987cfSBoyan Karatotev        $(warning HOB_LIST is an experimental feature)
392b14987cfSBoyan Karatotevendif
393b14987cfSBoyan Karatotev
394b14987cfSBoyan Karatotevifeq (${TRANSFER_LIST},1)
395b14987cfSBoyan Karatotev        $(info TRANSFER_LIST is an experimental feature)
396b14987cfSBoyan Karatotevendif
397b14987cfSBoyan Karatotev
398b14987cfSBoyan Karatotevifeq ($(PSA_CRYPTO),1)
399b14987cfSBoyan Karatotev        $(info PSA_CRYPTO is an experimental feature)
400b14987cfSBoyan Karatotevendif
401b14987cfSBoyan Karatotev
402b14987cfSBoyan Karatotevifeq ($(DICE_PROTECTION_ENVIRONMENT),1)
403b14987cfSBoyan Karatotev        $(info DICE_PROTECTION_ENVIRONMENT is an experimental feature)
404b14987cfSBoyan Karatotevendif
405b14987cfSBoyan Karatotev
406b14987cfSBoyan Karatotevifeq (${LFA_SUPPORT},1)
407b14987cfSBoyan Karatotev        $(warning LFA_SUPPORT is an experimental feature)
408b14987cfSBoyan Karatotevendif #(LFA_SUPPORT)
409c42aefd3SArvind Ram Prakash
410c42aefd3SArvind Ram Prakashifneq (${ENABLE_FEAT_MPAM_PE_BW_CTRL},0)
411c42aefd3SArvind Ram Prakash        ifeq (${ENABLE_FEAT_MPAM},0)
412c42aefd3SArvind Ram Prakash                $(error "ENABLE_FEAT_MPAM_PW_BW_CTRL requires ENABLE_FEAT_MPAM")
413c42aefd3SArvind Ram Prakash        endif
414c42aefd3SArvind Ram Prakashendif #(ENABLE_FEAT_MPAM_PE_BW_CTRL)
415ccf67965SSumit Garg
4161988ea81SOlivier Deprezifneq (${DYNAMIC_WORKAROUND_CVE_2018_3639},0)
4171988ea81SOlivier Deprez        ifeq (${WORKAROUND_CVE_2018_3639},0)
4181988ea81SOlivier Deprez                $(error Error: WORKAROUND_CVE_2018_3639 must be 1 if DYNAMIC_WORKAROUND_CVE_2018_3639 is 1)
4191988ea81SOlivier Deprez        endif
4201988ea81SOlivier Deprezendif
4211988ea81SOlivier Deprez
422ccf67965SSumit Garg# Handle all deprecated build options.
423ccf67965SSumit Gargifeq (${ERROR_DEPRECATED}, 1)
424ccf67965SSumit Garg    ifneq (${NS_TIMER_SWITCH},0)
425ccf67965SSumit Garg        $(error "NS_TIMER_SWITCH breaks Linux preemption model, hence deprecated")
426ccf67965SSumit Garg    endif
4271988ea81SOlivier Deprez    ifneq (${SPM_MM},0)
4281988ea81SOlivier Deprez        $(error "SPM_MM build option is deprecated")
42928973741SBoyan Karatotev    endif
43028973741SBoyan Karatotevendif
431*f396aec8SArvind Ram Prakash
432*f396aec8SArvind Ram Prakashifneq (${ENABLE_FEAT_IDTE3},0)
433*f396aec8SArvind Ram Prakash        $(info FEAT_IDTE3 is an experimental feature)
434*f396aec8SArvind Ram Prakashendif #(ENABLE_FEAT_IDTE3)
435