xref: /rk3399_ARM-atf/make_helpers/constraints.mk (revision 5e827bf0296efeea9c99dd93ff5d346a928452bd)
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
11*5e827bf0STimothy Hayes# Make sure RME configuration is valid
12*5e827bf0STimothy Hayesifeq (${ENABLE_RME},1)
13*5e827bf0STimothy Hayes	ifneq (${SEPARATE_CODE_AND_RODATA},1)
14*5e827bf0STimothy Hayes                $(error ENABLE_RME requires SEPARATE_CODE_AND_RODATA)
15*5e827bf0STimothy Hayes	endif
16*5e827bf0STimothy Hayes
17b14987cfSBoyan Karatotev	ifneq (${ARCH},aarch64)
18b14987cfSBoyan Karatotev                $(error ENABLE_RME requires AArch64)
19b14987cfSBoyan Karatotev	endif
20*5e827bf0STimothy 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
30*5e827bf0STimothy Hayeselse
31*5e827bf0STimothy Hayes	ifeq (${ENABLE_FEAT_RME_GDI},1)
32*5e827bf0STimothy Hayes                $(error ENABLE_FEAT_RME_GDI requires ENABLE_RME)
33*5e827bf0STimothy 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
289b14987cfSBoyan Karatotevendif #(ARCH=aarch32)
290b14987cfSBoyan Karatotev
291b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_FPMR},0)
292b14987cfSBoyan Karatotev	ifeq (${ENABLE_FEAT_FGT},0)
293b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_FGT")
294b14987cfSBoyan Karatotev	endif
295b14987cfSBoyan Karatotev	ifeq (${ENABLE_FEAT_HCX},0)
296b14987cfSBoyan Karatotev                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_HCX")
297b14987cfSBoyan Karatotev	endif
298b14987cfSBoyan Karatotevendif #(ENABLE_FEAT_FPMR)
299b14987cfSBoyan Karatotev
300a1032bebSJohn Powellifneq (${ENABLE_FEAT_CPA2},0)
301a1032bebSJohn Powell	ifeq (${ENABLE_FEAT_SCTLR2},0)
302a1032bebSJohn Powell                $(error "Error: ENABLE_FEAT_CPA2 cannot be used without ENABLE_FEAT_SCTLR2")
303a1032bebSJohn Powell	endif
304a1032bebSJohn Powellendif #${ENABLE_FEAT_CPA2}
305a1032bebSJohn Powell
306b14987cfSBoyan Karatotevifneq (${ENABLE_SME_FOR_NS},0)
307b14987cfSBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_NS},0)
308b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS")
309b14987cfSBoyan Karatotev	endif
310b14987cfSBoyan Karatotevendif #(ENABLE_SME_FOR_NS)
311b14987cfSBoyan Karatotev
312b14987cfSBoyan Karatotev# Secure SME/SVE requires the non-secure component as well
313b14987cfSBoyan Karatotevifeq (${ENABLE_SME_FOR_SWD},1)
314b14987cfSBoyan Karatotev	ifeq (${ENABLE_SME_FOR_NS},0)
315b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
316b14987cfSBoyan Karatotev	endif
317b14987cfSBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_SWD},0)
318b14987cfSBoyan Karatotev                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD")
319b14987cfSBoyan Karatotev	endif
320b14987cfSBoyan Karatotevendif #(ENABLE_SME_FOR_SWD)
321b14987cfSBoyan Karatotev
322b14987cfSBoyan Karatotev# Enabling SVE for SWD requires enabling SVE for NWD due to ENABLE_FEAT
323b14987cfSBoyan Karatotev# mechanism.
324b14987cfSBoyan Karatotevifeq (${ENABLE_SVE_FOR_SWD},1)
325b14987cfSBoyan Karatotev    ifeq (${ENABLE_SVE_FOR_NS},0)
326b14987cfSBoyan Karatotev        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
327b14987cfSBoyan Karatotev    endif
328b14987cfSBoyan Karatotevendif
329b14987cfSBoyan Karatotev
330b14987cfSBoyan Karatotev# Enabling FEAT_MOPS requires access to hcrx_el2 registers which is
331b14987cfSBoyan Karatotev# available only when FEAT_HCX is enabled.
332b14987cfSBoyan Karatotevifneq (${ENABLE_FEAT_MOPS},0)
333b14987cfSBoyan Karatotev    ifeq (${ENABLE_FEAT_HCX},0)
334b14987cfSBoyan Karatotev        $(error "ENABLE_FEAT_MOPS requires ENABLE_FEAT_HCX")
335b14987cfSBoyan Karatotev    endif
336b14987cfSBoyan Karatotevendif
337b14987cfSBoyan Karatotev
338b14987cfSBoyan Karatotev# Enabling SVE for both the worlds typically requires the context
339b14987cfSBoyan Karatotev# management of SVE registers. The only exception being SPMC at S-EL2.
340b14987cfSBoyan Karatotevifeq (${ENABLE_SVE_FOR_SWD}, 1)
341b14987cfSBoyan Karatotev    ifneq (${ENABLE_SVE_FOR_NS}, 0)
342b14987cfSBoyan Karatotev        ifeq (${CTX_INCLUDE_SVE_REGS}-$(SPMD_SPM_AT_SEL2),0-0)
343b14987cfSBoyan Karatotev            $(warning "ENABLE_SVE_FOR_SWD and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
344b14987cfSBoyan Karatotev        endif
345b14987cfSBoyan Karatotev    endif
346b14987cfSBoyan Karatotevendif
347b14987cfSBoyan Karatotev
348b14987cfSBoyan Karatotev# Enabling SVE in either world while enabling CTX_INCLUDE_FPREGS requires
349b14987cfSBoyan Karatotev# CTX_INCLUDE_SVE_REGS to be enabled due to architectural dependency between FP
350b14987cfSBoyan Karatotev# and SVE registers.
351b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_FPREGS}, 1)
352b14987cfSBoyan Karatotev    ifneq (${ENABLE_SVE_FOR_NS},0)
353b14987cfSBoyan Karatotev        ifeq (${CTX_INCLUDE_SVE_REGS},0)
354b14987cfSBoyan Karatotev            # Warning instead of error due to CI dependency on this
355b14987cfSBoyan Karatotev            $(warning "CTX_INCLUDE_FPREGS and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
356b14987cfSBoyan Karatotev            $(warning "Forced ENABLE_SVE_FOR_NS=0")
357b14987cfSBoyan Karatotev            override ENABLE_SVE_FOR_NS	:= 0
358b14987cfSBoyan Karatotev        endif
359b14987cfSBoyan Karatotev    endif
360b14987cfSBoyan Karatotevendif #(CTX_INCLUDE_FPREGS)
361b14987cfSBoyan Karatotev
362b14987cfSBoyan Karatotev# SVE context management is only required if secure world has access to SVE/FP
363b14987cfSBoyan Karatotev# functionality.
364da81d45dSMadhukar Pappireddy# Enabling CTX_INCLUDE_SVE_REGS requires CTX_INCLUDE_FPREGS to be enabled due
365da81d45dSMadhukar Pappireddy# to architectural dependency between FP and SVE registers.
366b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_SVE_REGS},1)
367b14987cfSBoyan Karatotev    ifeq (${ENABLE_SVE_FOR_SWD},0)
368b14987cfSBoyan Karatotev        $(error "CTX_INCLUDE_SVE_REGS requires ENABLE_SVE_FOR_SWD to also be enabled")
369b14987cfSBoyan Karatotev    endif
370da81d45dSMadhukar Pappireddy    ifeq (${CTX_INCLUDE_FPREGS},0)
371da81d45dSMadhukar Pappireddy        $(error "CTX_INCLUDE_SVE_REGS requires CTX_INCLUDE_FPREGS to also be enabled")
372da81d45dSMadhukar Pappireddy    endif #(CTX_INCLUDE_FPREGS)
373da81d45dSMadhukar Pappireddyendif #(CTX_INCLUDE_SVE_REGS)
374b14987cfSBoyan Karatotev
375b14987cfSBoyan Karatotev# SME cannot be used with CTX_INCLUDE_FPREGS since SPM does its own context
376b14987cfSBoyan Karatotev# management including FPU registers.
377b14987cfSBoyan Karatotevifeq (${CTX_INCLUDE_FPREGS},1)
378b14987cfSBoyan Karatotev    ifneq (${ENABLE_SME_FOR_NS},0)
379b14987cfSBoyan Karatotev        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
380b14987cfSBoyan Karatotev    endif
381b14987cfSBoyan Karatotevendif #(CTX_INCLUDE_FPREGS)
382b14987cfSBoyan Karatotev
383b14987cfSBoyan Karatotevifeq ($(DRTM_SUPPORT),1)
384b14987cfSBoyan Karatotev        $(info DRTM_SUPPORT is an experimental feature)
385b14987cfSBoyan Karatotevendif
386b14987cfSBoyan Karatotev
387b14987cfSBoyan Karatotevifeq (${HOB_LIST},1)
388b14987cfSBoyan Karatotev        $(warning HOB_LIST is an experimental feature)
389b14987cfSBoyan Karatotevendif
390b14987cfSBoyan Karatotev
391b14987cfSBoyan Karatotevifeq (${TRANSFER_LIST},1)
392b14987cfSBoyan Karatotev        $(info TRANSFER_LIST is an experimental feature)
393b14987cfSBoyan Karatotevendif
394b14987cfSBoyan Karatotev
395b14987cfSBoyan Karatotevifeq ($(PSA_CRYPTO),1)
396b14987cfSBoyan Karatotev        $(info PSA_CRYPTO is an experimental feature)
397b14987cfSBoyan Karatotevendif
398b14987cfSBoyan Karatotev
399b14987cfSBoyan Karatotevifeq ($(DICE_PROTECTION_ENVIRONMENT),1)
400b14987cfSBoyan Karatotev        $(info DICE_PROTECTION_ENVIRONMENT is an experimental feature)
401b14987cfSBoyan Karatotevendif
402b14987cfSBoyan Karatotev
403b14987cfSBoyan Karatotevifeq (${LFA_SUPPORT},1)
404b14987cfSBoyan Karatotev        $(warning LFA_SUPPORT is an experimental feature)
405b14987cfSBoyan Karatotevendif #(LFA_SUPPORT)
406c42aefd3SArvind Ram Prakash
407c42aefd3SArvind Ram Prakashifneq (${ENABLE_FEAT_MPAM_PE_BW_CTRL},0)
408c42aefd3SArvind Ram Prakash        ifeq (${ENABLE_FEAT_MPAM},0)
409c42aefd3SArvind Ram Prakash                $(error "ENABLE_FEAT_MPAM_PW_BW_CTRL requires ENABLE_FEAT_MPAM")
410c42aefd3SArvind Ram Prakash        endif
411c42aefd3SArvind Ram Prakashendif #(ENABLE_FEAT_MPAM_PE_BW_CTRL)
412ccf67965SSumit Garg
4131988ea81SOlivier Deprezifneq (${DYNAMIC_WORKAROUND_CVE_2018_3639},0)
4141988ea81SOlivier Deprez        ifeq (${WORKAROUND_CVE_2018_3639},0)
4151988ea81SOlivier Deprez                $(error Error: WORKAROUND_CVE_2018_3639 must be 1 if DYNAMIC_WORKAROUND_CVE_2018_3639 is 1)
4161988ea81SOlivier Deprez        endif
4171988ea81SOlivier Deprezendif
4181988ea81SOlivier Deprez
419ccf67965SSumit Garg# Handle all deprecated build options.
420ccf67965SSumit Gargifeq (${ERROR_DEPRECATED}, 1)
421ccf67965SSumit Garg    ifneq (${NS_TIMER_SWITCH},0)
422ccf67965SSumit Garg        $(error "NS_TIMER_SWITCH breaks Linux preemption model, hence deprecated")
423ccf67965SSumit Garg    endif
4241988ea81SOlivier Deprez    ifneq (${SPM_MM},0)
4251988ea81SOlivier Deprez        $(error "SPM_MM build option is deprecated")
42628973741SBoyan Karatotev    endif
42728973741SBoyan Karatotevendif
428