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