2 * Copyright (c) 2014 Andrew Turner
3 * Copyright (c) 2014 The FreeBSD Foundation
6 * Portions of this software were developed by Semihalf
7 * under sponsorship of the FreeBSD Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <sys/malloc.h>
39 #include <sys/sysctl.h>
40 #include <sys/sysent.h>
41 #include <sys/systm.h>
43 #include <machine/atomic.h>
44 #include <machine/cpu.h>
45 #include <machine/cpufunc.h>
46 #include <machine/elf.h>
47 #include <machine/md_var.h>
48 #include <machine/undefined.h>
50 static MALLOC_DEFINE(M_IDENTCPU, "CPU ID", "arm64 CPU identification memory");
54 static void print_cpu_midr(struct sbuf *sb, u_int cpu);
55 static void print_cpu_features(u_int cpu, struct cpu_desc *desc,
56 struct cpu_desc *prev_desc);
57 static void print_cpu_caches(struct sbuf *sb, struct cpu_desc *desc);
58 #ifdef COMPAT_FREEBSD32
59 static u_long parse_cpu_features_hwcap32(void);
62 char machine[] = "arm64";
65 extern int adaptive_machine_arch;
68 static SYSCTL_NODE(_machdep, OID_AUTO, cache, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
69 "Cache management tuning");
71 static int allow_dic = 1;
72 SYSCTL_INT(_machdep_cache, OID_AUTO, allow_dic, CTLFLAG_RDTUN, &allow_dic, 0,
73 "Allow optimizations based on the DIC cache bit");
75 static int allow_idc = 1;
76 SYSCTL_INT(_machdep_cache, OID_AUTO, allow_idc, CTLFLAG_RDTUN, &allow_idc, 0,
77 "Allow optimizations based on the IDC cache bit");
79 static void check_cpu_regs(u_int cpu, struct cpu_desc *desc,
80 struct cpu_desc *prev_desc);
83 * The default implementation of I-cache sync assumes we have an
84 * aliasing cache until we know otherwise.
86 void (*arm64_icache_sync_range)(vm_offset_t, vm_size_t) =
87 &arm64_aliasing_icache_sync_range;
90 sysctl_hw_machine(SYSCTL_HANDLER_ARGS)
93 static const char machine32[] = "arm";
98 if ((req->flags & SCTL_MASK32) != 0 && adaptive_machine_arch)
99 error = SYSCTL_OUT(req, machine32, sizeof(machine32));
102 error = SYSCTL_OUT(req, machine, sizeof(machine));
106 SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
107 CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A",
110 static char cpu_model[64];
111 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD,
112 cpu_model, sizeof(cpu_model), "Machine model");
114 #define MAX_CACHES 8 /* Maximum number of caches supported
117 * Per-CPU affinity as provided in MPIDR_EL1
118 * Indexed by CPU number in logical order selected by the system.
119 * Relevant fields can be extracted using CPU_AFFn macros,
120 * Aff3.Aff2.Aff1.Aff0 construct a unique CPU address in the system.
123 * Aff1 - Cluster number
124 * Aff0 - CPU number in Aff1 cluster
126 uint64_t __cpu_affinity[MAXCPU];
127 static u_int cpu_aff_levels;
131 uint64_t id_aa64afr0;
132 uint64_t id_aa64afr1;
133 uint64_t id_aa64dfr0;
134 uint64_t id_aa64dfr1;
135 uint64_t id_aa64isar0;
136 uint64_t id_aa64isar1;
137 uint64_t id_aa64isar2;
138 uint64_t id_aa64mmfr0;
139 uint64_t id_aa64mmfr1;
140 uint64_t id_aa64mmfr2;
142 uint64_t id_aa64mmfr3;
143 uint64_t id_aa64mmfr4;
145 uint64_t id_aa64pfr0;
146 uint64_t id_aa64pfr1;
148 uint64_t id_aa64pfr2;
150 uint64_t id_aa64zfr0;
152 #ifdef COMPAT_FREEBSD32
158 uint32_t ccsidr[MAX_CACHES][2]; /* 2 possible types. */
162 static struct cpu_desc cpu_desc0;
163 static struct cpu_desc *cpu_desc;
164 static struct cpu_desc kern_cpu_desc;
165 static struct cpu_desc user_cpu_desc;
166 static struct cpu_desc l_user_cpu_desc;
168 static struct cpu_desc *
169 get_cpu_desc(u_int cpu)
171 /* The cpu_desc for CPU 0 is used before the allocator is ready. */
175 MPASS(cpu_desc != NULL);
176 return (&cpu_desc[cpu - 1]);
181 const char *part_name;
183 #define CPU_PART_NONE { 0, NULL }
185 struct cpu_implementers {
187 const char *impl_name;
189 * Part number is implementation defined
190 * so each vendor will have its own set of values and names.
192 const struct cpu_parts *cpu_parts;
194 #define CPU_IMPLEMENTER_NONE { 0, NULL, NULL }
197 * Per-implementer table of (PartNum, CPU Name) pairs.
200 static const struct cpu_parts cpu_parts_arm[] = {
201 { CPU_PART_AEM_V8, "AEMv8" },
202 { CPU_PART_FOUNDATION, "Foundation-Model" },
203 { CPU_PART_CORTEX_A34, "Cortex-A34" },
204 { CPU_PART_CORTEX_A35, "Cortex-A35" },
205 { CPU_PART_CORTEX_A53, "Cortex-A53" },
206 { CPU_PART_CORTEX_A55, "Cortex-A55" },
207 { CPU_PART_CORTEX_A57, "Cortex-A57" },
208 { CPU_PART_CORTEX_A65, "Cortex-A65" },
209 { CPU_PART_CORTEX_A65AE, "Cortex-A65AE" },
210 { CPU_PART_CORTEX_A72, "Cortex-A72" },
211 { CPU_PART_CORTEX_A73, "Cortex-A73" },
212 { CPU_PART_CORTEX_A75, "Cortex-A75" },
213 { CPU_PART_CORTEX_A76, "Cortex-A76" },
214 { CPU_PART_CORTEX_A76AE, "Cortex-A76AE" },
215 { CPU_PART_CORTEX_A77, "Cortex-A77" },
216 { CPU_PART_CORTEX_A78, "Cortex-A78" },
217 { CPU_PART_CORTEX_A78C, "Cortex-A78C" },
218 { CPU_PART_CORTEX_A510, "Cortex-A510" },
219 { CPU_PART_CORTEX_A710, "Cortex-A710" },
220 { CPU_PART_CORTEX_A715, "Cortex-A715" },
221 { CPU_PART_CORTEX_X1, "Cortex-X1" },
222 { CPU_PART_CORTEX_X1C, "Cortex-X1C" },
223 { CPU_PART_CORTEX_X2, "Cortex-X2" },
224 { CPU_PART_CORTEX_X3, "Cortex-X3" },
225 { CPU_PART_NEOVERSE_E1, "Neoverse-E1" },
226 { CPU_PART_NEOVERSE_N1, "Neoverse-N1" },
227 { CPU_PART_NEOVERSE_N2, "Neoverse-N2" },
228 { CPU_PART_NEOVERSE_V1, "Neoverse-V1" },
229 { CPU_PART_NEOVERSE_V2, "Neoverse-V2" },
234 static const struct cpu_parts cpu_parts_cavium[] = {
235 { CPU_PART_THUNDERX, "ThunderX" },
236 { CPU_PART_THUNDERX2, "ThunderX2" },
241 static const struct cpu_parts cpu_parts_apm[] = {
242 { CPU_PART_EMAG8180, "eMAG 8180" },
247 static const struct cpu_parts cpu_parts_qcom[] = {
248 { CPU_PART_KRYO400_GOLD, "Kryo 400 Gold" },
249 { CPU_PART_KRYO400_SILVER, "Kryo 400 Silver" },
254 static const struct cpu_parts cpu_parts_none[] = {
259 * Implementers table.
261 const struct cpu_implementers cpu_implementers[] = {
262 { CPU_IMPL_AMPERE, "Ampere", cpu_parts_none },
263 { CPU_IMPL_APPLE, "Apple", cpu_parts_none },
264 { CPU_IMPL_APM, "APM", cpu_parts_apm },
265 { CPU_IMPL_ARM, "ARM", cpu_parts_arm },
266 { CPU_IMPL_BROADCOM, "Broadcom", cpu_parts_none },
267 { CPU_IMPL_CAVIUM, "Cavium", cpu_parts_cavium },
268 { CPU_IMPL_DEC, "DEC", cpu_parts_none },
269 { CPU_IMPL_FREESCALE, "Freescale", cpu_parts_none },
270 { CPU_IMPL_FUJITSU, "Fujitsu", cpu_parts_none },
271 { CPU_IMPL_INFINEON, "IFX", cpu_parts_none },
272 { CPU_IMPL_INTEL, "Intel", cpu_parts_none },
273 { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none },
274 { CPU_IMPL_NVIDIA, "NVIDIA", cpu_parts_none },
275 { CPU_IMPL_QUALCOMM, "Qualcomm", cpu_parts_qcom },
276 CPU_IMPLEMENTER_NONE,
279 #define MRS_TYPE_MASK 0xf
280 #define MRS_TYPE_FBSD_SHIFT 0
281 #define MRS_TYPE_LNX_SHIFT 8
282 #define MRS_INVALID 0
284 #define MRS_EXACT_VAL(x) (MRS_EXACT | ((x) << 4))
285 #define MRS_EXACT_FIELD(x) (((x) >> 4) & 0xf)
288 struct mrs_field_value {
293 #define MRS_FIELD_VALUE(_value, _desc) \
299 #define MRS_FIELD_VALUE_NONE_IMPL(_reg, _field, _none, _impl) \
300 MRS_FIELD_VALUE(_reg ## _ ## _field ## _ ## _none, ""), \
301 MRS_FIELD_VALUE(_reg ## _ ## _field ## _ ## _impl, #_field)
303 #define MRS_FIELD_VALUE_COUNT(_reg, _field, _desc) \
304 MRS_FIELD_VALUE(0ul << _reg ## _ ## _field ## _SHIFT, "1 " _desc), \
305 MRS_FIELD_VALUE(1ul << _reg ## _ ## _field ## _SHIFT, "2 " _desc "s"), \
306 MRS_FIELD_VALUE(2ul << _reg ## _ ## _field ## _SHIFT, "3 " _desc "s"), \
307 MRS_FIELD_VALUE(3ul << _reg ## _ ## _field ## _SHIFT, "4 " _desc "s"), \
308 MRS_FIELD_VALUE(4ul << _reg ## _ ## _field ## _SHIFT, "5 " _desc "s"), \
309 MRS_FIELD_VALUE(5ul << _reg ## _ ## _field ## _SHIFT, "6 " _desc "s"), \
310 MRS_FIELD_VALUE(6ul << _reg ## _ ## _field ## _SHIFT, "7 " _desc "s"), \
311 MRS_FIELD_VALUE(7ul << _reg ## _ ## _field ## _SHIFT, "8 " _desc "s"), \
312 MRS_FIELD_VALUE(8ul << _reg ## _ ## _field ## _SHIFT, "9 " _desc "s"), \
313 MRS_FIELD_VALUE(9ul << _reg ## _ ## _field ## _SHIFT, "10 "_desc "s"), \
314 MRS_FIELD_VALUE(10ul<< _reg ## _ ## _field ## _SHIFT, "11 "_desc "s"), \
315 MRS_FIELD_VALUE(11ul<< _reg ## _ ## _field ## _SHIFT, "12 "_desc "s"), \
316 MRS_FIELD_VALUE(12ul<< _reg ## _ ## _field ## _SHIFT, "13 "_desc "s"), \
317 MRS_FIELD_VALUE(13ul<< _reg ## _ ## _field ## _SHIFT, "14 "_desc "s"), \
318 MRS_FIELD_VALUE(14ul<< _reg ## _ ## _field ## _SHIFT, "15 "_desc "s"), \
319 MRS_FIELD_VALUE(15ul<< _reg ## _ ## _field ## _SHIFT, "16 "_desc "s")
321 #define MRS_FIELD_VALUE_END { .desc = NULL }
323 struct mrs_field_hwcap {
329 #define MRS_HWCAP(_hwcap_id, _val, _min) \
331 .hwcap_id = (_hwcap_id), \
332 .hwcap_val = (_val), \
336 #define MRS_HWCAP_END { .hwcap_id = 0 }
340 const struct mrs_field_value *values;
341 const struct mrs_field_hwcap *hwcaps;
348 #define MRS_FIELD_HWCAP_SPLIT(_register, _name, _sign, _fbsd_type, \
349 _lnx_type, _values, _hwcap) \
353 .type = ((_fbsd_type) << MRS_TYPE_FBSD_SHIFT) | \
354 ((_lnx_type) << MRS_TYPE_LNX_SHIFT), \
355 .shift = _register ## _ ## _name ## _SHIFT, \
356 .mask = _register ## _ ## _name ## _MASK, \
357 .values = (_values), \
358 .hwcaps = (_hwcap), \
361 #define MRS_FIELD_HWCAP(_register, _name, _sign, _type, _values, _hwcap) \
362 MRS_FIELD_HWCAP_SPLIT(_register, _name, _sign, _type, _type, \
365 #define MRS_FIELD(_register, _name, _sign, _type, _values) \
366 MRS_FIELD_HWCAP(_register, _name, _sign, _type, _values, NULL)
368 #define MRS_FIELD_END { .type = MRS_INVALID, }
370 /* ID_AA64AFR0_EL1 */
371 static const struct mrs_field id_aa64afr0_fields[] = {
376 /* ID_AA64AFR1_EL1 */
377 static const struct mrs_field id_aa64afr1_fields[] = {
382 /* ID_AA64DFR0_EL1 */
383 static const struct mrs_field_value id_aa64dfr0_hpmn0[] = {
384 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64DFR0, HPMN0, CONSTR, DEFINED),
388 static const struct mrs_field_value id_aa64dfr0_brbe[] = {
389 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64DFR0, BRBE, NONE, IMPL),
390 MRS_FIELD_VALUE(ID_AA64DFR0_BRBE_EL3, "BRBE EL3"),
394 static const struct mrs_field_value id_aa64dfr0_mtpmu[] = {
395 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64DFR0, MTPMU, NONE, IMPL),
396 MRS_FIELD_VALUE(ID_AA64DFR0_MTPMU_NONE_MT_RES0, "MTPMU res0"),
400 static const struct mrs_field_value id_aa64dfr0_tracebuffer[] = {
401 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64DFR0, TraceBuffer, NONE, IMPL),
405 static const struct mrs_field_value id_aa64dfr0_tracefilt[] = {
406 MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_NONE, ""),
407 MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_8_4, "Trace v8.4"),
411 static const struct mrs_field_value id_aa64dfr0_doublelock[] = {
412 MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_IMPL, "DoubleLock"),
413 MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_NONE, ""),
417 static const struct mrs_field_value id_aa64dfr0_pmsver[] = {
418 MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_NONE, ""),
419 MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE, "SPE"),
420 MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_1_1, "SPEv1p1"),
421 MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_1_2, "SPEv1p2"),
422 MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_1_3, "SPEv1p3"),
426 static const struct mrs_field_value id_aa64dfr0_ctx_cmps[] = {
427 MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, CTX_CMPs, "CTX BKPT"),
431 static const struct mrs_field_value id_aa64dfr0_wrps[] = {
432 MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, WRPs, "Watchpoint"),
436 static const struct mrs_field_value id_aa64dfr0_brps[] = {
437 MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, BRPs, "Breakpoint"),
441 static const struct mrs_field_value id_aa64dfr0_pmuver[] = {
442 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_NONE, ""),
443 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3, "PMUv3"),
444 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3p1"),
445 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_4, "PMUv3p4"),
446 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_5, "PMUv3p5"),
447 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_7, "PMUv3p7"),
448 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_8, "PMUv3p8"),
449 MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_IMPL, "IMPL PMU"),
453 static const struct mrs_field_value id_aa64dfr0_tracever[] = {
454 MRS_FIELD_VALUE(ID_AA64DFR0_TraceVer_NONE, ""),
455 MRS_FIELD_VALUE(ID_AA64DFR0_TraceVer_IMPL, "Trace"),
459 static const struct mrs_field_value id_aa64dfr0_debugver[] = {
460 MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8, "Debugv8"),
461 MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_VHE, "Debugv8_VHE"),
462 MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_2, "Debugv8p2"),
463 MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_4, "Debugv8p4"),
464 MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_8, "Debugv8p8"),
468 static const struct mrs_field id_aa64dfr0_fields[] = {
469 MRS_FIELD(ID_AA64DFR0, HPMN0, false, MRS_EXACT, id_aa64dfr0_hpmn0),
470 MRS_FIELD(ID_AA64DFR0, BRBE, false, MRS_EXACT, id_aa64dfr0_brbe),
471 MRS_FIELD(ID_AA64DFR0, MTPMU, true, MRS_EXACT, id_aa64dfr0_mtpmu),
472 MRS_FIELD(ID_AA64DFR0, TraceBuffer, false, MRS_EXACT,
473 id_aa64dfr0_tracebuffer),
474 MRS_FIELD(ID_AA64DFR0, TraceFilt, false, MRS_EXACT,
475 id_aa64dfr0_tracefilt),
476 MRS_FIELD(ID_AA64DFR0, DoubleLock, false, MRS_EXACT,
477 id_aa64dfr0_doublelock),
478 MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver),
479 MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT,
480 id_aa64dfr0_ctx_cmps),
481 MRS_FIELD(ID_AA64DFR0, WRPs, false, MRS_LOWER, id_aa64dfr0_wrps),
482 MRS_FIELD(ID_AA64DFR0, BRPs, false, MRS_LOWER, id_aa64dfr0_brps),
483 MRS_FIELD(ID_AA64DFR0, PMUVer, false, MRS_EXACT, id_aa64dfr0_pmuver),
484 MRS_FIELD(ID_AA64DFR0, TraceVer, false, MRS_EXACT,
485 id_aa64dfr0_tracever),
486 MRS_FIELD(ID_AA64DFR0, DebugVer, false, MRS_EXACT_VAL(0x6),
487 id_aa64dfr0_debugver),
492 /* ID_AA64DFR1_EL1 */
493 static const struct mrs_field id_aa64dfr1_fields[] = {
498 /* ID_AA64ISAR0_EL1 */
499 static const struct mrs_field_value id_aa64isar0_rndr[] = {
500 MRS_FIELD_VALUE(ID_AA64ISAR0_RNDR_NONE, ""),
501 MRS_FIELD_VALUE(ID_AA64ISAR0_RNDR_IMPL, "RNG"),
505 static const struct mrs_field_hwcap id_aa64isar0_rndr_caps[] = {
506 MRS_HWCAP(2, HWCAP2_RNG, ID_AA64ISAR0_RNDR_IMPL),
510 static const struct mrs_field_value id_aa64isar0_tlb[] = {
511 MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_NONE, ""),
512 MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_TLBIOS, "TLBI-OS"),
513 MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_TLBIOSR, "TLBI-OSR"),
517 static const struct mrs_field_value id_aa64isar0_ts[] = {
518 MRS_FIELD_VALUE(ID_AA64ISAR0_TS_NONE, ""),
519 MRS_FIELD_VALUE(ID_AA64ISAR0_TS_CondM_8_4, "CondM-8.4"),
520 MRS_FIELD_VALUE(ID_AA64ISAR0_TS_CondM_8_5, "CondM-8.5"),
524 static const struct mrs_field_hwcap id_aa64isar0_ts_caps[] = {
525 MRS_HWCAP(1, HWCAP_FLAGM, ID_AA64ISAR0_TS_CondM_8_4),
526 MRS_HWCAP(2, HWCAP2_FLAGM2, ID_AA64ISAR0_TS_CondM_8_5),
530 static const struct mrs_field_value id_aa64isar0_fhm[] = {
531 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, FHM, NONE, IMPL),
535 static const struct mrs_field_hwcap id_aa64isar0_fhm_caps[] = {
536 MRS_HWCAP(1, HWCAP_ASIMDFHM, ID_AA64ISAR0_FHM_IMPL),
540 static const struct mrs_field_value id_aa64isar0_dp[] = {
541 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, DP, NONE, IMPL),
545 static const struct mrs_field_hwcap id_aa64isar0_dp_caps[] = {
546 MRS_HWCAP(1, HWCAP_ASIMDDP, ID_AA64ISAR0_DP_IMPL),
550 static const struct mrs_field_value id_aa64isar0_sm4[] = {
551 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM4, NONE, IMPL),
555 static const struct mrs_field_hwcap id_aa64isar0_sm4_caps[] = {
556 MRS_HWCAP(1, HWCAP_SM4, ID_AA64ISAR0_SM4_IMPL),
560 static const struct mrs_field_value id_aa64isar0_sm3[] = {
561 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM3, NONE, IMPL),
565 static const struct mrs_field_hwcap id_aa64isar0_sm3_caps[] = {
566 MRS_HWCAP(1, HWCAP_SM3, ID_AA64ISAR0_SM3_IMPL),
570 static const struct mrs_field_value id_aa64isar0_sha3[] = {
571 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA3, NONE, IMPL),
575 static const struct mrs_field_hwcap id_aa64isar0_sha3_caps[] = {
576 MRS_HWCAP(1, HWCAP_SHA3, ID_AA64ISAR0_SHA3_IMPL),
580 static const struct mrs_field_value id_aa64isar0_rdm[] = {
581 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, RDM, NONE, IMPL),
585 static const struct mrs_field_hwcap id_aa64isar0_rdm_caps[] = {
586 MRS_HWCAP(1, HWCAP_ASIMDRDM, ID_AA64ISAR0_RDM_IMPL),
590 static const struct mrs_field_value id_aa64isar0_tme[] = {
591 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, TME, NONE, IMPL),
595 static const struct mrs_field_value id_aa64isar0_atomic[] = {
596 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, Atomic, NONE, IMPL),
600 static const struct mrs_field_hwcap id_aa64isar0_atomic_caps[] = {
601 MRS_HWCAP(1, HWCAP_ATOMICS, ID_AA64ISAR0_Atomic_IMPL),
605 static const struct mrs_field_value id_aa64isar0_crc32[] = {
606 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, CRC32, NONE, BASE),
610 static const struct mrs_field_hwcap id_aa64isar0_crc32_caps[] = {
611 MRS_HWCAP(1, HWCAP_CRC32, ID_AA64ISAR0_CRC32_BASE),
615 static const struct mrs_field_value id_aa64isar0_sha2[] = {
616 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA2, NONE, BASE),
617 MRS_FIELD_VALUE(ID_AA64ISAR0_SHA2_512, "SHA2+SHA512"),
621 static const struct mrs_field_hwcap id_aa64isar0_sha2_caps[] = {
622 MRS_HWCAP(1, HWCAP_SHA2, ID_AA64ISAR0_SHA2_BASE),
623 MRS_HWCAP(1, HWCAP_SHA512, ID_AA64ISAR0_SHA2_512),
627 static const struct mrs_field_value id_aa64isar0_sha1[] = {
628 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA1, NONE, BASE),
632 static const struct mrs_field_hwcap id_aa64isar0_sha1_caps[] = {
633 MRS_HWCAP(1, HWCAP_SHA1, ID_AA64ISAR0_SHA1_BASE),
637 static const struct mrs_field_value id_aa64isar0_aes[] = {
638 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, AES, NONE, BASE),
639 MRS_FIELD_VALUE(ID_AA64ISAR0_AES_PMULL, "AES+PMULL"),
643 static const struct mrs_field_hwcap id_aa64isar0_aes_caps[] = {
644 MRS_HWCAP(1, HWCAP_AES, ID_AA64ISAR0_AES_BASE),
645 MRS_HWCAP(1, HWCAP_PMULL, ID_AA64ISAR0_AES_PMULL),
649 static const struct mrs_field id_aa64isar0_fields[] = {
650 MRS_FIELD_HWCAP(ID_AA64ISAR0, RNDR, false, MRS_LOWER,
651 id_aa64isar0_rndr, id_aa64isar0_rndr_caps),
652 MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_EXACT, id_aa64isar0_tlb),
653 MRS_FIELD_HWCAP(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts,
654 id_aa64isar0_ts_caps),
655 MRS_FIELD_HWCAP(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm,
656 id_aa64isar0_fhm_caps),
657 MRS_FIELD_HWCAP(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp,
658 id_aa64isar0_dp_caps),
659 MRS_FIELD_HWCAP(ID_AA64ISAR0, SM4, false, MRS_LOWER, id_aa64isar0_sm4,
660 id_aa64isar0_sm4_caps),
661 MRS_FIELD_HWCAP(ID_AA64ISAR0, SM3, false, MRS_LOWER, id_aa64isar0_sm3,
662 id_aa64isar0_sm3_caps),
663 MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA3, false, MRS_LOWER, id_aa64isar0_sha3,
664 id_aa64isar0_sha3_caps),
665 MRS_FIELD_HWCAP(ID_AA64ISAR0, RDM, false, MRS_LOWER, id_aa64isar0_rdm,
666 id_aa64isar0_rdm_caps),
667 MRS_FIELD(ID_AA64ISAR0, TME, false, MRS_EXACT, id_aa64isar0_tme),
668 MRS_FIELD_HWCAP(ID_AA64ISAR0, Atomic, false, MRS_LOWER,
669 id_aa64isar0_atomic, id_aa64isar0_atomic_caps),
670 MRS_FIELD_HWCAP(ID_AA64ISAR0, CRC32, false, MRS_LOWER,
671 id_aa64isar0_crc32, id_aa64isar0_crc32_caps),
672 MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA2, false, MRS_LOWER, id_aa64isar0_sha2,
673 id_aa64isar0_sha2_caps),
674 MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA1, false, MRS_LOWER,
675 id_aa64isar0_sha1, id_aa64isar0_sha1_caps),
676 MRS_FIELD_HWCAP(ID_AA64ISAR0, AES, false, MRS_LOWER, id_aa64isar0_aes,
677 id_aa64isar0_aes_caps),
682 /* ID_AA64ISAR1_EL1 */
683 static const struct mrs_field_value id_aa64isar1_ls64[] = {
684 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, LS64, NONE, IMPL),
685 MRS_FIELD_VALUE(ID_AA64ISAR1_LS64_V, "LS64v"),
686 MRS_FIELD_VALUE(ID_AA64ISAR1_LS64_ACCDATA, "LS64+ACCDATA"),
690 static const struct mrs_field_value id_aa64isar1_xs[] = {
691 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, XS, NONE, IMPL),
695 static const struct mrs_field_value id_aa64isar1_i8mm[] = {
696 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, I8MM, NONE, IMPL),
700 static const struct mrs_field_hwcap id_aa64isar1_i8mm_caps[] = {
701 MRS_HWCAP(2, HWCAP2_I8MM, ID_AA64ISAR1_I8MM_IMPL),
705 static const struct mrs_field_value id_aa64isar1_dgh[] = {
706 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, DGH, NONE, IMPL),
710 static const struct mrs_field_hwcap id_aa64isar1_dgh_caps[] = {
711 MRS_HWCAP(2, HWCAP2_DGH, ID_AA64ISAR1_DGH_IMPL),
715 static const struct mrs_field_value id_aa64isar1_bf16[] = {
716 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, BF16, NONE, IMPL),
717 MRS_FIELD_VALUE(ID_AA64ISAR1_BF16_EBF, "EBF16"),
721 static const struct mrs_field_hwcap id_aa64isar1_bf16_caps[] = {
722 MRS_HWCAP(2, HWCAP2_BF16, ID_AA64ISAR1_BF16_IMPL),
726 static const struct mrs_field_value id_aa64isar1_specres[] = {
727 MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_NONE, ""),
728 MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_IMPL, "PredInv"),
732 static const struct mrs_field_value id_aa64isar1_sb[] = {
733 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, SB, NONE, IMPL),
737 static const struct mrs_field_hwcap id_aa64isar1_sb_caps[] = {
738 MRS_HWCAP(1, HWCAP_SB, ID_AA64ISAR1_SB_IMPL),
742 static const struct mrs_field_value id_aa64isar1_frintts[] = {
743 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FRINTTS, NONE, IMPL),
747 static const struct mrs_field_hwcap id_aa64isar1_frintts_caps[] = {
748 MRS_HWCAP(2, HWCAP2_FRINT, ID_AA64ISAR1_FRINTTS_IMPL),
752 static const struct mrs_field_value id_aa64isar1_gpi[] = {
753 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPI, NONE, IMPL),
757 static const struct mrs_field_hwcap id_aa64isar1_gpi_caps[] = {
758 MRS_HWCAP(1, HWCAP_PACG, ID_AA64ISAR1_GPI_IMPL),
762 static const struct mrs_field_value id_aa64isar1_gpa[] = {
763 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPA, NONE, IMPL),
767 static const struct mrs_field_hwcap id_aa64isar1_gpa_caps[] = {
768 MRS_HWCAP(1, HWCAP_PACG, ID_AA64ISAR1_GPA_IMPL),
772 static const struct mrs_field_value id_aa64isar1_lrcpc[] = {
773 MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_NONE, ""),
774 MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_RCPC_8_3, "RCPC-8.3"),
775 MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_RCPC_8_4, "RCPC-8.4"),
779 static const struct mrs_field_hwcap id_aa64isar1_lrcpc_caps[] = {
780 MRS_HWCAP(1, HWCAP_LRCPC, ID_AA64ISAR1_LRCPC_RCPC_8_3),
781 MRS_HWCAP(1, HWCAP_ILRCPC, ID_AA64ISAR1_LRCPC_RCPC_8_4),
785 static const struct mrs_field_value id_aa64isar1_fcma[] = {
786 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FCMA, NONE, IMPL),
790 static const struct mrs_field_hwcap id_aa64isar1_fcma_caps[] = {
791 MRS_HWCAP(1, HWCAP_FCMA, ID_AA64ISAR1_FCMA_IMPL),
795 static const struct mrs_field_value id_aa64isar1_jscvt[] = {
796 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, JSCVT, NONE, IMPL),
800 static const struct mrs_field_hwcap id_aa64isar1_jscvt_caps[] = {
801 MRS_HWCAP(1, HWCAP_JSCVT, ID_AA64ISAR1_JSCVT_IMPL),
805 static const struct mrs_field_value id_aa64isar1_api[] = {
806 MRS_FIELD_VALUE(ID_AA64ISAR1_API_NONE, ""),
807 MRS_FIELD_VALUE(ID_AA64ISAR1_API_PAC, "API PAC"),
808 MRS_FIELD_VALUE(ID_AA64ISAR1_API_EPAC, "API EPAC"),
809 MRS_FIELD_VALUE(ID_AA64ISAR1_API_EPAC2, "Impl PAuth+EPAC2"),
810 MRS_FIELD_VALUE(ID_AA64ISAR1_API_FPAC, "Impl PAuth+FPAC"),
811 MRS_FIELD_VALUE(ID_AA64ISAR1_API_FPAC_COMBINED,
812 "Impl PAuth+FPAC+Combined"),
816 static const struct mrs_field_hwcap id_aa64isar1_api_caps[] = {
817 MRS_HWCAP(1, HWCAP_PACA, ID_AA64ISAR1_API_PAC),
821 static const struct mrs_field_value id_aa64isar1_apa[] = {
822 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_NONE, ""),
823 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_PAC, "APA PAC"),
824 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_EPAC, "APA EPAC"),
825 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_EPAC2, "APA EPAC2"),
826 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_FPAC, "APA FPAC"),
827 MRS_FIELD_VALUE(ID_AA64ISAR1_APA_FPAC_COMBINED,
828 "APA FPAC+Combined"),
832 static const struct mrs_field_hwcap id_aa64isar1_apa_caps[] = {
833 MRS_HWCAP(1, HWCAP_PACA, ID_AA64ISAR1_APA_PAC),
837 static const struct mrs_field_value id_aa64isar1_dpb[] = {
838 MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_NONE, ""),
839 MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_DCCVAP, "DCPoP"),
840 MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_DCCVADP, "DCCVADP"),
844 static const struct mrs_field_hwcap id_aa64isar1_dpb_caps[] = {
845 MRS_HWCAP(1, HWCAP_DCPOP, ID_AA64ISAR1_DPB_DCCVAP),
846 MRS_HWCAP(2, HWCAP2_DCPODP, ID_AA64ISAR1_DPB_DCCVADP),
850 static const struct mrs_field id_aa64isar1_fields[] = {
851 MRS_FIELD(ID_AA64ISAR1, LS64, false, MRS_EXACT, id_aa64isar1_ls64),
852 MRS_FIELD(ID_AA64ISAR1, XS, false, MRS_EXACT, id_aa64isar1_xs),
853 MRS_FIELD_HWCAP(ID_AA64ISAR1, I8MM, false, MRS_LOWER,
854 id_aa64isar1_i8mm, id_aa64isar1_i8mm_caps),
855 MRS_FIELD_HWCAP(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh,
856 id_aa64isar1_dgh_caps),
857 MRS_FIELD_HWCAP(ID_AA64ISAR1, BF16, false, MRS_LOWER,
858 id_aa64isar1_bf16, id_aa64isar1_bf16_caps),
859 MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_EXACT,
860 id_aa64isar1_specres),
861 MRS_FIELD_HWCAP(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb,
862 id_aa64isar1_sb_caps),
863 MRS_FIELD_HWCAP(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER,
864 id_aa64isar1_frintts, id_aa64isar1_frintts_caps),
865 MRS_FIELD_HWCAP(ID_AA64ISAR1, GPI, false, MRS_EXACT, id_aa64isar1_gpi,
866 id_aa64isar1_gpi_caps),
867 MRS_FIELD_HWCAP(ID_AA64ISAR1, GPA, false, MRS_EXACT, id_aa64isar1_gpa,
868 id_aa64isar1_gpa_caps),
869 MRS_FIELD_HWCAP(ID_AA64ISAR1, LRCPC, false, MRS_LOWER,
870 id_aa64isar1_lrcpc, id_aa64isar1_lrcpc_caps),
871 MRS_FIELD_HWCAP(ID_AA64ISAR1, FCMA, false, MRS_LOWER,
872 id_aa64isar1_fcma, id_aa64isar1_fcma_caps),
873 MRS_FIELD_HWCAP(ID_AA64ISAR1, JSCVT, false, MRS_LOWER,
874 id_aa64isar1_jscvt, id_aa64isar1_jscvt_caps),
875 MRS_FIELD_HWCAP(ID_AA64ISAR1, API, false, MRS_EXACT, id_aa64isar1_api,
876 id_aa64isar1_api_caps),
877 MRS_FIELD_HWCAP(ID_AA64ISAR1, APA, false, MRS_EXACT, id_aa64isar1_apa,
878 id_aa64isar1_apa_caps),
879 MRS_FIELD_HWCAP(ID_AA64ISAR1, DPB, false, MRS_LOWER, id_aa64isar1_dpb,
880 id_aa64isar1_dpb_caps),
885 /* ID_AA64ISAR2_EL1 */
886 static const struct mrs_field_value id_aa64isar2_pac_frac[] = {
887 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, PAC_frac, NONE, IMPL),
891 static const struct mrs_field_value id_aa64isar2_bc[] = {
892 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, BC, NONE, IMPL),
896 static const struct mrs_field_value id_aa64isar2_mops[] = {
897 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, MOPS, NONE, IMPL),
901 static const struct mrs_field_value id_aa64isar2_apa3[] = {
902 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_NONE, ""),
903 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_PAC, "APA3 PAC"),
904 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_EPAC, "APA3 EPAC"),
905 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_EPAC2, "APA3 EPAC2"),
906 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_FPAC, "APA3 FPAC"),
907 MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_FPAC_COMBINED,
908 "APA3 FPAC+Combined"),
912 static const struct mrs_field_hwcap id_aa64isar2_apa3_caps[] = {
913 MRS_HWCAP(1, HWCAP_PACA, ID_AA64ISAR2_APA3_PAC),
917 static const struct mrs_field_value id_aa64isar2_gpa3[] = {
918 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, GPA3, NONE, IMPL),
922 static const struct mrs_field_hwcap id_aa64isar2_gpa3_caps[] = {
923 MRS_HWCAP(1, HWCAP_PACG, ID_AA64ISAR2_GPA3_IMPL),
927 static const struct mrs_field_value id_aa64isar2_rpres[] = {
928 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, RPRES, NONE, IMPL),
932 static const struct mrs_field_value id_aa64isar2_wfxt[] = {
933 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR2, WFxT, NONE, IMPL),
937 static const struct mrs_field id_aa64isar2_fields[] = {
938 MRS_FIELD(ID_AA64ISAR2, PAC_frac, false, MRS_EXACT,
939 id_aa64isar2_pac_frac),
940 MRS_FIELD(ID_AA64ISAR2, BC, false, MRS_EXACT, id_aa64isar2_bc),
941 MRS_FIELD(ID_AA64ISAR2, MOPS, false, MRS_EXACT, id_aa64isar2_mops),
942 MRS_FIELD_HWCAP(ID_AA64ISAR2, APA3, false, MRS_EXACT,
943 id_aa64isar2_apa3, id_aa64isar2_apa3_caps),
944 MRS_FIELD_HWCAP(ID_AA64ISAR2, GPA3, false, MRS_EXACT,
945 id_aa64isar2_gpa3, id_aa64isar2_gpa3_caps),
946 MRS_FIELD(ID_AA64ISAR2, RPRES, false, MRS_EXACT, id_aa64isar2_rpres),
947 MRS_FIELD(ID_AA64ISAR2, WFxT, false, MRS_EXACT, id_aa64isar2_wfxt),
952 /* ID_AA64MMFR0_EL1 */
953 static const struct mrs_field_value id_aa64mmfr0_ecv[] = {
954 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, ECV, NONE, IMPL),
955 MRS_FIELD_VALUE(ID_AA64MMFR0_ECV_CNTHCTL, "ECV+CNTHCTL"),
959 static const struct mrs_field_value id_aa64mmfr0_fgt[] = {
960 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, FGT, NONE, IMPL),
964 static const struct mrs_field_value id_aa64mmfr0_exs[] = {
965 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, ExS, ALL, IMPL),
969 static const struct mrs_field_value id_aa64mmfr0_tgran4_2[] = {
970 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_TGran4, ""),
971 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_NONE, "No S2 TGran4"),
972 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_IMPL, "S2 TGran4"),
973 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_LPA2, "S2 TGran4+LPA2"),
977 static const struct mrs_field_value id_aa64mmfr0_tgran64_2[] = {
978 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_TGran64, ""),
979 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_NONE, "No S2 TGran64"),
980 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_IMPL, "S2 TGran64"),
984 static const struct mrs_field_value id_aa64mmfr0_tgran16_2[] = {
985 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_TGran16, ""),
986 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_NONE, "No S2 TGran16"),
987 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_IMPL, "S2 TGran16"),
988 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_LPA2, "S2 TGran16+LPA2"),
992 static const struct mrs_field_value id_aa64mmfr0_tgran4[] = {
993 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4, NONE, IMPL),
994 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_LPA2, "TGran4+LPA2"),
998 static const struct mrs_field_value id_aa64mmfr0_tgran64[] = {
999 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran64, NONE, IMPL),
1000 MRS_FIELD_VALUE_END,
1003 static const struct mrs_field_value id_aa64mmfr0_tgran16[] = {
1004 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran16, NONE, IMPL),
1005 MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_LPA2, "TGran16+LPA2"),
1006 MRS_FIELD_VALUE_END,
1009 static const struct mrs_field_value id_aa64mmfr0_bigendel0[] = {
1010 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEndEL0, FIXED, MIXED),
1011 MRS_FIELD_VALUE_END,
1014 static const struct mrs_field_value id_aa64mmfr0_snsmem[] = {
1015 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, SNSMem, NONE, DISTINCT),
1016 MRS_FIELD_VALUE_END,
1019 static const struct mrs_field_value id_aa64mmfr0_bigend[] = {
1020 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEnd, FIXED, MIXED),
1021 MRS_FIELD_VALUE_END,
1024 static const struct mrs_field_value id_aa64mmfr0_asidbits[] = {
1025 MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_8, "8bit ASID"),
1026 MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_16, "16bit ASID"),
1027 MRS_FIELD_VALUE_END,
1030 static const struct mrs_field_value id_aa64mmfr0_parange[] = {
1031 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4G, "4GB PA"),
1032 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_64G, "64GB PA"),
1033 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_1T, "1TB PA"),
1034 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4T, "4TB PA"),
1035 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_16T, "16TB PA"),
1036 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_256T, "256TB PA"),
1037 MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4P, "4PB PA"),
1038 MRS_FIELD_VALUE_END,
1041 static const struct mrs_field id_aa64mmfr0_fields[] = {
1042 MRS_FIELD(ID_AA64MMFR0, ECV, false, MRS_EXACT, id_aa64mmfr0_ecv),
1043 MRS_FIELD(ID_AA64MMFR0, FGT, false, MRS_EXACT, id_aa64mmfr0_fgt),
1044 MRS_FIELD(ID_AA64MMFR0, ExS, false, MRS_EXACT, id_aa64mmfr0_exs),
1045 MRS_FIELD(ID_AA64MMFR0, TGran4_2, false, MRS_EXACT,
1046 id_aa64mmfr0_tgran4_2),
1047 MRS_FIELD(ID_AA64MMFR0, TGran64_2, false, MRS_EXACT,
1048 id_aa64mmfr0_tgran64_2),
1049 MRS_FIELD(ID_AA64MMFR0, TGran16_2, false, MRS_EXACT,
1050 id_aa64mmfr0_tgran16_2),
1051 MRS_FIELD(ID_AA64MMFR0, TGran4, false, MRS_EXACT, id_aa64mmfr0_tgran4),
1052 MRS_FIELD(ID_AA64MMFR0, TGran64, false, MRS_EXACT,
1053 id_aa64mmfr0_tgran64),
1054 MRS_FIELD(ID_AA64MMFR0, TGran16, false, MRS_EXACT,
1055 id_aa64mmfr0_tgran16),
1056 MRS_FIELD(ID_AA64MMFR0, BigEndEL0, false, MRS_EXACT,
1057 id_aa64mmfr0_bigendel0),
1058 MRS_FIELD(ID_AA64MMFR0, SNSMem, false, MRS_EXACT, id_aa64mmfr0_snsmem),
1059 MRS_FIELD(ID_AA64MMFR0, BigEnd, false, MRS_EXACT, id_aa64mmfr0_bigend),
1060 MRS_FIELD(ID_AA64MMFR0, ASIDBits, false, MRS_EXACT,
1061 id_aa64mmfr0_asidbits),
1062 MRS_FIELD(ID_AA64MMFR0, PARange, false, MRS_EXACT,
1063 id_aa64mmfr0_parange),
1068 /* ID_AA64MMFR1_EL1 */
1069 static const struct mrs_field_value id_aa64mmfr1_cmovw[] = {
1070 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, CMOVW, NONE, IMPL),
1071 MRS_FIELD_VALUE_END,
1074 static const struct mrs_field_value id_aa64mmfr1_tidcp1[] = {
1075 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, TIDCP1, NONE, IMPL),
1076 MRS_FIELD_VALUE_END,
1079 static const struct mrs_field_value id_aa64mmfr1_ntlbpa[] = {
1080 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, nTLBPA, NONE, IMPL),
1081 MRS_FIELD_VALUE_END,
1084 static const struct mrs_field_value id_aa64mmfr1_afp[] = {
1085 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, AFP, NONE, IMPL),
1086 MRS_FIELD_VALUE_END,
1089 static const struct mrs_field_value id_aa64mmfr1_hcx[] = {
1090 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, HCX, NONE, IMPL),
1091 MRS_FIELD_VALUE_END,
1094 static const struct mrs_field_value id_aa64mmfr1_ets[] = {
1095 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, ETS, NONE, IMPL),
1096 MRS_FIELD_VALUE_END,
1099 static const struct mrs_field_value id_aa64mmfr1_twed[] = {
1100 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, TWED, NONE, IMPL),
1101 MRS_FIELD_VALUE_END,
1104 static const struct mrs_field_value id_aa64mmfr1_xnx[] = {
1105 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, XNX, NONE, IMPL),
1106 MRS_FIELD_VALUE_END,
1109 static const struct mrs_field_value id_aa64mmfr1_specsei[] = {
1110 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, SpecSEI, NONE, IMPL),
1111 MRS_FIELD_VALUE_END,
1114 static const struct mrs_field_value id_aa64mmfr1_pan[] = {
1115 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, PAN, NONE, IMPL),
1116 MRS_FIELD_VALUE(ID_AA64MMFR1_PAN_ATS1E1, "PAN+ATS1E1"),
1117 MRS_FIELD_VALUE(ID_AA64MMFR1_PAN_EPAN, "EPAN"),
1118 MRS_FIELD_VALUE_END,
1121 static const struct mrs_field_value id_aa64mmfr1_lo[] = {
1122 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, LO, NONE, IMPL),
1123 MRS_FIELD_VALUE_END,
1126 static const struct mrs_field_value id_aa64mmfr1_hpds[] = {
1127 MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_NONE, ""),
1128 MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_HPD, "HPD"),
1129 MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_TTPBHA, "HPD+TTPBHA"),
1130 MRS_FIELD_VALUE_END,
1133 static const struct mrs_field_value id_aa64mmfr1_vh[] = {
1134 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, VH, NONE, IMPL),
1135 MRS_FIELD_VALUE_END,
1138 static const struct mrs_field_value id_aa64mmfr1_vmidbits[] = {
1139 MRS_FIELD_VALUE(ID_AA64MMFR1_VMIDBits_8, "8bit VMID"),
1140 MRS_FIELD_VALUE(ID_AA64MMFR1_VMIDBits_16, "16bit VMID"),
1141 MRS_FIELD_VALUE_END,
1144 static const struct mrs_field_value id_aa64mmfr1_hafdbs[] = {
1145 MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_NONE, ""),
1146 MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_AF, "HAF"),
1147 MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_AF_DBS, "HAF+DS"),
1148 MRS_FIELD_VALUE_END,
1151 static const struct mrs_field id_aa64mmfr1_fields[] = {
1152 MRS_FIELD(ID_AA64MMFR1, CMOVW, false, MRS_EXACT, id_aa64mmfr1_cmovw),
1153 MRS_FIELD(ID_AA64MMFR1, TIDCP1, false, MRS_EXACT, id_aa64mmfr1_tidcp1),
1154 MRS_FIELD(ID_AA64MMFR1, nTLBPA, false, MRS_EXACT, id_aa64mmfr1_ntlbpa),
1155 MRS_FIELD(ID_AA64MMFR1, AFP, false, MRS_EXACT, id_aa64mmfr1_afp),
1156 MRS_FIELD(ID_AA64MMFR1, HCX, false, MRS_EXACT, id_aa64mmfr1_hcx),
1157 MRS_FIELD(ID_AA64MMFR1, ETS, false, MRS_EXACT, id_aa64mmfr1_ets),
1158 MRS_FIELD(ID_AA64MMFR1, TWED, false, MRS_EXACT, id_aa64mmfr1_twed),
1159 MRS_FIELD(ID_AA64MMFR1, XNX, false, MRS_EXACT, id_aa64mmfr1_xnx),
1160 MRS_FIELD(ID_AA64MMFR1, SpecSEI, false, MRS_EXACT,
1161 id_aa64mmfr1_specsei),
1162 MRS_FIELD(ID_AA64MMFR1, PAN, false, MRS_EXACT, id_aa64mmfr1_pan),
1163 MRS_FIELD(ID_AA64MMFR1, LO, false, MRS_EXACT, id_aa64mmfr1_lo),
1164 MRS_FIELD(ID_AA64MMFR1, HPDS, false, MRS_EXACT, id_aa64mmfr1_hpds),
1165 MRS_FIELD(ID_AA64MMFR1, VH, false, MRS_EXACT, id_aa64mmfr1_vh),
1166 MRS_FIELD(ID_AA64MMFR1, VMIDBits, false, MRS_EXACT,
1167 id_aa64mmfr1_vmidbits),
1168 MRS_FIELD(ID_AA64MMFR1, HAFDBS, false, MRS_EXACT, id_aa64mmfr1_hafdbs),
1173 /* ID_AA64MMFR2_EL1 */
1174 static const struct mrs_field_value id_aa64mmfr2_e0pd[] = {
1175 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, E0PD, NONE, IMPL),
1176 MRS_FIELD_VALUE_END,
1179 static const struct mrs_field_value id_aa64mmfr2_evt[] = {
1180 MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_NONE, ""),
1181 MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_8_2, "EVT-8.2"),
1182 MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_8_5, "EVT-8.5"),
1183 MRS_FIELD_VALUE_END,
1186 static const struct mrs_field_value id_aa64mmfr2_bbm[] = {
1187 MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL0, ""),
1188 MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL1, "BBM level 1"),
1189 MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL2, "BBM level 2"),
1190 MRS_FIELD_VALUE_END,
1193 static const struct mrs_field_value id_aa64mmfr2_ttl[] = {
1194 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, TTL, NONE, IMPL),
1195 MRS_FIELD_VALUE_END,
1198 static const struct mrs_field_value id_aa64mmfr2_fwb[] = {
1199 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, FWB, NONE, IMPL),
1200 MRS_FIELD_VALUE_END,
1203 static const struct mrs_field_value id_aa64mmfr2_ids[] = {
1204 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, IDS, NONE, IMPL),
1205 MRS_FIELD_VALUE_END,
1208 static const struct mrs_field_value id_aa64mmfr2_at[] = {
1209 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, AT, NONE, IMPL),
1210 MRS_FIELD_VALUE_END,
1213 static const struct mrs_field_hwcap id_aa64mmfr2_at_caps[] = {
1214 MRS_HWCAP(1, HWCAP_USCAT, ID_AA64MMFR2_AT_IMPL),
1218 static const struct mrs_field_value id_aa64mmfr2_st[] = {
1219 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, ST, NONE, IMPL),
1220 MRS_FIELD_VALUE_END,
1223 static const struct mrs_field_value id_aa64mmfr2_nv[] = {
1224 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, 8_3),
1225 MRS_FIELD_VALUE(ID_AA64MMFR2_NV_8_4, "NV v8.4"),
1226 MRS_FIELD_VALUE_END,
1229 static const struct mrs_field_value id_aa64mmfr2_ccidx[] = {
1230 MRS_FIELD_VALUE(ID_AA64MMFR2_CCIDX_32, "32bit CCIDX"),
1231 MRS_FIELD_VALUE(ID_AA64MMFR2_CCIDX_64, "64bit CCIDX"),
1232 MRS_FIELD_VALUE_END,
1235 static const struct mrs_field_value id_aa64mmfr2_varange[] = {
1236 MRS_FIELD_VALUE(ID_AA64MMFR2_VARange_48, "48bit VA"),
1237 MRS_FIELD_VALUE(ID_AA64MMFR2_VARange_52, "52bit VA"),
1238 MRS_FIELD_VALUE_END,
1241 static const struct mrs_field_value id_aa64mmfr2_iesb[] = {
1242 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, IESB, NONE, IMPL),
1243 MRS_FIELD_VALUE_END,
1246 static const struct mrs_field_value id_aa64mmfr2_lsm[] = {
1247 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, LSM, NONE, IMPL),
1248 MRS_FIELD_VALUE_END,
1251 static const struct mrs_field_value id_aa64mmfr2_uao[] = {
1252 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, UAO, NONE, IMPL),
1253 MRS_FIELD_VALUE_END,
1256 static const struct mrs_field_value id_aa64mmfr2_cnp[] = {
1257 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, CnP, NONE, IMPL),
1258 MRS_FIELD_VALUE_END,
1261 static const struct mrs_field id_aa64mmfr2_fields[] = {
1262 MRS_FIELD(ID_AA64MMFR2, E0PD, false, MRS_EXACT, id_aa64mmfr2_e0pd),
1263 MRS_FIELD(ID_AA64MMFR2, EVT, false, MRS_EXACT, id_aa64mmfr2_evt),
1264 MRS_FIELD(ID_AA64MMFR2, BBM, false, MRS_EXACT, id_aa64mmfr2_bbm),
1265 MRS_FIELD(ID_AA64MMFR2, TTL, false, MRS_EXACT, id_aa64mmfr2_ttl),
1266 MRS_FIELD(ID_AA64MMFR2, FWB, false, MRS_EXACT, id_aa64mmfr2_fwb),
1267 MRS_FIELD(ID_AA64MMFR2, IDS, false, MRS_EXACT, id_aa64mmfr2_ids),
1268 MRS_FIELD_HWCAP(ID_AA64MMFR2, AT, false, MRS_LOWER, id_aa64mmfr2_at,
1269 id_aa64mmfr2_at_caps),
1270 MRS_FIELD(ID_AA64MMFR2, ST, false, MRS_EXACT, id_aa64mmfr2_st),
1271 MRS_FIELD(ID_AA64MMFR2, NV, false, MRS_EXACT, id_aa64mmfr2_nv),
1272 MRS_FIELD(ID_AA64MMFR2, CCIDX, false, MRS_EXACT, id_aa64mmfr2_ccidx),
1273 MRS_FIELD(ID_AA64MMFR2, VARange, false, MRS_EXACT,
1274 id_aa64mmfr2_varange),
1275 MRS_FIELD(ID_AA64MMFR2, IESB, false, MRS_EXACT, id_aa64mmfr2_iesb),
1276 MRS_FIELD(ID_AA64MMFR2, LSM, false, MRS_EXACT, id_aa64mmfr2_lsm),
1277 MRS_FIELD(ID_AA64MMFR2, UAO, false, MRS_EXACT, id_aa64mmfr2_uao),
1278 MRS_FIELD(ID_AA64MMFR2, CnP, false, MRS_EXACT, id_aa64mmfr2_cnp),
1284 /* ID_AA64MMFR2_EL1 */
1285 static const struct mrs_field_value id_aa64mmfr3_spec_fpacc[] = {
1286 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR3, Spec_FPACC, NONE, IMPL),
1287 MRS_FIELD_VALUE_END,
1290 static const struct mrs_field_value id_aa64mmfr3_mec[] = {
1291 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR3, MEC, NONE, IMPL),
1292 MRS_FIELD_VALUE_END,
1295 static const struct mrs_field_value id_aa64mmfr3_sctlrx[] = {
1296 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR3, SCTLRX, NONE, IMPL),
1297 MRS_FIELD_VALUE_END,
1300 static const struct mrs_field_value id_aa64mmfr3_tcrx[] = {
1301 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR3, TCRX, NONE, IMPL),
1302 MRS_FIELD_VALUE_END,
1305 static const struct mrs_field id_aa64mmfr3_fields[] = {
1306 MRS_FIELD(ID_AA64MMFR3, Spec_FPACC, false, MRS_EXACT,
1307 id_aa64mmfr3_spec_fpacc),
1308 MRS_FIELD(ID_AA64MMFR3, MEC, false, MRS_EXACT, id_aa64mmfr3_mec),
1309 MRS_FIELD(ID_AA64MMFR3, SCTLRX, false, MRS_EXACT, id_aa64mmfr3_sctlrx),
1310 MRS_FIELD(ID_AA64MMFR3, TCRX, false, MRS_EXACT, id_aa64mmfr3_tcrx),
1315 /* ID_AA64MMFR4_EL1 */
1316 static const struct mrs_field id_aa64mmfr4_fields[] = {
1322 /* ID_AA64PFR0_EL1 */
1323 static const struct mrs_field_value id_aa64pfr0_csv3[] = {
1324 MRS_FIELD_VALUE(ID_AA64PFR0_CSV3_NONE, ""),
1325 MRS_FIELD_VALUE(ID_AA64PFR0_CSV3_ISOLATED, "CSV3"),
1326 MRS_FIELD_VALUE_END,
1329 static const struct mrs_field_value id_aa64pfr0_csv2[] = {
1330 MRS_FIELD_VALUE(ID_AA64PFR0_CSV2_NONE, ""),
1331 MRS_FIELD_VALUE(ID_AA64PFR0_CSV2_ISOLATED, "CSV2"),
1332 MRS_FIELD_VALUE(ID_AA64PFR0_CSV2_SCXTNUM, "CSV2_2"),
1333 MRS_FIELD_VALUE(ID_AA64PFR0_CSV2_3, "CSV2_3"),
1334 MRS_FIELD_VALUE_END,
1337 static const struct mrs_field_value id_aa64pfr0_rme[] = {
1338 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, RME, NONE, IMPL),
1339 MRS_FIELD_VALUE_END,
1342 static const struct mrs_field_value id_aa64pfr0_dit[] = {
1343 MRS_FIELD_VALUE(ID_AA64PFR0_DIT_NONE, ""),
1344 MRS_FIELD_VALUE(ID_AA64PFR0_DIT_PSTATE, "PSTATE.DIT"),
1345 MRS_FIELD_VALUE_END,
1348 static const struct mrs_field_hwcap id_aa64pfr0_dit_caps[] = {
1349 MRS_HWCAP(1, HWCAP_DIT, ID_AA64PFR0_DIT_PSTATE),
1353 static const struct mrs_field_value id_aa64pfr0_amu[] = {
1354 MRS_FIELD_VALUE(ID_AA64PFR0_AMU_NONE, ""),
1355 MRS_FIELD_VALUE(ID_AA64PFR0_AMU_V1, "AMUv1"),
1356 MRS_FIELD_VALUE(ID_AA64PFR0_AMU_V1_1, "AMUv1p1"),
1357 MRS_FIELD_VALUE_END,
1360 static const struct mrs_field_value id_aa64pfr0_mpam[] = {
1361 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, MPAM, NONE, IMPL),
1362 MRS_FIELD_VALUE_END,
1365 static const struct mrs_field_value id_aa64pfr0_sel2[] = {
1366 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, SEL2, NONE, IMPL),
1367 MRS_FIELD_VALUE_END,
1370 static const struct mrs_field_value id_aa64pfr0_sve[] = {
1371 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, SVE, NONE, IMPL),
1372 MRS_FIELD_VALUE_END,
1376 /* Enable when we add SVE support */
1377 static const struct mrs_field_hwcap id_aa64pfr0_sve_caps[] = {
1378 MRS_HWCAP(1, HWCAP_SVE, ID_AA64PFR0_SVE_IMPL),
1383 static const struct mrs_field_value id_aa64pfr0_ras[] = {
1384 MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""),
1385 MRS_FIELD_VALUE(ID_AA64PFR0_RAS_IMPL, "RAS"),
1386 MRS_FIELD_VALUE(ID_AA64PFR0_RAS_8_4, "RAS v8.4"),
1387 MRS_FIELD_VALUE_END,
1390 static const struct mrs_field_value id_aa64pfr0_gic[] = {
1391 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, GIC, CPUIF_NONE, CPUIF_EN),
1392 MRS_FIELD_VALUE(ID_AA64PFR0_GIC_CPUIF_NONE, ""),
1393 MRS_FIELD_VALUE(ID_AA64PFR0_GIC_CPUIF_EN, "GIC"),
1394 MRS_FIELD_VALUE(ID_AA64PFR0_GIC_CPUIF_4_1, "GIC 4.1"),
1395 MRS_FIELD_VALUE_END,
1398 static const struct mrs_field_value id_aa64pfr0_advsimd[] = {
1399 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, AdvSIMD, NONE, IMPL),
1400 MRS_FIELD_VALUE(ID_AA64PFR0_AdvSIMD_HP, "AdvSIMD+HP"),
1401 MRS_FIELD_VALUE_END,
1404 static const struct mrs_field_hwcap id_aa64pfr0_advsimd_caps[] = {
1405 MRS_HWCAP(1, HWCAP_ASIMD, ID_AA64PFR0_AdvSIMD_IMPL),
1406 MRS_HWCAP(1, HWCAP_ASIMDHP, ID_AA64PFR0_AdvSIMD_HP),
1410 static const struct mrs_field_value id_aa64pfr0_fp[] = {
1411 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, FP, NONE, IMPL),
1412 MRS_FIELD_VALUE(ID_AA64PFR0_FP_HP, "FP+HP"),
1413 MRS_FIELD_VALUE_END,
1416 static const struct mrs_field_hwcap id_aa64pfr0_fp_caps[] = {
1417 MRS_HWCAP(1, HWCAP_FP, ID_AA64PFR0_FP_IMPL),
1418 MRS_HWCAP(1, HWCAP_FPHP, ID_AA64PFR0_FP_HP),
1422 static const struct mrs_field_value id_aa64pfr0_el3[] = {
1423 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, EL3, NONE, 64),
1424 MRS_FIELD_VALUE(ID_AA64PFR0_EL3_64_32, "EL3 32"),
1425 MRS_FIELD_VALUE_END,
1428 static const struct mrs_field_value id_aa64pfr0_el2[] = {
1429 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, EL2, NONE, 64),
1430 MRS_FIELD_VALUE(ID_AA64PFR0_EL2_64_32, "EL2 32"),
1431 MRS_FIELD_VALUE_END,
1434 static const struct mrs_field_value id_aa64pfr0_el1[] = {
1435 MRS_FIELD_VALUE(ID_AA64PFR0_EL1_64, "EL1"),
1436 MRS_FIELD_VALUE(ID_AA64PFR0_EL1_64_32, "EL1 32"),
1437 MRS_FIELD_VALUE_END,
1440 static const struct mrs_field_value id_aa64pfr0_el0[] = {
1441 MRS_FIELD_VALUE(ID_AA64PFR0_EL0_64, "EL0"),
1442 MRS_FIELD_VALUE(ID_AA64PFR0_EL0_64_32, "EL0 32"),
1443 MRS_FIELD_VALUE_END,
1446 static const struct mrs_field id_aa64pfr0_fields[] = {
1447 MRS_FIELD(ID_AA64PFR0, CSV3, false, MRS_EXACT, id_aa64pfr0_csv3),
1448 MRS_FIELD(ID_AA64PFR0, CSV2, false, MRS_EXACT, id_aa64pfr0_csv2),
1449 MRS_FIELD(ID_AA64PFR0, RME, false, MRS_EXACT, id_aa64pfr0_rme),
1450 MRS_FIELD_HWCAP(ID_AA64PFR0, DIT, false, MRS_LOWER, id_aa64pfr0_dit,
1451 id_aa64pfr0_dit_caps),
1452 MRS_FIELD(ID_AA64PFR0, AMU, false, MRS_EXACT, id_aa64pfr0_amu),
1453 MRS_FIELD(ID_AA64PFR0, MPAM, false, MRS_EXACT, id_aa64pfr0_mpam),
1454 MRS_FIELD(ID_AA64PFR0, SEL2, false, MRS_EXACT, id_aa64pfr0_sel2),
1455 MRS_FIELD(ID_AA64PFR0, SVE, false, MRS_EXACT, id_aa64pfr0_sve),
1456 MRS_FIELD(ID_AA64PFR0, RAS, false, MRS_EXACT, id_aa64pfr0_ras),
1457 MRS_FIELD(ID_AA64PFR0, GIC, false, MRS_EXACT, id_aa64pfr0_gic),
1458 MRS_FIELD_HWCAP(ID_AA64PFR0, AdvSIMD, true, MRS_LOWER,
1459 id_aa64pfr0_advsimd, id_aa64pfr0_advsimd_caps),
1460 MRS_FIELD_HWCAP(ID_AA64PFR0, FP, true, MRS_LOWER, id_aa64pfr0_fp,
1461 id_aa64pfr0_fp_caps),
1462 MRS_FIELD(ID_AA64PFR0, EL3, false, MRS_EXACT, id_aa64pfr0_el3),
1463 MRS_FIELD(ID_AA64PFR0, EL2, false, MRS_EXACT, id_aa64pfr0_el2),
1464 MRS_FIELD(ID_AA64PFR0, EL1, false, MRS_LOWER, id_aa64pfr0_el1),
1465 MRS_FIELD(ID_AA64PFR0, EL0, false, MRS_LOWER, id_aa64pfr0_el0),
1470 /* ID_AA64PFR1_EL1 */
1471 static const struct mrs_field_value id_aa64pfr1_nmi[] = {
1472 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR1, NMI, NONE, IMPL),
1473 MRS_FIELD_VALUE_END,
1476 static const struct mrs_field_value id_aa64pfr1_csv2_frac[] = {
1477 MRS_FIELD_VALUE(ID_AA64PFR1_CSV2_frac_p0, ""),
1478 MRS_FIELD_VALUE(ID_AA64PFR1_CSV2_frac_p1, "CSV2 p1"),
1479 MRS_FIELD_VALUE(ID_AA64PFR1_CSV2_frac_p2, "CSV2 p2"),
1480 MRS_FIELD_VALUE_END,
1483 static const struct mrs_field_value id_aa64pfr1_rndr_trap[] = {
1484 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR1, RNDR_trap, NONE, IMPL),
1485 MRS_FIELD_VALUE_END,
1488 static const struct mrs_field_value id_aa64pfr1_sme[] = {
1489 MRS_FIELD_VALUE(ID_AA64PFR1_SME_NONE, ""),
1490 MRS_FIELD_VALUE(ID_AA64PFR1_SME_SME, "SME"),
1491 MRS_FIELD_VALUE(ID_AA64PFR1_SME_SME2, "SME2"),
1492 MRS_FIELD_VALUE_END,
1495 static const struct mrs_field_value id_aa64pfr1_mpam_frac[] = {
1496 MRS_FIELD_VALUE(ID_AA64PFR1_MPAM_frac_p0, ""),
1497 MRS_FIELD_VALUE(ID_AA64PFR1_MPAM_frac_p1, "MPAM p1"),
1498 MRS_FIELD_VALUE_END,
1501 static const struct mrs_field_value id_aa64pfr1_ras_frac[] = {
1502 MRS_FIELD_VALUE(ID_AA64PFR1_RAS_frac_p0, ""),
1503 MRS_FIELD_VALUE(ID_AA64PFR1_RAS_frac_p1, "RAS p1"),
1504 MRS_FIELD_VALUE_END,
1507 static const struct mrs_field_value id_aa64pfr1_mte[] = {
1508 MRS_FIELD_VALUE(ID_AA64PFR1_MTE_NONE, ""),
1509 MRS_FIELD_VALUE(ID_AA64PFR1_MTE_MTE, "MTE"),
1510 MRS_FIELD_VALUE(ID_AA64PFR1_MTE_MTE2, "MTE2"),
1511 MRS_FIELD_VALUE(ID_AA64PFR1_MTE_MTE3, "MTE3"),
1512 MRS_FIELD_VALUE_END,
1515 static const struct mrs_field_value id_aa64pfr1_ssbs[] = {
1516 MRS_FIELD_VALUE(ID_AA64PFR1_SSBS_NONE, ""),
1517 MRS_FIELD_VALUE(ID_AA64PFR1_SSBS_PSTATE, "PSTATE.SSBS"),
1518 MRS_FIELD_VALUE(ID_AA64PFR1_SSBS_PSTATE_MSR, "PSTATE.SSBS MSR"),
1519 MRS_FIELD_VALUE_END,
1522 static const struct mrs_field_hwcap id_aa64pfr1_ssbs_caps[] = {
1523 MRS_HWCAP(1, HWCAP_SSBS, ID_AA64PFR1_SSBS_PSTATE),
1527 static const struct mrs_field_value id_aa64pfr1_bt[] = {
1528 MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""),
1529 MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"),
1530 MRS_FIELD_VALUE_END,
1534 /* Enable when we add BTI support */
1535 static const struct mrs_field_hwcap id_aa64pfr1_bt_caps[] = {
1536 MRS_HWCAP(2, HWCAP2_BTI, ID_AA64PFR1_BT_IMPL),
1541 static const struct mrs_field id_aa64pfr1_fields[] = {
1542 MRS_FIELD(ID_AA64PFR1, NMI, false, MRS_EXACT, id_aa64pfr1_nmi),
1543 MRS_FIELD(ID_AA64PFR1, CSV2_frac, false, MRS_EXACT,
1544 id_aa64pfr1_csv2_frac),
1545 MRS_FIELD(ID_AA64PFR1, RNDR_trap, false, MRS_EXACT,
1546 id_aa64pfr1_rndr_trap),
1547 MRS_FIELD(ID_AA64PFR1, SME, false, MRS_EXACT, id_aa64pfr1_sme),
1548 MRS_FIELD(ID_AA64PFR1, MPAM_frac, false, MRS_EXACT,
1549 id_aa64pfr1_mpam_frac),
1550 MRS_FIELD(ID_AA64PFR1, RAS_frac, false, MRS_EXACT,
1551 id_aa64pfr1_ras_frac),
1552 MRS_FIELD(ID_AA64PFR1, MTE, false, MRS_EXACT, id_aa64pfr1_mte),
1553 MRS_FIELD_HWCAP(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs,
1554 id_aa64pfr1_ssbs_caps),
1555 MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt),
1561 /* ID_AA64PFR2_EL1 */
1562 static const struct mrs_field id_aa64pfr2_fields[] = {
1568 /* ID_AA64ZFR0_EL1 */
1569 static const struct mrs_field_value id_aa64zfr0_f64mm[] = {
1570 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, F64MM, NONE, IMPL),
1571 MRS_FIELD_VALUE_END,
1574 static const struct mrs_field_value id_aa64zfr0_f32mm[] = {
1575 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, F32MM, NONE, IMPL),
1576 MRS_FIELD_VALUE_END,
1579 static const struct mrs_field_value id_aa64zfr0_i8mm[] = {
1580 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, I8MM, NONE, IMPL),
1581 MRS_FIELD_VALUE_END,
1584 static const struct mrs_field_value id_aa64zfr0_sm4[] = {
1585 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, SM4, NONE, IMPL),
1586 MRS_FIELD_VALUE_END,
1589 static const struct mrs_field_value id_aa64zfr0_sha3[] = {
1590 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, SHA3, NONE, IMPL),
1591 MRS_FIELD_VALUE_END,
1594 static const struct mrs_field_value id_aa64zfr0_bf16[] = {
1595 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, BF16, NONE, BASE),
1596 MRS_FIELD_VALUE(ID_AA64ZFR0_BF16_EBF, "BF16+EBF"),
1597 MRS_FIELD_VALUE_END,
1600 static const struct mrs_field_value id_aa64zfr0_bitperm[] = {
1601 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, BitPerm, NONE, IMPL),
1602 MRS_FIELD_VALUE_END,
1605 static const struct mrs_field_value id_aa64zfr0_aes[] = {
1606 MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ZFR0, AES, NONE, BASE),
1607 MRS_FIELD_VALUE(ID_AA64ZFR0_AES_PMULL, "AES+PMULL"),
1608 MRS_FIELD_VALUE_END,
1611 static const struct mrs_field_value id_aa64zfr0_svever[] = {
1612 MRS_FIELD_VALUE(ID_AA64ZFR0_SVEver_SVE1, "SVE1"),
1613 MRS_FIELD_VALUE(ID_AA64ZFR0_SVEver_SVE2, "SVE2"),
1614 MRS_FIELD_VALUE_END,
1617 static const struct mrs_field id_aa64zfr0_fields[] = {
1618 MRS_FIELD(ID_AA64ZFR0, F64MM, false, MRS_EXACT, id_aa64zfr0_f64mm),
1619 MRS_FIELD(ID_AA64ZFR0, F32MM, false, MRS_EXACT, id_aa64zfr0_f32mm),
1620 MRS_FIELD(ID_AA64ZFR0, I8MM, false, MRS_EXACT, id_aa64zfr0_i8mm),
1621 MRS_FIELD(ID_AA64ZFR0, SM4, false, MRS_EXACT, id_aa64zfr0_sm4),
1622 MRS_FIELD(ID_AA64ZFR0, SHA3, false, MRS_EXACT, id_aa64zfr0_sha3),
1623 MRS_FIELD(ID_AA64ZFR0, BF16, false, MRS_EXACT, id_aa64zfr0_bf16),
1624 MRS_FIELD(ID_AA64ZFR0, BitPerm, false, MRS_EXACT, id_aa64zfr0_bitperm),
1625 MRS_FIELD(ID_AA64ZFR0, AES, false, MRS_EXACT, id_aa64zfr0_aes),
1626 MRS_FIELD(ID_AA64ZFR0, SVEver, false, MRS_EXACT, id_aa64zfr0_svever),
1631 #ifdef COMPAT_FREEBSD32
1633 static const struct mrs_field_value id_isar5_vcma[] = {
1634 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, VCMA, NONE, IMPL),
1635 MRS_FIELD_VALUE_END,
1638 static const struct mrs_field_value id_isar5_rdm[] = {
1639 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, RDM, NONE, IMPL),
1640 MRS_FIELD_VALUE_END,
1643 static const struct mrs_field_value id_isar5_crc32[] = {
1644 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, CRC32, NONE, IMPL),
1645 MRS_FIELD_VALUE_END,
1648 static const struct mrs_field_hwcap id_isar5_crc32_caps[] = {
1649 MRS_HWCAP(2, HWCAP32_2_CRC32, ID_ISAR5_CRC32_IMPL),
1653 static const struct mrs_field_value id_isar5_sha2[] = {
1654 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SHA2, NONE, IMPL),
1655 MRS_FIELD_VALUE_END,
1658 static const struct mrs_field_hwcap id_isar5_sha2_caps[] = {
1659 MRS_HWCAP(2, HWCAP32_2_SHA2, ID_ISAR5_SHA2_IMPL),
1663 static const struct mrs_field_value id_isar5_sha1[] = {
1664 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SHA1, NONE, IMPL),
1665 MRS_FIELD_VALUE_END,
1668 static const struct mrs_field_hwcap id_isar5_sha1_caps[] = {
1669 MRS_HWCAP(2, HWCAP32_2_SHA1, ID_ISAR5_SHA1_IMPL),
1673 static const struct mrs_field_value id_isar5_aes[] = {
1674 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, AES, NONE, BASE),
1675 MRS_FIELD_VALUE(ID_ISAR5_AES_VMULL, "AES+VMULL"),
1676 MRS_FIELD_VALUE_END,
1679 static const struct mrs_field_hwcap id_isar5_aes_caps[] = {
1680 MRS_HWCAP(2, HWCAP32_2_AES, ID_ISAR5_AES_BASE),
1681 MRS_HWCAP(2, HWCAP32_2_PMULL, ID_ISAR5_AES_VMULL),
1685 static const struct mrs_field_value id_isar5_sevl[] = {
1686 MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SEVL, NOP, IMPL),
1687 MRS_FIELD_VALUE_END,
1690 static const struct mrs_field id_isar5_fields[] = {
1691 MRS_FIELD(ID_ISAR5, VCMA, false, MRS_LOWER, id_isar5_vcma),
1692 MRS_FIELD(ID_ISAR5, RDM, false, MRS_LOWER, id_isar5_rdm),
1693 MRS_FIELD_HWCAP(ID_ISAR5, CRC32, false, MRS_LOWER, id_isar5_crc32,
1694 id_isar5_crc32_caps),
1695 MRS_FIELD_HWCAP(ID_ISAR5, SHA2, false, MRS_LOWER, id_isar5_sha2,
1696 id_isar5_sha2_caps),
1697 MRS_FIELD_HWCAP(ID_ISAR5, SHA1, false, MRS_LOWER, id_isar5_sha1,
1698 id_isar5_sha1_caps),
1699 MRS_FIELD_HWCAP(ID_ISAR5, AES, false, MRS_LOWER, id_isar5_aes,
1701 MRS_FIELD(ID_ISAR5, SEVL, false, MRS_LOWER, id_isar5_sevl),
1706 static const struct mrs_field_value mvfr0_fpround[] = {
1707 MRS_FIELD_VALUE_NONE_IMPL(MVFR0, FPRound, NONE, IMPL),
1708 MRS_FIELD_VALUE_END,
1711 static const struct mrs_field_value mvfr0_fpsqrt[] = {
1712 MRS_FIELD_VALUE_NONE_IMPL(MVFR0, FPSqrt, NONE, IMPL),
1713 MRS_FIELD_VALUE_END,
1716 static const struct mrs_field_value mvfr0_fpdivide[] = {
1717 MRS_FIELD_VALUE_NONE_IMPL(MVFR0, FPDivide, NONE, IMPL),
1718 MRS_FIELD_VALUE_END,
1721 static const struct mrs_field_value mvfr0_fptrap[] = {
1722 MRS_FIELD_VALUE_NONE_IMPL(MVFR0, FPTrap, NONE, IMPL),
1723 MRS_FIELD_VALUE_END,
1726 static const struct mrs_field_value mvfr0_fpdp[] = {
1727 MRS_FIELD_VALUE(MVFR0_FPDP_NONE, ""),
1728 MRS_FIELD_VALUE(MVFR0_FPDP_VFP_v2, "DP VFPv2"),
1729 MRS_FIELD_VALUE(MVFR0_FPDP_VFP_v3_v4, "DP VFPv3+v4"),
1730 MRS_FIELD_VALUE_END,
1733 static const struct mrs_field_hwcap mvfr0_fpdp_caps[] = {
1734 MRS_HWCAP(1, HWCAP32_VFP, MVFR0_FPDP_VFP_v2),
1735 MRS_HWCAP(1, HWCAP32_VFPv3, MVFR0_FPDP_VFP_v3_v4),
1739 static const struct mrs_field_value mvfr0_fpsp[] = {
1740 MRS_FIELD_VALUE(MVFR0_FPSP_NONE, ""),
1741 MRS_FIELD_VALUE(MVFR0_FPSP_VFP_v2, "SP VFPv2"),
1742 MRS_FIELD_VALUE(MVFR0_FPSP_VFP_v3_v4, "SP VFPv3+v4"),
1743 MRS_FIELD_VALUE_END,
1746 static const struct mrs_field_value mvfr0_simdreg[] = {
1747 MRS_FIELD_VALUE(MVFR0_SIMDReg_NONE, ""),
1748 MRS_FIELD_VALUE(MVFR0_SIMDReg_FP, "FP 16x64"),
1749 MRS_FIELD_VALUE(MVFR0_SIMDReg_AdvSIMD, "AdvSIMD"),
1750 MRS_FIELD_VALUE_END,
1753 static const struct mrs_field mvfr0_fields[] = {
1754 MRS_FIELD(MVFR0, FPRound, false, MRS_LOWER, mvfr0_fpround),
1755 MRS_FIELD(MVFR0, FPSqrt, false, MRS_LOWER, mvfr0_fpsqrt),
1756 MRS_FIELD(MVFR0, FPDivide, false, MRS_LOWER, mvfr0_fpdivide),
1757 MRS_FIELD(MVFR0, FPTrap, false, MRS_LOWER, mvfr0_fptrap),
1758 MRS_FIELD_HWCAP(MVFR0, FPDP, false, MRS_LOWER, mvfr0_fpdp,
1760 MRS_FIELD(MVFR0, FPSP, false, MRS_LOWER, mvfr0_fpsp),
1761 MRS_FIELD(MVFR0, SIMDReg, false, MRS_LOWER, mvfr0_simdreg),
1766 static const struct mrs_field_value mvfr1_simdfmac[] = {
1767 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, SIMDFMAC, NONE, IMPL),
1768 MRS_FIELD_VALUE_END,
1771 static const struct mrs_field_hwcap mvfr1_simdfmac_caps[] = {
1772 MRS_HWCAP(1, HWCAP32_VFPv4, MVFR1_SIMDFMAC_IMPL),
1776 static const struct mrs_field_value mvfr1_fphp[] = {
1777 MRS_FIELD_VALUE(MVFR1_FPHP_NONE, ""),
1778 MRS_FIELD_VALUE(MVFR1_FPHP_CONV_SP, "FPHP SP Conv"),
1779 MRS_FIELD_VALUE(MVFR1_FPHP_CONV_DP, "FPHP DP Conv"),
1780 MRS_FIELD_VALUE(MVFR1_FPHP_ARITH, "FPHP Arith"),
1781 MRS_FIELD_VALUE_END,
1784 static const struct mrs_field_value mvfr1_simdhp[] = {
1785 MRS_FIELD_VALUE(MVFR1_SIMDHP_NONE, ""),
1786 MRS_FIELD_VALUE(MVFR1_SIMDHP_CONV_SP, "SIMDHP SP Conv"),
1787 MRS_FIELD_VALUE(MVFR1_SIMDHP_ARITH, "SIMDHP Arith"),
1788 MRS_FIELD_VALUE_END,
1791 static const struct mrs_field_value mvfr1_simdsp[] = {
1792 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, SIMDSP, NONE, IMPL),
1793 MRS_FIELD_VALUE_END,
1796 static const struct mrs_field_value mvfr1_simdint[] = {
1797 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, SIMDInt, NONE, IMPL),
1798 MRS_FIELD_VALUE_END,
1801 static const struct mrs_field_value mvfr1_simdls[] = {
1802 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, SIMDLS, NONE, IMPL),
1803 MRS_FIELD_VALUE_END,
1806 static const struct mrs_field_hwcap mvfr1_simdls_caps[] = {
1807 MRS_HWCAP(1, HWCAP32_VFPv4, MVFR1_SIMDFMAC_IMPL),
1811 static const struct mrs_field_value mvfr1_fpdnan[] = {
1812 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, FPDNaN, NONE, IMPL),
1813 MRS_FIELD_VALUE_END,
1816 static const struct mrs_field_value mvfr1_fpftz[] = {
1817 MRS_FIELD_VALUE_NONE_IMPL(MVFR1, FPFtZ, NONE, IMPL),
1818 MRS_FIELD_VALUE_END,
1821 static const struct mrs_field mvfr1_fields[] = {
1822 MRS_FIELD_HWCAP(MVFR1, SIMDFMAC, false, MRS_LOWER, mvfr1_simdfmac,
1823 mvfr1_simdfmac_caps),
1824 MRS_FIELD(MVFR1, FPHP, false, MRS_LOWER, mvfr1_fphp),
1825 MRS_FIELD(MVFR1, SIMDHP, false, MRS_LOWER, mvfr1_simdhp),
1826 MRS_FIELD(MVFR1, SIMDSP, false, MRS_LOWER, mvfr1_simdsp),
1827 MRS_FIELD(MVFR1, SIMDInt, false, MRS_LOWER, mvfr1_simdint),
1828 MRS_FIELD_HWCAP(MVFR1, SIMDLS, false, MRS_LOWER, mvfr1_simdls,
1830 MRS_FIELD(MVFR1, FPDNaN, false, MRS_LOWER, mvfr1_fpdnan),
1831 MRS_FIELD(MVFR1, FPFtZ, false, MRS_LOWER, mvfr1_fpftz),
1834 #endif /* COMPAT_FREEBSD32 */
1836 struct mrs_user_reg {
1842 const struct mrs_field *fields;
1845 #define USER_REG(name, field_name, _is64bit) \
1848 .CRm = name##_CRm, \
1849 .Op2 = name##_op2, \
1850 .offset = __offsetof(struct cpu_desc, field_name), \
1851 .fields = field_name##_fields, \
1852 .is64bit = _is64bit, \
1854 static const struct mrs_user_reg user_regs[] = {
1855 USER_REG(ID_AA64AFR0_EL1, id_aa64afr0, true),
1856 USER_REG(ID_AA64AFR1_EL1, id_aa64afr1, true),
1858 USER_REG(ID_AA64DFR0_EL1, id_aa64dfr0, true),
1859 USER_REG(ID_AA64DFR1_EL1, id_aa64dfr1, true),
1861 USER_REG(ID_AA64ISAR0_EL1, id_aa64isar0, true),
1862 USER_REG(ID_AA64ISAR1_EL1, id_aa64isar1, true),
1863 USER_REG(ID_AA64ISAR2_EL1, id_aa64isar2, true),
1865 USER_REG(ID_AA64MMFR0_EL1, id_aa64mmfr0, true),
1866 USER_REG(ID_AA64MMFR1_EL1, id_aa64mmfr1, true),
1867 USER_REG(ID_AA64MMFR2_EL1, id_aa64mmfr2, true),
1869 USER_REG(ID_AA64MMFR3_EL1, id_aa64mmfr3, true),
1870 USER_REG(ID_AA64MMFR4_EL1, id_aa64mmfr4, true),
1873 USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0, true),
1874 USER_REG(ID_AA64PFR1_EL1, id_aa64pfr1, true),
1876 USER_REG(ID_AA64PFR2_EL1, id_aa64pfr2, true),
1879 USER_REG(ID_AA64ZFR0_EL1, id_aa64zfr0, true),
1881 #ifdef COMPAT_FREEBSD32
1882 USER_REG(ID_ISAR5_EL1, id_isar5, false),
1884 USER_REG(MVFR0_EL1, mvfr0, false),
1885 USER_REG(MVFR1_EL1, mvfr1, false),
1886 #endif /* COMPAT_FREEBSD32 */
1889 #define CPU_DESC_FIELD(desc, idx) \
1890 *(uint64_t *)((char *)&(desc) + user_regs[(idx)].offset)
1893 user_mrs_handler(vm_offset_t va, uint32_t insn, struct trapframe *frame,
1897 int CRm, Op2, i, reg;
1899 if ((insn & MRS_MASK) != MRS_VALUE)
1903 * We only emulate Op0 == 3, Op1 == 0, CRn == 0, CRm == {0, 4-7}.
1904 * These are in the EL1 CPU identification space.
1905 * CRm == 0 holds MIDR_EL1, MPIDR_EL1, and REVID_EL1.
1906 * CRm == {4-7} holds the ID_AA64 registers.
1908 * For full details see the ARMv8 ARM (ARM DDI 0487C.a)
1909 * Table D9-2 System instruction encodings for non-Debug System
1910 * register accesses.
1912 if (mrs_Op0(insn) != 3 || mrs_Op1(insn) != 0 || mrs_CRn(insn) != 0)
1915 CRm = mrs_CRm(insn);
1916 if (CRm > 7 || (CRm < 4 && CRm != 0))
1919 Op2 = mrs_Op2(insn);
1922 for (i = 0; i < nitems(user_regs); i++) {
1923 if (user_regs[i].CRm == CRm && user_regs[i].Op2 == Op2) {
1924 if (SV_CURPROC_ABI() == SV_ABI_FREEBSD)
1925 value = CPU_DESC_FIELD(user_cpu_desc, i);
1927 value = CPU_DESC_FIELD(l_user_cpu_desc, i);
1935 value = READ_SPECIALREG(midr_el1);
1938 value = READ_SPECIALREG(mpidr_el1);
1941 value = READ_SPECIALREG(revidr_el1);
1949 * We will handle this instruction, move to the next so we
1950 * don't trap here again.
1952 frame->tf_elr += INSN_SIZE;
1954 reg = MRS_REGISTER(insn);
1955 /* If reg is 31 then write to xzr, i.e. do nothing */
1959 if (reg < nitems(frame->tf_x))
1960 frame->tf_x[reg] = value;
1962 frame->tf_lr = value;
1968 * Compares two field values that may be signed or unsigned.
1970 * < 0 when a is less than b
1971 * = 0 when a equals b
1972 * > 0 when a is greater than b
1975 mrs_field_cmp(uint64_t a, uint64_t b, u_int shift, int width, bool sign)
1979 KASSERT(width > 0 && width < 64, ("%s: Invalid width %d", __func__,
1982 mask = (1ul << width) - 1;
1983 /* Move the field to the lower bits */
1984 a = (a >> shift) & mask;
1985 b = (b >> shift) & mask;
1989 * The field is signed. Toggle the upper bit so the comparison
1990 * works on unsigned values as this makes positive numbers,
1991 * i.e. those with a 0 bit, larger than negative numbers,
1992 * i.e. those with a 1 bit, in an unsigned comparison.
1994 a ^= 1ul << (width - 1);
1995 b ^= 1ul << (width - 1);
2002 update_lower_register(uint64_t val, uint64_t new_val, u_int shift,
2003 int width, bool sign)
2007 KASSERT(width > 0 && width < 64, ("%s: Invalid width %d", __func__,
2011 * If the new value is less than the existing value update it.
2013 if (mrs_field_cmp(new_val, val, shift, width, sign) < 0) {
2014 mask = (1ul << width) - 1;
2015 val &= ~(mask << shift);
2016 val |= new_val & (mask << shift);
2023 extract_user_id_field(u_int reg, u_int field_shift, uint8_t *val)
2028 for (i = 0; i < nitems(user_regs); i++) {
2029 if (user_regs[i].reg == reg) {
2030 value = CPU_DESC_FIELD(user_cpu_desc, i);
2031 *val = value >> field_shift;
2040 get_kernel_reg(u_int reg, uint64_t *val)
2044 for (i = 0; i < nitems(user_regs); i++) {
2045 if (user_regs[i].reg == reg) {
2046 *val = CPU_DESC_FIELD(kern_cpu_desc, i);
2055 * Fetch the specified register's value, ensuring that individual field values
2056 * do not exceed those in the mask.
2059 get_kernel_reg_masked(u_int reg, uint64_t *valp, uint64_t mask)
2061 const struct mrs_field *fields;
2064 for (int i = 0; i < nitems(user_regs); i++) {
2065 if (user_regs[i].reg == reg) {
2066 val = CPU_DESC_FIELD(kern_cpu_desc, i);
2067 fields = user_regs[i].fields;
2068 for (int j = 0; fields[j].type != 0; j++) {
2069 mask = update_lower_register(mask, val,
2070 fields[j].shift, 4, fields[j].sign);
2081 update_special_reg_field(uint64_t user_reg, u_int type, uint64_t value,
2082 u_int shift, bool sign)
2084 switch (type & MRS_TYPE_MASK) {
2086 user_reg &= ~(0xful << shift);
2087 user_reg |= (uint64_t)MRS_EXACT_FIELD(type) << shift;
2090 user_reg = update_lower_register(user_reg, value, shift, 4,
2094 panic("Invalid field type: %d", type);
2101 update_special_regs(u_int cpu)
2103 struct cpu_desc *desc;
2104 const struct mrs_field *fields;
2105 uint64_t l_user_reg, user_reg, kern_reg, value;
2109 /* Create a user visible cpu description with safe values */
2110 memset(&user_cpu_desc, 0, sizeof(user_cpu_desc));
2111 /* Safe values for these registers */
2112 user_cpu_desc.id_aa64pfr0 = ID_AA64PFR0_AdvSIMD_NONE |
2113 ID_AA64PFR0_FP_NONE | ID_AA64PFR0_EL1_64 |
2115 user_cpu_desc.id_aa64dfr0 = ID_AA64DFR0_DebugVer_8;
2116 /* Create the Linux user visible cpu description */
2117 memcpy(&l_user_cpu_desc, &user_cpu_desc, sizeof(user_cpu_desc));
2120 desc = get_cpu_desc(cpu);
2121 for (i = 0; i < nitems(user_regs); i++) {
2122 value = CPU_DESC_FIELD(*desc, i);
2128 kern_reg = CPU_DESC_FIELD(kern_cpu_desc, i);
2129 user_reg = CPU_DESC_FIELD(user_cpu_desc, i);
2130 l_user_reg = CPU_DESC_FIELD(l_user_cpu_desc, i);
2133 fields = user_regs[i].fields;
2134 for (j = 0; fields[j].type != 0; j++) {
2135 /* Update the FreeBSD userspace ID register view */
2136 user_reg = update_special_reg_field(user_reg,
2137 fields[j].type >> MRS_TYPE_FBSD_SHIFT, value,
2138 fields[j].shift, fields[j].sign);
2140 /* Update the Linux userspace ID register view */
2141 l_user_reg = update_special_reg_field(l_user_reg,
2142 fields[j].type >> MRS_TYPE_LNX_SHIFT, value,
2143 fields[j].shift, fields[j].sign);
2145 /* Update the kernel ID register view */
2146 kern_reg = update_lower_register(kern_reg, value,
2147 fields[j].shift, 4, fields[j].sign);
2150 CPU_DESC_FIELD(kern_cpu_desc, i) = kern_reg;
2151 CPU_DESC_FIELD(user_cpu_desc, i) = user_reg;
2152 CPU_DESC_FIELD(l_user_cpu_desc, i) = l_user_reg;
2163 * Allocate memory for the non-boot CPUs to store their registers.
2164 * As this is indexed by CPU ID we need to allocate space for CPUs
2165 * 1 to mp_maxid. Because of this mp_maxid is already the correct
2166 * number of elements.
2168 cpu_desc = mallocarray(mp_maxid, sizeof(*cpu_desc), M_IDENTCPU,
2173 bool __read_frequently lse_supported = false;
2175 bool __read_frequently icache_aliasing = false;
2176 bool __read_frequently icache_vmid = false;
2178 int64_t dcache_line_size; /* The minimum D cache line size */
2179 int64_t icache_line_size; /* The minimum I cache line size */
2180 int64_t idcache_line_size; /* The minimum cache line size */
2183 * Find the values to export to userspace as AT_HWCAP and AT_HWCAP2.
2186 parse_cpu_features(bool is64bit, struct cpu_desc *cpu_desc, u_long *hwcap,
2189 const struct mrs_field_hwcap *hwcaps;
2190 const struct mrs_field *fields;
2195 for (i = 0; i < nitems(user_regs); i++) {
2196 if (user_regs[i].is64bit != is64bit)
2199 reg = CPU_DESC_FIELD(*cpu_desc, i);
2200 fields = user_regs[i].fields;
2201 for (j = 0; fields[j].type != 0; j++) {
2202 hwcaps = fields[j].hwcaps;
2206 for (k = 0; hwcaps[k].hwcap_id != 0; k++) {
2207 KASSERT(hwcaps[k].hwcap_id == 1 ||
2208 hwcaps[k].hwcap_id == 2,
2209 ("%s: Invalid HWCAP ID %d", __func__,
2210 hwcaps[k].hwcap_id));
2212 cur_hwcap = hwcaps[k].hwcap_id == 1 ?
2214 min = hwcaps[k].min;
2217 * If the field is greater than the minimum
2218 * value we can set the hwcap;
2220 if (mrs_field_cmp(reg, min, fields[j].shift,
2221 4, fields[j].sign) >= 0) {
2222 *cur_hwcap |= hwcaps[k].hwcap_val;
2230 identify_cpu_sysinit(void *dummy __unused)
2232 struct cpu_desc *desc, *prev_desc;
2236 dic = (allow_dic != 0);
2237 idc = (allow_idc != 0);
2241 desc = get_cpu_desc(cpu);
2243 check_cpu_regs(cpu, desc, prev_desc);
2244 update_special_regs(cpu);
2247 if (CTR_DIC_VAL(desc->ctr) == 0)
2249 if (CTR_IDC_VAL(desc->ctr) == 0)
2254 /* Find the values to export to userspace as AT_HWCAP and AT_HWCAP2 */
2255 parse_cpu_features(true, &user_cpu_desc, &elf_hwcap, &elf_hwcap2);
2256 parse_cpu_features(true, &l_user_cpu_desc, &linux_elf_hwcap,
2258 #ifdef COMPAT_FREEBSD32
2259 parse_cpu_features(false, &user_cpu_desc, &elf32_hwcap, &elf32_hwcap2);
2262 /* We export the CPUID registers */
2263 elf_hwcap |= HWCAP_CPUID;
2264 linux_elf_hwcap |= HWCAP_CPUID;
2266 #ifdef COMPAT_FREEBSD32
2267 /* Set the default caps and any that need to check multiple fields */
2268 elf32_hwcap |= parse_cpu_features_hwcap32();
2272 arm64_icache_sync_range = &arm64_dic_idc_icache_sync_range;
2274 printf("Enabling DIC & IDC ICache sync\n");
2276 arm64_icache_sync_range = &arm64_idc_aliasing_icache_sync_range;
2278 printf("Enabling IDC ICache sync\n");
2281 if ((elf_hwcap & HWCAP_ATOMICS) != 0) {
2282 lse_supported = true;
2284 printf("Enabling LSE atomics in the kernel\n");
2288 panic("CPU does not support LSE atomic instructions");
2291 install_undef_handler(true, user_mrs_handler);
2293 SYSINIT(identify_cpu, SI_SUB_CPU, SI_ORDER_MIDDLE, identify_cpu_sysinit, NULL);
2296 cpu_features_sysinit(void *dummy __unused)
2299 struct cpu_desc *desc, *prev_desc;
2304 desc = get_cpu_desc(cpu);
2305 print_cpu_features(cpu, desc, prev_desc);
2309 /* Fill in cpu_model for the hw.model sysctl */
2310 sbuf_new(&sb, cpu_model, sizeof(cpu_model), SBUF_FIXEDLEN);
2311 print_cpu_midr(&sb, 0);
2316 free(cpu_desc, M_IDENTCPU);
2318 /* Log features before APs are released and start printing to the dmesg. */
2319 SYSINIT(cpu_features, SI_SUB_SMP - 1, SI_ORDER_ANY, cpu_features_sysinit, NULL);
2322 tcr_set_e0pd1(void *arg __unused)
2326 tcr = READ_SPECIALREG(tcr_el1);
2328 WRITE_SPECIALREG(tcr_el1, tcr);
2332 /* Enable support for more recent architecture features */
2334 cpu_feat_support(void *arg __unused)
2337 * If FEAT_E0PD is supported use it to cause faults without a page
2338 * table walk if userspace tries to access kernel memory.
2340 if (ID_AA64MMFR2_E0PD_VAL(kern_cpu_desc.id_aa64mmfr2) !=
2341 ID_AA64MMFR2_E0PD_NONE)
2342 smp_rendezvous(NULL, tcr_set_e0pd1, NULL, NULL);
2344 SYSINIT(cpu_feat_support, SI_SUB_SMP, SI_ORDER_ANY, cpu_feat_support, NULL);
2346 #ifdef COMPAT_FREEBSD32
2348 parse_cpu_features_hwcap32(void)
2350 u_long hwcap = HWCAP32_DEFAULT;
2352 if ((MVFR1_SIMDLS_VAL(user_cpu_desc.mvfr1) >=
2353 MVFR1_SIMDLS_IMPL) &&
2354 (MVFR1_SIMDInt_VAL(user_cpu_desc.mvfr1) >=
2355 MVFR1_SIMDInt_IMPL) &&
2356 (MVFR1_SIMDSP_VAL(user_cpu_desc.mvfr1) >=
2358 hwcap |= HWCAP32_NEON;
2362 #endif /* COMPAT_FREEBSD32 */
2365 print_ctr_fields(struct sbuf *sb, uint64_t reg, const void *arg __unused)
2368 sbuf_printf(sb, "%u byte D-cacheline,", CTR_DLINE_SIZE(reg));
2369 sbuf_printf(sb, "%u byte I-cacheline,", CTR_ILINE_SIZE(reg));
2370 reg &= ~(CTR_DLINE_MASK | CTR_ILINE_MASK);
2372 switch(CTR_L1IP_VAL(reg)) {
2373 case CTR_L1IP_VPIPT:
2374 sbuf_printf(sb, "VPIPT");
2376 case CTR_L1IP_AIVIVT:
2377 sbuf_printf(sb, "AIVIVT");
2380 sbuf_printf(sb, "VIPT");
2383 sbuf_printf(sb, "PIPT");
2386 sbuf_printf(sb, " ICache,");
2387 reg &= ~CTR_L1IP_MASK;
2389 sbuf_printf(sb, "%d byte ERG,", CTR_ERG_SIZE(reg));
2390 sbuf_printf(sb, "%d byte CWG", CTR_CWG_SIZE(reg));
2391 reg &= ~(CTR_ERG_MASK | CTR_CWG_MASK);
2393 if (CTR_IDC_VAL(reg) != 0)
2394 sbuf_printf(sb, ",IDC");
2395 if (CTR_DIC_VAL(reg) != 0)
2396 sbuf_printf(sb, ",DIC");
2397 reg &= ~(CTR_IDC_MASK | CTR_DIC_MASK);
2401 sbuf_printf(sb, ",%lx", reg);
2405 print_register(struct sbuf *sb, const char *reg_name, uint64_t reg,
2406 void (*print_fields)(struct sbuf *, uint64_t, const void *),
2410 sbuf_printf(sb, "%29s = <", reg_name);
2412 print_fields(sb, reg, arg);
2415 printf("%s>\n", sbuf_data(sb));
2420 print_id_fields(struct sbuf *sb, uint64_t reg, const void *arg)
2422 const struct mrs_field *fields = arg;
2423 const struct mrs_field_value *fv;
2424 int field, i, j, printed;
2426 #define SEP_STR ((printed++) == 0) ? "" : ","
2428 for (i = 0; fields[i].type != 0; i++) {
2429 fv = fields[i].values;
2431 /* TODO: Handle with an unknown message */
2435 field = (reg & fields[i].mask) >> fields[i].shift;
2436 for (j = 0; fv[j].desc != NULL; j++) {
2437 if ((fv[j].value >> fields[i].shift) != field)
2440 if (fv[j].desc[0] != '\0')
2441 sbuf_printf(sb, "%s%s", SEP_STR, fv[j].desc);
2444 if (fv[j].desc == NULL)
2445 sbuf_printf(sb, "%sUnknown %s(%x)", SEP_STR,
2446 fields[i].name, field);
2448 reg &= ~(0xful << fields[i].shift);
2452 sbuf_printf(sb, "%s%#lx", SEP_STR, reg);
2457 print_id_register(struct sbuf *sb, const char *reg_name, uint64_t reg,
2458 const struct mrs_field *fields)
2461 print_register(sb, reg_name, reg, print_id_fields, fields);
2465 print_cpu_midr(struct sbuf *sb, u_int cpu)
2467 const struct cpu_parts *cpu_partsp;
2468 const char *cpu_impl_name;
2469 const char *cpu_part_name;
2474 midr = pcpu_find(cpu)->pc_midr;
2476 cpu_impl_name = NULL;
2478 impl_id = CPU_IMPL(midr);
2479 for (int i = 0; cpu_implementers[i].impl_name != NULL; i++) {
2480 if (impl_id == cpu_implementers[i].impl_id) {
2481 cpu_impl_name = cpu_implementers[i].impl_name;
2482 cpu_partsp = cpu_implementers[i].cpu_parts;
2486 /* Unknown implementer, so unknown part */
2487 if (cpu_impl_name == NULL) {
2488 sbuf_printf(sb, "Unknown Implementer (midr: %08x)", midr);
2492 KASSERT(cpu_partsp != NULL, ("%s: No parts table for implementer %s",
2493 __func__, cpu_impl_name));
2495 cpu_part_name = NULL;
2496 part_id = CPU_PART(midr);
2497 for (int i = 0; cpu_partsp[i].part_name != NULL; i++) {
2498 if (part_id == cpu_partsp[i].part_id) {
2499 cpu_part_name = cpu_partsp[i].part_name;
2503 /* Known Implementer, Unknown part */
2504 if (cpu_part_name == NULL) {
2505 sbuf_printf(sb, "%s Unknown CPU r%dp%d (midr: %08x)",
2506 cpu_impl_name, CPU_VAR(midr), CPU_REV(midr), midr);
2510 sbuf_printf(sb, "%s %s r%dp%d", cpu_impl_name,
2511 cpu_part_name, CPU_VAR(midr), CPU_REV(midr));
2515 print_cpu_cache(struct cpu_desc *desc, struct sbuf *sb, uint64_t ccs,
2516 bool icache, bool unified)
2521 /* LineSize is Log2(S) - 4. */
2522 line_size = 1 << ((ccs & CCSIDR_LineSize_MASK) + 4);
2524 * Calculate cache size (sets * ways * line size). There are different
2525 * formats depending on the FEAT_CCIDX bit in ID_AA64MMFR2 feature
2528 if ((desc->id_aa64mmfr2 & ID_AA64MMFR2_CCIDX_64))
2529 cache_size = (CCSIDR_NSETS_64(ccs) + 1) *
2530 (CCSIDR_ASSOC_64(ccs) + 1);
2532 cache_size = (CCSIDR_NSETS(ccs) + 1) * (CCSIDR_ASSOC(ccs) + 1);
2534 cache_size *= line_size;
2535 sbuf_printf(sb, "%zuKB (%s)", cache_size / 1024,
2536 icache ? "instruction" : unified ? "unified" : "data");
2540 print_cpu_caches(struct sbuf *sb, struct cpu_desc *desc)
2542 /* Print out each cache combination */
2545 clidr = desc->clidr;
2547 for (i = 0; (clidr & CLIDR_CTYPE_MASK) != 0; i++, clidr >>= 3) {
2549 int ctype_m = (clidr & CLIDR_CTYPE_MASK);
2551 sbuf_printf(sb, " L%d cache: ", i + 1);
2552 if ((clidr & CLIDR_CTYPE_IO)) {
2553 print_cpu_cache(desc, sb, desc->ccsidr[i][j++], true,
2555 /* If there's more, add to the line. */
2556 if ((ctype_m & ~CLIDR_CTYPE_IO) != 0)
2557 sbuf_printf(sb, ", ");
2559 if ((ctype_m & ~CLIDR_CTYPE_IO) != 0) {
2560 print_cpu_cache(desc, sb, desc->ccsidr[i][j], false,
2561 (clidr & CLIDR_CTYPE_UNIFIED));
2563 sbuf_printf(sb, "\n");
2567 printf("%s", sbuf_data(sb));
2571 print_cpu_features(u_int cpu, struct cpu_desc *desc,
2572 struct cpu_desc *prev_desc)
2576 sb = sbuf_new_auto();
2577 sbuf_printf(sb, "CPU%3u: ", cpu);
2578 print_cpu_midr(sb, cpu);
2580 sbuf_cat(sb, " affinity:");
2581 switch(cpu_aff_levels) {
2584 sbuf_printf(sb, " %2d", CPU_AFF3(desc->mpidr));
2587 sbuf_printf(sb, " %2d", CPU_AFF2(desc->mpidr));
2590 sbuf_printf(sb, " %2d", CPU_AFF1(desc->mpidr));
2593 case 0: /* On UP this will be zero */
2594 sbuf_printf(sb, " %2d", CPU_AFF0(desc->mpidr));
2598 printf("%s\n", sbuf_data(sb));
2602 * There is a hardware errata where, if one CPU is performing a TLB
2603 * invalidation while another is performing a store-exclusive the
2604 * store-exclusive may return the wrong status. A workaround seems
2605 * to be to use an IPI to invalidate on each CPU, however given the
2606 * limited number of affected units (pass 1.1 is the evaluation
2607 * hardware revision), and the lack of information from Cavium
2608 * this has not been implemented.
2610 * At the time of writing this the only information is from:
2611 * https://lkml.org/lkml/2016/8/4/722
2614 * XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1 on its own also
2615 * triggers on pass 2.0+.
2617 if (cpu == 0 && CPU_VAR(PCPU_GET(midr)) == 0 &&
2618 CPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1)
2619 printf("WARNING: ThunderX Pass 1.1 detected.\nThis has known "
2620 "hardware bugs that may cause the incorrect operation of "
2621 "atomic operations.\n");
2623 #define SHOULD_PRINT_REG(_reg) \
2624 (prev_desc == NULL || desc->_reg != prev_desc->_reg)
2626 /* Cache Type Register */
2627 if (SHOULD_PRINT_REG(ctr)) {
2628 print_register(sb, "Cache Type",
2629 desc->ctr, print_ctr_fields, NULL);
2632 /* AArch64 Instruction Set Attribute Register 0 */
2633 if (SHOULD_PRINT_REG(id_aa64isar0))
2634 print_id_register(sb, "Instruction Set Attributes 0",
2635 desc->id_aa64isar0, id_aa64isar0_fields);
2637 /* AArch64 Instruction Set Attribute Register 1 */
2638 if (SHOULD_PRINT_REG(id_aa64isar1))
2639 print_id_register(sb, "Instruction Set Attributes 1",
2640 desc->id_aa64isar1, id_aa64isar1_fields);
2642 /* AArch64 Instruction Set Attribute Register 2 */
2643 if (SHOULD_PRINT_REG(id_aa64isar2))
2644 print_id_register(sb, "Instruction Set Attributes 2",
2645 desc->id_aa64isar2, id_aa64isar2_fields);
2647 /* AArch64 Processor Feature Register 0 */
2648 if (SHOULD_PRINT_REG(id_aa64pfr0))
2649 print_id_register(sb, "Processor Features 0",
2650 desc->id_aa64pfr0, id_aa64pfr0_fields);
2652 /* AArch64 Processor Feature Register 1 */
2653 if (SHOULD_PRINT_REG(id_aa64pfr1))
2654 print_id_register(sb, "Processor Features 1",
2655 desc->id_aa64pfr1, id_aa64pfr1_fields);
2658 /* AArch64 Processor Feature Register 2 */
2659 if (SHOULD_PRINT_REG(id_aa64pfr2))
2660 print_id_register(sb, "Processor Features 2",
2661 desc->id_aa64pfr2, id_aa64pfr2_fields);
2664 /* AArch64 Memory Model Feature Register 0 */
2665 if (SHOULD_PRINT_REG(id_aa64mmfr0))
2666 print_id_register(sb, "Memory Model Features 0",
2667 desc->id_aa64mmfr0, id_aa64mmfr0_fields);
2669 /* AArch64 Memory Model Feature Register 1 */
2670 if (SHOULD_PRINT_REG(id_aa64mmfr1))
2671 print_id_register(sb, "Memory Model Features 1",
2672 desc->id_aa64mmfr1, id_aa64mmfr1_fields);
2674 /* AArch64 Memory Model Feature Register 2 */
2675 if (SHOULD_PRINT_REG(id_aa64mmfr2))
2676 print_id_register(sb, "Memory Model Features 2",
2677 desc->id_aa64mmfr2, id_aa64mmfr2_fields);
2680 /* AArch64 Memory Model Feature Register 3 */
2681 if (SHOULD_PRINT_REG(id_aa64mmfr3))
2682 print_id_register(sb, "Memory Model Features 3",
2683 desc->id_aa64mmfr3, id_aa64mmfr3_fields);
2685 /* AArch64 Memory Model Feature Register 4 */
2686 if (SHOULD_PRINT_REG(id_aa64mmfr4))
2687 print_id_register(sb, "Memory Model Features 4",
2688 desc->id_aa64mmfr4, id_aa64mmfr4_fields);
2691 /* AArch64 Debug Feature Register 0 */
2692 if (SHOULD_PRINT_REG(id_aa64dfr0))
2693 print_id_register(sb, "Debug Features 0",
2694 desc->id_aa64dfr0, id_aa64dfr0_fields);
2696 /* AArch64 Memory Model Feature Register 1 */
2697 if (SHOULD_PRINT_REG(id_aa64dfr1))
2698 print_id_register(sb, "Debug Features 1",
2699 desc->id_aa64dfr1, id_aa64dfr1_fields);
2701 /* AArch64 Auxiliary Feature Register 0 */
2702 if (SHOULD_PRINT_REG(id_aa64afr0))
2703 print_id_register(sb, "Auxiliary Features 0",
2704 desc->id_aa64afr0, id_aa64afr0_fields);
2706 /* AArch64 Auxiliary Feature Register 1 */
2707 if (SHOULD_PRINT_REG(id_aa64afr1))
2708 print_id_register(sb, "Auxiliary Features 1",
2709 desc->id_aa64afr1, id_aa64afr1_fields);
2711 /* AArch64 SVE Feature Register 0 */
2712 if (desc->have_sve) {
2713 if (SHOULD_PRINT_REG(id_aa64zfr0) ||
2714 !prev_desc->have_sve) {
2715 print_id_register(sb, "SVE Features 0",
2716 desc->id_aa64zfr0, id_aa64zfr0_fields);
2720 #ifdef COMPAT_FREEBSD32
2721 /* AArch32 Instruction Set Attribute Register 5 */
2722 if (SHOULD_PRINT_REG(id_isar5))
2723 print_id_register(sb, "AArch32 Instruction Set Attributes 5",
2724 desc->id_isar5, id_isar5_fields);
2726 /* AArch32 Media and VFP Feature Register 0 */
2727 if (SHOULD_PRINT_REG(mvfr0))
2728 print_id_register(sb, "AArch32 Media and VFP Features 0",
2729 desc->mvfr0, mvfr0_fields);
2731 /* AArch32 Media and VFP Feature Register 1 */
2732 if (SHOULD_PRINT_REG(mvfr1))
2733 print_id_register(sb, "AArch32 Media and VFP Features 1",
2734 desc->mvfr1, mvfr1_fields);
2737 print_cpu_caches(sb, desc);
2741 #undef SHOULD_PRINT_REG
2746 identify_cache(uint64_t ctr)
2749 /* Identify the L1 cache type */
2750 switch (CTR_L1IP_VAL(ctr)) {
2753 case CTR_L1IP_VPIPT:
2758 icache_aliasing = true;
2762 if (dcache_line_size == 0) {
2763 KASSERT(icache_line_size == 0, ("%s: i-cacheline size set: %ld",
2764 __func__, icache_line_size));
2766 /* Get the D cache line size */
2767 dcache_line_size = CTR_DLINE_SIZE(ctr);
2768 /* And the same for the I cache */
2769 icache_line_size = CTR_ILINE_SIZE(ctr);
2771 idcache_line_size = MIN(dcache_line_size, icache_line_size);
2774 if (dcache_line_size != CTR_DLINE_SIZE(ctr)) {
2775 printf("WARNING: D-cacheline size mismatch %ld != %d\n",
2776 dcache_line_size, CTR_DLINE_SIZE(ctr));
2779 if (icache_line_size != CTR_ILINE_SIZE(ctr)) {
2780 printf("WARNING: I-cacheline size mismatch %ld != %d\n",
2781 icache_line_size, CTR_ILINE_SIZE(ctr));
2786 identify_cpu(u_int cpu)
2788 struct cpu_desc *desc;
2791 desc = get_cpu_desc(cpu);
2792 /* Save affinity for current CPU */
2793 desc->mpidr = get_mpidr();
2794 CPU_AFFINITY(cpu) = desc->mpidr & CPU_AFF_MASK;
2796 desc->ctr = READ_SPECIALREG(ctr_el0);
2797 desc->id_aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1);
2798 desc->id_aa64dfr1 = READ_SPECIALREG(id_aa64dfr1_el1);
2799 desc->id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
2800 desc->id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1);
2801 desc->id_aa64isar2 = READ_SPECIALREG(id_aa64isar2_el1);
2802 desc->id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1);
2803 desc->id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
2804 desc->id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
2806 desc->id_aa64mmfr3 = READ_SPECIALREG(id_aa64mmfr3_el1);
2807 desc->id_aa64mmfr4 = READ_SPECIALREG(id_aa64mmfr4_el1);
2809 desc->id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
2810 desc->id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);
2812 desc->id_aa64pfr2 = READ_SPECIALREG(id_aa64pfr2_el1);
2816 * ID_AA64ZFR0_EL1 is only valid when at least one of:
2817 * - ID_AA64PFR0_EL1.SVE is non-zero
2818 * - ID_AA64PFR1_EL1.SME is non-zero
2819 * In other cases it is zero, but still safe to read
2822 (ID_AA64PFR0_SVE_VAL(desc->id_aa64pfr0) != 0);
2823 desc->id_aa64zfr0 = READ_SPECIALREG(ID_AA64ZFR0_EL1_REG);
2825 desc->clidr = READ_SPECIALREG(clidr_el1);
2827 clidr = desc->clidr;
2829 for (int i = 0; (clidr & CLIDR_CTYPE_MASK) != 0; i++, clidr >>= 3) {
2831 if ((clidr & CLIDR_CTYPE_IO)) {
2832 WRITE_SPECIALREG(csselr_el1,
2833 CSSELR_Level(i) | CSSELR_InD);
2834 desc->ccsidr[i][j++] =
2835 READ_SPECIALREG(ccsidr_el1);
2837 if ((clidr & ~CLIDR_CTYPE_IO) == 0)
2839 WRITE_SPECIALREG(csselr_el1, CSSELR_Level(i));
2840 desc->ccsidr[i][j] = READ_SPECIALREG(ccsidr_el1);
2843 #ifdef COMPAT_FREEBSD32
2844 /* Only read aarch32 SRs if EL0-32 is available */
2845 if (ID_AA64PFR0_EL0_VAL(desc->id_aa64pfr0) == ID_AA64PFR0_EL0_64_32) {
2846 desc->id_isar5 = READ_SPECIALREG(id_isar5_el1);
2847 desc->mvfr0 = READ_SPECIALREG(mvfr0_el1);
2848 desc->mvfr1 = READ_SPECIALREG(mvfr1_el1);
2854 check_cpu_regs(u_int cpu, struct cpu_desc *desc, struct cpu_desc *prev_desc)
2856 switch (cpu_aff_levels) {
2858 if (CPU_AFF0(desc->mpidr) != CPU_AFF0(prev_desc->mpidr))
2862 if (CPU_AFF1(desc->mpidr) != CPU_AFF1(prev_desc->mpidr))
2866 if (CPU_AFF2(desc->mpidr) != CPU_AFF2(prev_desc->mpidr))
2870 if (CPU_AFF3(desc->mpidr) != CPU_AFF3(prev_desc->mpidr))
2875 if (desc->ctr != prev_desc->ctr) {
2877 * If the cache type register is different we may
2878 * have a different l1 cache type.
2880 identify_cache(desc->ctr);