xref: /rk3399_ARM-atf/common/feat_detect.c (revision 5e827bf0296efeea9c99dd93ff5d346a928452bd)
1 /*
2  * Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch_features.h>
8 #include <common/debug.h>
9 #include <common/feat_detect.h>
10 #include <plat/common/platform.h>
11 
12 static bool detection_done[PLATFORM_CORE_COUNT] = { false };
13 
14 /*******************************************************************************
15  * This section lists the wrapper modules for each feature to evaluate the
16  * feature states (FEAT_STATE_ALWAYS and FEAT_STATE_CHECK) and perform
17  * necessary action as below:
18  *
19  * It verifies whether the FEAT_XXX (eg: FEAT_SB) is supported by the PE or not.
20  * Without this check an exception would occur during context save/restore
21  * routines, if the feature is enabled but not supported by PE.
22  ******************************************************************************/
23 
24 #define feat_detect_panic(a, b)		((a) ? (void)0 : feature_panic(b))
25 
26 /*******************************************************************************
27  * Function : feature_panic
28  * Customised panic function with error logging mechanism to list the feature
29  * not supported by the PE.
30  ******************************************************************************/
31 static inline void feature_panic(char *feat_name)
32 {
33 	ERROR("FEAT_%s not supported by the PE\n", feat_name);
34 	panic();
35 }
36 
37 /*******************************************************************************
38  * Function : check_feature
39  * Check for a valid combination of build time flags (ENABLE_FEAT_xxx) and
40  * feature availability on the hardware. <min> is the smallest feature
41  * ID field value that is required for that feature.
42  * Triggers a panic later if a feature is forcefully enabled, but not
43  * available on the PE. Also will panic if the hardware feature ID field
44  * is larger than the maximum known and supported number, specified by <max>.
45  *
46  * We force inlining here to let the compiler optimise away the whole check
47  * if the feature is disabled at build time (FEAT_STATE_DISABLED).
48  ******************************************************************************/
49 static inline bool __attribute((__always_inline__))
50 check_feature(int state, unsigned long field, const char *feat_name,
51 	      unsigned int min, unsigned int max)
52 {
53 	if (state == FEAT_STATE_ALWAYS && field < min) {
54 		ERROR("FEAT_%s not supported by the PE\n", feat_name);
55 		return true;
56 	}
57 	if (state >= FEAT_STATE_ALWAYS && field > max) {
58 		ERROR("FEAT_%s is version %ld, but is only known up to version %d\n",
59 		      feat_name, field, max);
60 		return true;
61 	}
62 
63 	return false;
64 }
65 
66 static unsigned int read_feat_rng_trap_id_field(void)
67 {
68 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_RNDR_TRAP_SHIFT,
69 			     ID_AA64PFR1_EL1_RNDR_TRAP_MASK);
70 }
71 
72 static unsigned int read_feat_bti_id_field(void)
73 {
74 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_BT_SHIFT,
75 			     ID_AA64PFR1_EL1_BT_MASK);
76 }
77 
78 static unsigned int read_feat_sb_id_field(void)
79 {
80 	return ISOLATE_FIELD(read_id_aa64isar1_el1(), ID_AA64ISAR1_SB_SHIFT,
81 			     ID_AA64ISAR1_SB_MASK);
82 }
83 
84 static unsigned int read_feat_csv2_id_field(void)
85 {
86 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_CSV2_SHIFT,
87 			     ID_AA64PFR0_CSV2_MASK);
88 }
89 
90 static unsigned int read_feat_debugv8p9_id_field(void)
91 {
92 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_DEBUGVER_SHIFT,
93 			     ID_AA64DFR0_DEBUGVER_MASK);
94 }
95 
96 static unsigned int read_feat_pmuv3_id_field(void)
97 {
98 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_PMUVER_SHIFT,
99 			     ID_AA64DFR0_PMUVER_MASK);
100 }
101 
102 static unsigned int read_feat_vhe_id_field(void)
103 {
104 	return ISOLATE_FIELD(read_id_aa64mmfr1_el1(), ID_AA64MMFR1_EL1_VHE_SHIFT,
105 			     ID_AA64MMFR1_EL1_VHE_MASK);
106 }
107 
108 static unsigned int read_feat_sve_id_field(void)
109 {
110 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_SVE_SHIFT,
111 			     ID_AA64PFR0_SVE_MASK);
112 }
113 
114 static unsigned int read_feat_ras_id_field(void)
115 {
116 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_RAS_SHIFT,
117 			     ID_AA64PFR0_RAS_MASK);
118 }
119 
120 static unsigned int read_feat_dit_id_field(void)
121 {
122 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_DIT_SHIFT,
123 			     ID_AA64PFR0_DIT_MASK);
124 }
125 
126 static unsigned int  read_feat_amu_id_field(void)
127 {
128 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_AMU_SHIFT,
129 			     ID_AA64PFR0_AMU_MASK);
130 }
131 
132 static unsigned int read_feat_mpam_version(void)
133 {
134 	return (unsigned int)((((read_id_aa64pfr0_el1() >>
135 		ID_AA64PFR0_MPAM_SHIFT) & ID_AA64PFR0_MPAM_MASK) << 4) |
136 			((read_id_aa64pfr1_el1() >>
137 		ID_AA64PFR1_MPAM_FRAC_SHIFT) & ID_AA64PFR1_MPAM_FRAC_MASK));
138 }
139 
140 static unsigned int read_feat_nv_id_field(void)
141 {
142 	return ISOLATE_FIELD(read_id_aa64mmfr2_el1(), ID_AA64MMFR2_EL1_NV_SHIFT,
143 			     ID_AA64MMFR2_EL1_NV_MASK);
144 }
145 
146 static unsigned int read_feat_sel2_id_field(void)
147 {
148 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_SEL2_SHIFT,
149 			     ID_AA64PFR0_SEL2_MASK);
150 }
151 
152 static unsigned int read_feat_trf_id_field(void)
153 {
154 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_TRACEFILT_SHIFT,
155 			     ID_AA64DFR0_TRACEFILT_MASK);
156 }
157 static unsigned int get_armv8_5_mte_support(void)
158 {
159 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_MTE_SHIFT,
160 			     ID_AA64PFR1_EL1_MTE_MASK);
161 }
162 static unsigned int read_feat_rng_id_field(void)
163 {
164 	return ISOLATE_FIELD(read_id_aa64isar0_el1(), ID_AA64ISAR0_RNDR_SHIFT,
165 			     ID_AA64ISAR0_RNDR_MASK);
166 }
167 static unsigned int read_feat_fgt_id_field(void)
168 {
169 	return ISOLATE_FIELD(read_id_aa64mmfr0_el1(), ID_AA64MMFR0_EL1_FGT_SHIFT,
170 			     ID_AA64MMFR0_EL1_FGT_MASK);
171 }
172 static unsigned int read_feat_ecv_id_field(void)
173 {
174 	return ISOLATE_FIELD(read_id_aa64mmfr0_el1(), ID_AA64MMFR0_EL1_ECV_SHIFT,
175 			     ID_AA64MMFR0_EL1_ECV_MASK);
176 }
177 static unsigned int read_feat_twed_id_field(void)
178 {
179 	return ISOLATE_FIELD(read_id_aa64mmfr1_el1(), ID_AA64MMFR1_EL1_TWED_SHIFT,
180 			     ID_AA64MMFR1_EL1_TWED_MASK);
181 }
182 
183 static unsigned int read_feat_hcx_id_field(void)
184 {
185 	return ISOLATE_FIELD(read_id_aa64mmfr1_el1(), ID_AA64MMFR1_EL1_HCX_SHIFT,
186 			     ID_AA64MMFR1_EL1_HCX_MASK);
187 }
188 static unsigned int read_feat_ls64_id_field(void)
189 {
190 	return ISOLATE_FIELD(read_id_aa64isar1_el1(), ID_AA64ISAR1_LS64_SHIFT,
191 			     ID_AA64ISAR1_LS64_MASK);
192 }
193 static unsigned int read_feat_aie_id_field(void)
194 {
195 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_AIE_SHIFT,
196 			     ID_AA64MMFR3_EL1_AIE_MASK);
197 }
198 static unsigned int read_feat_pfar_id_field(void)
199 {
200 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_PFAR_SHIFT,
201 			     ID_AA64PFR1_EL1_PFAR_MASK);
202 }
203 static unsigned int read_feat_tcr2_id_field(void)
204 {
205 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_TCRX_SHIFT,
206 			     ID_AA64MMFR3_EL1_TCRX_MASK);
207 }
208 static unsigned int read_feat_s2pie_id_field(void)
209 {
210 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_S2PIE_SHIFT,
211 			     ID_AA64MMFR3_EL1_S2PIE_MASK);
212 }
213 static unsigned int read_feat_s1pie_id_field(void)
214 {
215 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_S1PIE_SHIFT,
216 			     ID_AA64MMFR3_EL1_S1PIE_MASK);
217 }
218 static unsigned int read_feat_s2poe_id_field(void)
219 {
220 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_S2POE_SHIFT,
221 			     ID_AA64MMFR3_EL1_S2POE_MASK);
222 }
223 static unsigned int read_feat_s1poe_id_field(void)
224 {
225 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_S1POE_SHIFT,
226 			     ID_AA64MMFR3_EL1_S1POE_MASK);
227 }
228 static unsigned int read_feat_brbe_id_field(void)
229 {
230 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_BRBE_SHIFT,
231 			     ID_AA64DFR0_BRBE_MASK);
232 }
233 static unsigned int read_feat_trbe_id_field(void)
234 {
235 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_TRACEBUFFER_SHIFT,
236 			     ID_AA64DFR0_TRACEBUFFER_MASK);
237 }
238 static unsigned int read_feat_sme_id_field(void)
239 {
240 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_SME_SHIFT,
241 			     ID_AA64PFR1_EL1_SME_MASK);
242 }
243 static unsigned int read_feat_gcs_id_field(void)
244 {
245 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_GCS_SHIFT,
246 			     ID_AA64PFR1_EL1_GCS_MASK);
247 }
248 
249 static unsigned int read_feat_rme_id_field(void)
250 {
251 	return ISOLATE_FIELD(read_id_aa64pfr0_el1(), ID_AA64PFR0_FEAT_RME_SHIFT,
252 			     ID_AA64PFR0_FEAT_RME_MASK);
253 }
254 
255 static unsigned int read_feat_pan_id_field(void)
256 {
257 	return ISOLATE_FIELD(read_id_aa64mmfr1_el1(), ID_AA64MMFR1_EL1_PAN_SHIFT,
258 			     ID_AA64MMFR1_EL1_PAN_MASK);
259 }
260 
261 static unsigned int read_feat_mtpmu_id_field(void)
262 {
263 	return ISOLATE_FIELD(read_id_aa64dfr0_el1(), ID_AA64DFR0_MTPMU_SHIFT,
264 			     ID_AA64DFR0_MTPMU_MASK);
265 
266 }
267 
268 static unsigned int read_feat_the_id_field(void)
269 {
270 	return ISOLATE_FIELD(read_id_aa64pfr1_el1(), ID_AA64PFR1_EL1_THE_SHIFT,
271 			     ID_AA64PFR1_EL1_THE_MASK);
272 }
273 
274 static unsigned int read_feat_sctlr2_id_field(void)
275 {
276 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_SCTLR2_SHIFT,
277 			     ID_AA64MMFR3_EL1_SCTLR2_MASK);
278 }
279 
280 static unsigned int read_feat_d128_id_field(void)
281 {
282 	return ISOLATE_FIELD(read_id_aa64mmfr3_el1(), ID_AA64MMFR3_EL1_D128_SHIFT,
283 			     ID_AA64MMFR3_EL1_D128_MASK);
284 }
285 static unsigned int read_feat_gcie_id_field(void)
286 {
287 	return ISOLATE_FIELD(read_id_aa64pfr2_el1(), ID_AA64PFR2_EL1_GCIE_SHIFT,
288 			     ID_AA64PFR2_EL1_GCIE_MASK);
289 }
290 
291 static unsigned int read_feat_ebep_id_field(void)
292 {
293 	return ISOLATE_FIELD(read_id_aa64dfr1_el1(), ID_AA64DFR1_EBEP_SHIFT,
294 			     ID_AA64DFR1_EBEP_MASK);
295 }
296 
297 static unsigned int read_feat_fpmr_id_field(void)
298 {
299 	return ISOLATE_FIELD(read_id_aa64pfr2_el1(), ID_AA64PFR2_EL1_FPMR_SHIFT,
300 			     ID_AA64PFR2_EL1_FPMR_MASK);
301 }
302 
303 static unsigned int read_feat_mops_id_field(void)
304 {
305 	return ISOLATE_FIELD(read_id_aa64isar2_el1(), ID_AA64ISAR2_EL1_MOPS_SHIFT,
306 			     ID_AA64ISAR2_EL1_MOPS_MASK);
307 }
308 
309 static unsigned int read_feat_fgwte3_id_field(void)
310 {
311 	return ISOLATE_FIELD(read_id_aa64mmfr4_el1(), ID_AA64MMFR4_EL1_FGWTE3_SHIFT,
312 			     ID_AA64MMFR4_EL1_FGWTE3_MASK);
313 }
314 
315 static unsigned int read_feat_cpa_id_field(void)
316 {
317 	return ISOLATE_FIELD(read_id_aa64isar3_el1(),
318 			     ID_AA64ISAR3_EL1_CPA_SHIFT,
319 			     ID_AA64ISAR3_EL1_CPA_MASK);
320 }
321 
322 static unsigned int read_feat_clrbhb_id_field(void)
323 {
324 	return ISOLATE_FIELD(read_id_aa64isar2_el1(), ID_AA64ISAR2_CLRBHB_SHIFT,
325 			     ID_AA64ISAR2_CLRBHB_MASK);
326 }
327 
328 static unsigned int read_feat_rme_gdi_id_field(void)
329 {
330 	return ISOLATE_FIELD(read_id_aa64mmfr4_el1(),
331 			     ID_AA64MMFR4_EL1_RME_GDI_SHIFT,
332 			     ID_AA64MMFR4_EL1_RME_GDI_MASK);
333 }
334 
335 /***********************************************************************************
336  * TF-A supports many Arm architectural features starting from arch version
337  * (8.0 till 8.7+). These features are mostly enabled through build flags. This
338  * mechanism helps in validating these build flags in the early boot phase
339  * either in BL1 or BL31 depending on the platform and assists in identifying
340  * and notifying the features which are enabled but not supported by the PE.
341  *
342  * It reads all the enabled features ID-registers and ensures the features
343  * are supported by the PE.
344  * In case if they aren't it stops booting at an early phase and logs the error
345  * messages, notifying the platforms about the features that are not supported.
346  *
347  * Further the procedure is implemented with a tri-state approach for each feature:
348  * ENABLE_FEAT_xxx = 0 : The feature is disabled statically at compile time
349  * ENABLE_FEAT_xxx = 1 : The feature is enabled and must be present in hardware.
350  *                       There will be panic if feature is not present at cold boot.
351  * ENABLE_FEAT_xxx = 2 : The feature is enabled but dynamically enabled at runtime
352  *                       depending on hardware capability.
353  *
354  * For better readability, state values are defined with macros, namely:
355  * { FEAT_STATE_DISABLED, FEAT_STATE_ALWAYS, FEAT_STATE_CHECK }, taking values
356  * { 0, 1, 2 }, respectively, as their naming.
357  **********************************************************************************/
358 void detect_arch_features(unsigned int core_pos)
359 {
360 	/* No need to keep checking after the first time for each core. */
361 	if (detection_done[core_pos]) {
362 		return;
363 	}
364 
365 	bool tainted = false;
366 
367 	/* v8.0 features */
368 	tainted |= check_feature(ENABLE_FEAT_SB, read_feat_sb_id_field(),
369 				 "SB", 1, 1);
370 	tainted |= check_feature(ENABLE_FEAT_CSV2_2, read_feat_csv2_id_field(),
371 				 "CSV2_2", 2, 3);
372 	tainted |= check_feature(ENABLE_FEAT_CLRBHB, read_feat_clrbhb_id_field(),
373 				 "CLRBHB", 1, 1);
374 	/*
375 	 * Even though the PMUv3 is an OPTIONAL feature, it is always
376 	 * implemented and Arm prescribes so. So assume it will be there and do
377 	 * away with a flag for it. This is used to check minor PMUv3px
378 	 * revisions so that we catch them as they come along
379 	 */
380 	tainted |= check_feature(FEAT_STATE_ALWAYS, read_feat_pmuv3_id_field(),
381 				 "PMUv3", 1, ID_AA64DFR0_PMUVER_PMUV3P9);
382 
383 	/* v8.1 features */
384 	tainted |= check_feature(ENABLE_FEAT_PAN, read_feat_pan_id_field(),
385 				 "PAN", 1, 3);
386 	tainted |= check_feature(ENABLE_FEAT_VHE, read_feat_vhe_id_field(),
387 				 "VHE", 1, 1);
388 
389 	/* v8.2 features */
390 	tainted |= check_feature(ENABLE_SVE_FOR_NS, read_feat_sve_id_field(),
391 				 "SVE", 1, 1);
392 	tainted |= check_feature(ENABLE_FEAT_RAS, read_feat_ras_id_field(),
393 				 "RAS", 1, 2);
394 
395 	/* v8.3 features */
396 	/* the PAuth fields are very complicated, no min/max is checked */
397 	tainted |= check_feature(ENABLE_PAUTH, is_feat_pauth_present(),
398 				 "PAUTH", 1, 1);
399 
400 	/* v8.4 features */
401 	tainted |= check_feature(ENABLE_FEAT_DIT, read_feat_dit_id_field(),
402 				 "DIT", 1, 1);
403 	tainted |= check_feature(ENABLE_FEAT_AMU, read_feat_amu_id_field(),
404 				 "AMUv1", 1, 2);
405 	tainted |= check_feature(ENABLE_FEAT_MOPS, read_feat_mops_id_field(),
406 				 "MOPS", 1, 1);
407 	tainted |= check_feature(ENABLE_FEAT_MPAM, read_feat_mpam_version(),
408 				 "MPAM", 1, 17);
409 	tainted |= check_feature(CTX_INCLUDE_NEVE_REGS, read_feat_nv_id_field(),
410 				 "NV2", 2, 2);
411 	tainted |= check_feature(ENABLE_FEAT_SEL2, read_feat_sel2_id_field(),
412 				 "SEL2", 1, 1);
413 	tainted |= check_feature(ENABLE_TRF_FOR_NS, read_feat_trf_id_field(),
414 				 "TRF", 1, 1);
415 
416 	/* v8.5 features */
417 	tainted |= check_feature(ENABLE_FEAT_MTE2, get_armv8_5_mte_support(),
418 				 "MTE2", MTE_IMPLEMENTED_ELX, MTE_IMPLEMENTED_ASY);
419 	tainted |= check_feature(ENABLE_FEAT_RNG, read_feat_rng_id_field(),
420 				 "RNG", 1, 1);
421 	tainted |= check_feature(ENABLE_BTI, read_feat_bti_id_field(),
422 				 "BTI", 1, 1);
423 	tainted |= check_feature(ENABLE_FEAT_RNG_TRAP, read_feat_rng_trap_id_field(),
424 				 "RNG_TRAP", 1, 1);
425 
426 	/* v8.6 features */
427 	tainted |= check_feature(ENABLE_FEAT_AMUv1p1, read_feat_amu_id_field(),
428 				 "AMUv1p1", 2, 2);
429 	tainted |= check_feature(ENABLE_FEAT_FGT, read_feat_fgt_id_field(),
430 				 "FGT", 1, 2);
431 	tainted |= check_feature(ENABLE_FEAT_FGT2, read_feat_fgt_id_field(),
432 				 "FGT2", 2, 2);
433 	tainted |= check_feature(ENABLE_FEAT_ECV, read_feat_ecv_id_field(),
434 				 "ECV", 1, 2);
435 	tainted |= check_feature(ENABLE_FEAT_TWED, read_feat_twed_id_field(),
436 				 "TWED", 1, 1);
437 
438 	/*
439 	 * even though this is a "DISABLE" it does confusingly perform feature
440 	 * enablement duties like all other flags here. Check it against the HW
441 	 * feature when we intend to diverge from the default behaviour
442 	 */
443 	tainted |= check_feature(DISABLE_MTPMU, read_feat_mtpmu_id_field(),
444 				 "MTPMU", 1, 1);
445 
446 	/* v8.7 features */
447 	tainted |= check_feature(ENABLE_FEAT_HCX, read_feat_hcx_id_field(),
448 				 "HCX", 1, 1);
449 	tainted |= check_feature(ENABLE_FEAT_LS64_ACCDATA, read_feat_ls64_id_field(),
450 				 "LS64", 1, 3);
451 
452 	/* v8.9 features */
453 	tainted |= check_feature(ENABLE_FEAT_TCR2, read_feat_tcr2_id_field(),
454 				 "TCR2", 1, 1);
455 	tainted |= check_feature(ENABLE_FEAT_S2PIE, read_feat_s2pie_id_field(),
456 				 "S2PIE", 1, 1);
457 	tainted |= check_feature(ENABLE_FEAT_S1PIE, read_feat_s1pie_id_field(),
458 				 "S1PIE", 1, 1);
459 	tainted |= check_feature(ENABLE_FEAT_S2POE, read_feat_s2poe_id_field(),
460 				 "S2POE", 1, 1);
461 	tainted |= check_feature(ENABLE_FEAT_S1POE, read_feat_s1poe_id_field(),
462 				 "S1POE", 1, 1);
463 	tainted |= check_feature(ENABLE_FEAT_CSV2_3, read_feat_csv2_id_field(),
464 				 "CSV2_3", 3, 3);
465 	tainted |= check_feature(ENABLE_FEAT_DEBUGV8P9, read_feat_debugv8p9_id_field(),
466 				 "DEBUGV8P9", 11, 11);
467 	tainted |= check_feature(ENABLE_FEAT_THE, read_feat_the_id_field(),
468 				 "THE", 1, 1);
469 	tainted |= check_feature(ENABLE_FEAT_SCTLR2, read_feat_sctlr2_id_field(),
470 				 "SCTLR2", 1, 1);
471 	tainted |= check_feature(ENABLE_FEAT_AIE, read_feat_aie_id_field(),
472 				 "AIE", 1, 1);
473 	tainted |= check_feature(ENABLE_FEAT_PFAR, read_feat_pfar_id_field(),
474 				 "PFAR", 1, 1);
475 
476 	/* v9.0 features */
477 	tainted |= check_feature(ENABLE_BRBE_FOR_NS, read_feat_brbe_id_field(),
478 				 "BRBE", 1, 2);
479 	tainted |= check_feature(ENABLE_TRBE_FOR_NS, read_feat_trbe_id_field(),
480 				 "TRBE", 1, 1);
481 
482 	/* v9.2 features */
483 	tainted |= check_feature(ENABLE_SME_FOR_NS, read_feat_sme_id_field(),
484 				 "SME", 1, 2);
485 	tainted |= check_feature(ENABLE_SME2_FOR_NS, read_feat_sme_id_field(),
486 				 "SME2", 2, 2);
487 	tainted |= check_feature(ENABLE_FEAT_FPMR, read_feat_fpmr_id_field(),
488 				 "FPMR", 1, 1);
489 
490 	/* v9.3 features */
491 	tainted |= check_feature(ENABLE_FEAT_D128, read_feat_d128_id_field(),
492 				 "D128", 1, 1);
493 	tainted |= check_feature(ENABLE_FEAT_GCIE, read_feat_gcie_id_field(),
494 				 "GCIE", 1, 1);
495 	tainted |= check_feature(ENABLE_FEAT_MPAM_PE_BW_CTRL,
496 				is_feat_mpam_pe_bw_ctrl_present(),
497 				"MPAM_PE_BW_CTRL", 1, 1);
498 	tainted |= check_feature(ENABLE_FEAT_EBEP, read_feat_ebep_id_field(),
499 				 "EBEP", 1, 1);
500 
501 	/* v9.4 features */
502 	tainted |= check_feature(ENABLE_FEAT_GCS, read_feat_gcs_id_field(),
503 				 "GCS", 1, 1);
504 	tainted |= check_feature(ENABLE_RME, read_feat_rme_id_field(),
505 				 "RME", 1, 2);
506 	tainted |= check_feature(ENABLE_FEAT_PAUTH_LR, is_feat_pauth_lr_present(),
507 				 "PAUTH_LR", 1, 1);
508 	tainted |= check_feature(ENABLE_FEAT_FGWTE3, read_feat_fgwte3_id_field(),
509 				 "FGWTE3", 1, 1);
510 	tainted |= check_feature(ENABLE_FEAT_CPA2, read_feat_cpa_id_field(),
511 				 "CPA2", 2, 2);
512 	tainted |= check_feature(ENABLE_FEAT_RME_GDI, read_feat_rme_gdi_id_field(),
513 				 "RME_GDI", 1, 1);
514 
515 	if (tainted) {
516 		panic();
517 	}
518 
519 	detection_done[core_pos] = true;
520 }
521