xref: /linux/tools/testing/selftests/kvm/arm64/get-reg-list.c (revision 0410c6121529409b08e81a77ae3ee58c657e2243)
1*67730e6cSSean Christopherson // SPDX-License-Identifier: GPL-2.0
2*67730e6cSSean Christopherson /*
3*67730e6cSSean Christopherson  * Check for KVM_GET_REG_LIST regressions.
4*67730e6cSSean Christopherson  *
5*67730e6cSSean Christopherson  * Copyright (C) 2020, Red Hat, Inc.
6*67730e6cSSean Christopherson  *
7*67730e6cSSean Christopherson  * While the blessed list should be created from the oldest possible
8*67730e6cSSean Christopherson  * kernel, we can't go older than v5.2, though, because that's the first
9*67730e6cSSean Christopherson  * release which includes df205b5c6328 ("KVM: arm64: Filter out invalid
10*67730e6cSSean Christopherson  * core register IDs in KVM_GET_REG_LIST"). Without that commit the core
11*67730e6cSSean Christopherson  * registers won't match expectations.
12*67730e6cSSean Christopherson  */
13*67730e6cSSean Christopherson #include <stdio.h>
14*67730e6cSSean Christopherson #include "kvm_util.h"
15*67730e6cSSean Christopherson #include "test_util.h"
16*67730e6cSSean Christopherson #include "processor.h"
17*67730e6cSSean Christopherson 
18*67730e6cSSean Christopherson struct feature_id_reg {
19*67730e6cSSean Christopherson 	__u64 reg;
20*67730e6cSSean Christopherson 	__u64 id_reg;
21*67730e6cSSean Christopherson 	__u64 feat_shift;
22*67730e6cSSean Christopherson 	__u64 feat_min;
23*67730e6cSSean Christopherson };
24*67730e6cSSean Christopherson 
25*67730e6cSSean Christopherson static struct feature_id_reg feat_id_regs[] = {
26*67730e6cSSean Christopherson 	{
27*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 2, 0, 3),	/* TCR2_EL1 */
28*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
29*67730e6cSSean Christopherson 		0,
30*67730e6cSSean Christopherson 		1
31*67730e6cSSean Christopherson 	},
32*67730e6cSSean Christopherson 	{
33*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 10, 2, 2),	/* PIRE0_EL1 */
34*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
35*67730e6cSSean Christopherson 		8,
36*67730e6cSSean Christopherson 		1
37*67730e6cSSean Christopherson 	},
38*67730e6cSSean Christopherson 	{
39*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 10, 2, 3),	/* PIR_EL1 */
40*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
41*67730e6cSSean Christopherson 		8,
42*67730e6cSSean Christopherson 		1
43*67730e6cSSean Christopherson 	},
44*67730e6cSSean Christopherson 	{
45*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 10, 2, 4),	/* POR_EL1 */
46*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
47*67730e6cSSean Christopherson 		16,
48*67730e6cSSean Christopherson 		1
49*67730e6cSSean Christopherson 	},
50*67730e6cSSean Christopherson 	{
51*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 3, 10, 2, 4),	/* POR_EL0 */
52*67730e6cSSean Christopherson 		ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
53*67730e6cSSean Christopherson 		16,
54*67730e6cSSean Christopherson 		1
55*67730e6cSSean Christopherson 	}
56*67730e6cSSean Christopherson };
57*67730e6cSSean Christopherson 
58*67730e6cSSean Christopherson bool filter_reg(__u64 reg)
59*67730e6cSSean Christopherson {
60*67730e6cSSean Christopherson 	/*
61*67730e6cSSean Christopherson 	 * DEMUX register presence depends on the host's CLIDR_EL1.
62*67730e6cSSean Christopherson 	 * This means there's no set of them that we can bless.
63*67730e6cSSean Christopherson 	 */
64*67730e6cSSean Christopherson 	if ((reg & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX)
65*67730e6cSSean Christopherson 		return true;
66*67730e6cSSean Christopherson 
67*67730e6cSSean Christopherson 	return false;
68*67730e6cSSean Christopherson }
69*67730e6cSSean Christopherson 
70*67730e6cSSean Christopherson static bool check_supported_feat_reg(struct kvm_vcpu *vcpu, __u64 reg)
71*67730e6cSSean Christopherson {
72*67730e6cSSean Christopherson 	int i, ret;
73*67730e6cSSean Christopherson 	__u64 data, feat_val;
74*67730e6cSSean Christopherson 
75*67730e6cSSean Christopherson 	for (i = 0; i < ARRAY_SIZE(feat_id_regs); i++) {
76*67730e6cSSean Christopherson 		if (feat_id_regs[i].reg == reg) {
77*67730e6cSSean Christopherson 			ret = __vcpu_get_reg(vcpu, feat_id_regs[i].id_reg, &data);
78*67730e6cSSean Christopherson 			if (ret < 0)
79*67730e6cSSean Christopherson 				return false;
80*67730e6cSSean Christopherson 
81*67730e6cSSean Christopherson 			feat_val = ((data >> feat_id_regs[i].feat_shift) & 0xf);
82*67730e6cSSean Christopherson 			return feat_val >= feat_id_regs[i].feat_min;
83*67730e6cSSean Christopherson 		}
84*67730e6cSSean Christopherson 	}
85*67730e6cSSean Christopherson 
86*67730e6cSSean Christopherson 	return true;
87*67730e6cSSean Christopherson }
88*67730e6cSSean Christopherson 
89*67730e6cSSean Christopherson bool check_supported_reg(struct kvm_vcpu *vcpu, __u64 reg)
90*67730e6cSSean Christopherson {
91*67730e6cSSean Christopherson 	return check_supported_feat_reg(vcpu, reg);
92*67730e6cSSean Christopherson }
93*67730e6cSSean Christopherson 
94*67730e6cSSean Christopherson bool check_reject_set(int err)
95*67730e6cSSean Christopherson {
96*67730e6cSSean Christopherson 	return err == EPERM;
97*67730e6cSSean Christopherson }
98*67730e6cSSean Christopherson 
99*67730e6cSSean Christopherson void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_reg_list *c)
100*67730e6cSSean Christopherson {
101*67730e6cSSean Christopherson 	struct vcpu_reg_sublist *s;
102*67730e6cSSean Christopherson 	int feature;
103*67730e6cSSean Christopherson 
104*67730e6cSSean Christopherson 	for_each_sublist(c, s) {
105*67730e6cSSean Christopherson 		if (s->finalize) {
106*67730e6cSSean Christopherson 			feature = s->feature;
107*67730e6cSSean Christopherson 			vcpu_ioctl(vcpu, KVM_ARM_VCPU_FINALIZE, &feature);
108*67730e6cSSean Christopherson 		}
109*67730e6cSSean Christopherson 	}
110*67730e6cSSean Christopherson }
111*67730e6cSSean Christopherson 
112*67730e6cSSean Christopherson #define REG_MASK (KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_COPROC_MASK)
113*67730e6cSSean Christopherson 
114*67730e6cSSean Christopherson #define CORE_REGS_XX_NR_WORDS	2
115*67730e6cSSean Christopherson #define CORE_SPSR_XX_NR_WORDS	2
116*67730e6cSSean Christopherson #define CORE_FPREGS_XX_NR_WORDS	4
117*67730e6cSSean Christopherson 
118*67730e6cSSean Christopherson static const char *core_id_to_str(const char *prefix, __u64 id)
119*67730e6cSSean Christopherson {
120*67730e6cSSean Christopherson 	__u64 core_off = id & ~REG_MASK, idx;
121*67730e6cSSean Christopherson 
122*67730e6cSSean Christopherson 	/*
123*67730e6cSSean Christopherson 	 * core_off is the offset into struct kvm_regs
124*67730e6cSSean Christopherson 	 */
125*67730e6cSSean Christopherson 	switch (core_off) {
126*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
127*67730e6cSSean Christopherson 	     KVM_REG_ARM_CORE_REG(regs.regs[30]):
128*67730e6cSSean Christopherson 		idx = (core_off - KVM_REG_ARM_CORE_REG(regs.regs[0])) / CORE_REGS_XX_NR_WORDS;
129*67730e6cSSean Christopherson 		TEST_ASSERT(idx < 31, "%s: Unexpected regs.regs index: %lld", prefix, idx);
130*67730e6cSSean Christopherson 		return strdup_printf("KVM_REG_ARM_CORE_REG(regs.regs[%lld])", idx);
131*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(regs.sp):
132*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(regs.sp)";
133*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(regs.pc):
134*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(regs.pc)";
135*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(regs.pstate):
136*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(regs.pstate)";
137*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(sp_el1):
138*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(sp_el1)";
139*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(elr_el1):
140*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(elr_el1)";
141*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(spsr[0]) ...
142*67730e6cSSean Christopherson 	     KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
143*67730e6cSSean Christopherson 		idx = (core_off - KVM_REG_ARM_CORE_REG(spsr[0])) / CORE_SPSR_XX_NR_WORDS;
144*67730e6cSSean Christopherson 		TEST_ASSERT(idx < KVM_NR_SPSR, "%s: Unexpected spsr index: %lld", prefix, idx);
145*67730e6cSSean Christopherson 		return strdup_printf("KVM_REG_ARM_CORE_REG(spsr[%lld])", idx);
146*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
147*67730e6cSSean Christopherson 	     KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
148*67730e6cSSean Christopherson 		idx = (core_off - KVM_REG_ARM_CORE_REG(fp_regs.vregs[0])) / CORE_FPREGS_XX_NR_WORDS;
149*67730e6cSSean Christopherson 		TEST_ASSERT(idx < 32, "%s: Unexpected fp_regs.vregs index: %lld", prefix, idx);
150*67730e6cSSean Christopherson 		return strdup_printf("KVM_REG_ARM_CORE_REG(fp_regs.vregs[%lld])", idx);
151*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
152*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(fp_regs.fpsr)";
153*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
154*67730e6cSSean Christopherson 		return "KVM_REG_ARM_CORE_REG(fp_regs.fpcr)";
155*67730e6cSSean Christopherson 	}
156*67730e6cSSean Christopherson 
157*67730e6cSSean Christopherson 	TEST_FAIL("%s: Unknown core reg id: 0x%llx", prefix, id);
158*67730e6cSSean Christopherson 	return NULL;
159*67730e6cSSean Christopherson }
160*67730e6cSSean Christopherson 
161*67730e6cSSean Christopherson static const char *sve_id_to_str(const char *prefix, __u64 id)
162*67730e6cSSean Christopherson {
163*67730e6cSSean Christopherson 	__u64 sve_off, n, i;
164*67730e6cSSean Christopherson 
165*67730e6cSSean Christopherson 	if (id == KVM_REG_ARM64_SVE_VLS)
166*67730e6cSSean Christopherson 		return "KVM_REG_ARM64_SVE_VLS";
167*67730e6cSSean Christopherson 
168*67730e6cSSean Christopherson 	sve_off = id & ~(REG_MASK | ((1ULL << 5) - 1));
169*67730e6cSSean Christopherson 	i = id & (KVM_ARM64_SVE_MAX_SLICES - 1);
170*67730e6cSSean Christopherson 
171*67730e6cSSean Christopherson 	TEST_ASSERT(i == 0, "%s: Currently we don't expect slice > 0, reg id 0x%llx", prefix, id);
172*67730e6cSSean Christopherson 
173*67730e6cSSean Christopherson 	switch (sve_off) {
174*67730e6cSSean Christopherson 	case KVM_REG_ARM64_SVE_ZREG_BASE ...
175*67730e6cSSean Christopherson 	     KVM_REG_ARM64_SVE_ZREG_BASE + (1ULL << 5) * KVM_ARM64_SVE_NUM_ZREGS - 1:
176*67730e6cSSean Christopherson 		n = (id >> 5) & (KVM_ARM64_SVE_NUM_ZREGS - 1);
177*67730e6cSSean Christopherson 		TEST_ASSERT(id == KVM_REG_ARM64_SVE_ZREG(n, 0),
178*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in SVE ZREG id: 0x%llx", prefix, id);
179*67730e6cSSean Christopherson 		return strdup_printf("KVM_REG_ARM64_SVE_ZREG(%lld, 0)", n);
180*67730e6cSSean Christopherson 	case KVM_REG_ARM64_SVE_PREG_BASE ...
181*67730e6cSSean Christopherson 	     KVM_REG_ARM64_SVE_PREG_BASE + (1ULL << 5) * KVM_ARM64_SVE_NUM_PREGS - 1:
182*67730e6cSSean Christopherson 		n = (id >> 5) & (KVM_ARM64_SVE_NUM_PREGS - 1);
183*67730e6cSSean Christopherson 		TEST_ASSERT(id == KVM_REG_ARM64_SVE_PREG(n, 0),
184*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in SVE PREG id: 0x%llx", prefix, id);
185*67730e6cSSean Christopherson 		return strdup_printf("KVM_REG_ARM64_SVE_PREG(%lld, 0)", n);
186*67730e6cSSean Christopherson 	case KVM_REG_ARM64_SVE_FFR_BASE:
187*67730e6cSSean Christopherson 		TEST_ASSERT(id == KVM_REG_ARM64_SVE_FFR(0),
188*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in SVE FFR id: 0x%llx", prefix, id);
189*67730e6cSSean Christopherson 		return "KVM_REG_ARM64_SVE_FFR(0)";
190*67730e6cSSean Christopherson 	}
191*67730e6cSSean Christopherson 
192*67730e6cSSean Christopherson 	return NULL;
193*67730e6cSSean Christopherson }
194*67730e6cSSean Christopherson 
195*67730e6cSSean Christopherson void print_reg(const char *prefix, __u64 id)
196*67730e6cSSean Christopherson {
197*67730e6cSSean Christopherson 	unsigned op0, op1, crn, crm, op2;
198*67730e6cSSean Christopherson 	const char *reg_size = NULL;
199*67730e6cSSean Christopherson 
200*67730e6cSSean Christopherson 	TEST_ASSERT((id & KVM_REG_ARCH_MASK) == KVM_REG_ARM64,
201*67730e6cSSean Christopherson 		    "%s: KVM_REG_ARM64 missing in reg id: 0x%llx", prefix, id);
202*67730e6cSSean Christopherson 
203*67730e6cSSean Christopherson 	switch (id & KVM_REG_SIZE_MASK) {
204*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U8:
205*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U8";
206*67730e6cSSean Christopherson 		break;
207*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U16:
208*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U16";
209*67730e6cSSean Christopherson 		break;
210*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U32:
211*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U32";
212*67730e6cSSean Christopherson 		break;
213*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U64:
214*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U64";
215*67730e6cSSean Christopherson 		break;
216*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U128:
217*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U128";
218*67730e6cSSean Christopherson 		break;
219*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U256:
220*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U256";
221*67730e6cSSean Christopherson 		break;
222*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U512:
223*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U512";
224*67730e6cSSean Christopherson 		break;
225*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U1024:
226*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U1024";
227*67730e6cSSean Christopherson 		break;
228*67730e6cSSean Christopherson 	case KVM_REG_SIZE_U2048:
229*67730e6cSSean Christopherson 		reg_size = "KVM_REG_SIZE_U2048";
230*67730e6cSSean Christopherson 		break;
231*67730e6cSSean Christopherson 	default:
232*67730e6cSSean Christopherson 		TEST_FAIL("%s: Unexpected reg size: 0x%llx in reg id: 0x%llx",
233*67730e6cSSean Christopherson 			  prefix, (id & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT, id);
234*67730e6cSSean Christopherson 	}
235*67730e6cSSean Christopherson 
236*67730e6cSSean Christopherson 	switch (id & KVM_REG_ARM_COPROC_MASK) {
237*67730e6cSSean Christopherson 	case KVM_REG_ARM_CORE:
238*67730e6cSSean Christopherson 		printf("\tKVM_REG_ARM64 | %s | KVM_REG_ARM_CORE | %s,\n", reg_size, core_id_to_str(prefix, id));
239*67730e6cSSean Christopherson 		break;
240*67730e6cSSean Christopherson 	case KVM_REG_ARM_DEMUX:
241*67730e6cSSean Christopherson 		TEST_ASSERT(!(id & ~(REG_MASK | KVM_REG_ARM_DEMUX_ID_MASK | KVM_REG_ARM_DEMUX_VAL_MASK)),
242*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in DEMUX reg id: 0x%llx", prefix, id);
243*67730e6cSSean Christopherson 		printf("\tKVM_REG_ARM64 | %s | KVM_REG_ARM_DEMUX | KVM_REG_ARM_DEMUX_ID_CCSIDR | %lld,\n",
244*67730e6cSSean Christopherson 		       reg_size, id & KVM_REG_ARM_DEMUX_VAL_MASK);
245*67730e6cSSean Christopherson 		break;
246*67730e6cSSean Christopherson 	case KVM_REG_ARM64_SYSREG:
247*67730e6cSSean Christopherson 		op0 = (id & KVM_REG_ARM64_SYSREG_OP0_MASK) >> KVM_REG_ARM64_SYSREG_OP0_SHIFT;
248*67730e6cSSean Christopherson 		op1 = (id & KVM_REG_ARM64_SYSREG_OP1_MASK) >> KVM_REG_ARM64_SYSREG_OP1_SHIFT;
249*67730e6cSSean Christopherson 		crn = (id & KVM_REG_ARM64_SYSREG_CRN_MASK) >> KVM_REG_ARM64_SYSREG_CRN_SHIFT;
250*67730e6cSSean Christopherson 		crm = (id & KVM_REG_ARM64_SYSREG_CRM_MASK) >> KVM_REG_ARM64_SYSREG_CRM_SHIFT;
251*67730e6cSSean Christopherson 		op2 = (id & KVM_REG_ARM64_SYSREG_OP2_MASK) >> KVM_REG_ARM64_SYSREG_OP2_SHIFT;
252*67730e6cSSean Christopherson 		TEST_ASSERT(id == ARM64_SYS_REG(op0, op1, crn, crm, op2),
253*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in SYSREG reg id: 0x%llx", prefix, id);
254*67730e6cSSean Christopherson 		printf("\tARM64_SYS_REG(%d, %d, %d, %d, %d),\n", op0, op1, crn, crm, op2);
255*67730e6cSSean Christopherson 		break;
256*67730e6cSSean Christopherson 	case KVM_REG_ARM_FW:
257*67730e6cSSean Christopherson 		TEST_ASSERT(id == KVM_REG_ARM_FW_REG(id & 0xffff),
258*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in FW reg id: 0x%llx", prefix, id);
259*67730e6cSSean Christopherson 		printf("\tKVM_REG_ARM_FW_REG(%lld),\n", id & 0xffff);
260*67730e6cSSean Christopherson 		break;
261*67730e6cSSean Christopherson 	case KVM_REG_ARM_FW_FEAT_BMAP:
262*67730e6cSSean Christopherson 		TEST_ASSERT(id == KVM_REG_ARM_FW_FEAT_BMAP_REG(id & 0xffff),
263*67730e6cSSean Christopherson 			    "%s: Unexpected bits set in the bitmap feature FW reg id: 0x%llx", prefix, id);
264*67730e6cSSean Christopherson 		printf("\tKVM_REG_ARM_FW_FEAT_BMAP_REG(%lld),\n", id & 0xffff);
265*67730e6cSSean Christopherson 		break;
266*67730e6cSSean Christopherson 	case KVM_REG_ARM64_SVE:
267*67730e6cSSean Christopherson 		printf("\t%s,\n", sve_id_to_str(prefix, id));
268*67730e6cSSean Christopherson 		break;
269*67730e6cSSean Christopherson 	default:
270*67730e6cSSean Christopherson 		TEST_FAIL("%s: Unexpected coproc type: 0x%llx in reg id: 0x%llx",
271*67730e6cSSean Christopherson 			  prefix, (id & KVM_REG_ARM_COPROC_MASK) >> KVM_REG_ARM_COPROC_SHIFT, id);
272*67730e6cSSean Christopherson 	}
273*67730e6cSSean Christopherson }
274*67730e6cSSean Christopherson 
275*67730e6cSSean Christopherson /*
276*67730e6cSSean Christopherson  * The original blessed list was primed with the output of kernel version
277*67730e6cSSean Christopherson  * v4.15 with --core-reg-fixup and then later updated with new registers.
278*67730e6cSSean Christopherson  * (The --core-reg-fixup option and it's fixup function have been removed
279*67730e6cSSean Christopherson  * from the test, as it's unlikely to use this type of test on a kernel
280*67730e6cSSean Christopherson  * older than v5.2.)
281*67730e6cSSean Christopherson  *
282*67730e6cSSean Christopherson  * The blessed list is up to date with kernel version v6.4 (or so we hope)
283*67730e6cSSean Christopherson  */
284*67730e6cSSean Christopherson static __u64 base_regs[] = {
285*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[0]),
286*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[1]),
287*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[2]),
288*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[3]),
289*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[4]),
290*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[5]),
291*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[6]),
292*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[7]),
293*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[8]),
294*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[9]),
295*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[10]),
296*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[11]),
297*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[12]),
298*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[13]),
299*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[14]),
300*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[15]),
301*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[16]),
302*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[17]),
303*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[18]),
304*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[19]),
305*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[20]),
306*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[21]),
307*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[22]),
308*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[23]),
309*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[24]),
310*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[25]),
311*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[26]),
312*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[27]),
313*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[28]),
314*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[29]),
315*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[30]),
316*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.sp),
317*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.pc),
318*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.pstate),
319*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(sp_el1),
320*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(elr_el1),
321*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[0]),
322*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[1]),
323*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[2]),
324*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[3]),
325*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[4]),
326*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.fpsr),
327*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.fpcr),
328*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_REG(0),		/* KVM_REG_ARM_PSCI_VERSION */
329*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_REG(1),		/* KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 */
330*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_REG(2),		/* KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 */
331*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_REG(3),		/* KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 */
332*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_FEAT_BMAP_REG(0),	/* KVM_REG_ARM_STD_BMAP */
333*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_FEAT_BMAP_REG(1),	/* KVM_REG_ARM_STD_HYP_BMAP */
334*67730e6cSSean Christopherson 	KVM_REG_ARM_FW_FEAT_BMAP_REG(2),	/* KVM_REG_ARM_VENDOR_HYP_BMAP */
335*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 3, 1),	/* CNTV_CTL_EL0 */
336*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 3, 2),	/* CNTV_CVAL_EL0 */
337*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 0, 2),
338*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 0, 0),	/* MIDR_EL1 */
339*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 0, 6),	/* REVIDR_EL1 */
340*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 1, 0, 0, 1),	/* CLIDR_EL1 */
341*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 1, 0, 0, 7),	/* AIDR_EL1 */
342*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 0, 0, 1),	/* CTR_EL0 */
343*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 0, 4),
344*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 0, 5),
345*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 0, 6),
346*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 0, 7),
347*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 1, 4),
348*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 1, 5),
349*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 1, 6),
350*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 1, 7),
351*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 0),	/* MDCCINT_EL1 */
352*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 2),	/* MDSCR_EL1 */
353*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 4),
354*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 5),
355*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 6),
356*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 2, 7),
357*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 3, 4),
358*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 3, 5),
359*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 3, 6),
360*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 3, 7),
361*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 4, 4),
362*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 4, 5),
363*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 4, 6),
364*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 4, 7),
365*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 5, 4),
366*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 5, 5),
367*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 5, 6),
368*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 5, 7),
369*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 6, 4),
370*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 6, 5),
371*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 6, 6),
372*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 6, 7),
373*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 7, 4),
374*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 7, 5),
375*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 7, 6),
376*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 7, 7),
377*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 8, 4),
378*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 8, 5),
379*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 8, 6),
380*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 8, 7),
381*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 9, 4),
382*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 9, 5),
383*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 9, 6),
384*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 9, 7),
385*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 10, 4),
386*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 10, 5),
387*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 10, 6),
388*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 10, 7),
389*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 11, 4),
390*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 11, 5),
391*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 11, 6),
392*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 11, 7),
393*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 12, 4),
394*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 12, 5),
395*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 12, 6),
396*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 12, 7),
397*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 13, 4),
398*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 13, 5),
399*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 13, 6),
400*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 13, 7),
401*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 14, 4),
402*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 14, 5),
403*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 14, 6),
404*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 14, 7),
405*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 15, 4),
406*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 15, 5),
407*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 15, 6),
408*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 0, 15, 7),
409*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 0, 1, 1, 4),	/* OSLSR_EL1 */
410*67730e6cSSean Christopherson 	ARM64_SYS_REG(2, 4, 0, 7, 0),	/* DBGVCR32_EL2 */
411*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 0, 5),	/* MPIDR_EL1 */
412*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 0),	/* ID_PFR0_EL1 */
413*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 1),	/* ID_PFR1_EL1 */
414*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 2),	/* ID_DFR0_EL1 */
415*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 3),	/* ID_AFR0_EL1 */
416*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 4),	/* ID_MMFR0_EL1 */
417*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 5),	/* ID_MMFR1_EL1 */
418*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 6),	/* ID_MMFR2_EL1 */
419*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 1, 7),	/* ID_MMFR3_EL1 */
420*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 0),	/* ID_ISAR0_EL1 */
421*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 1),	/* ID_ISAR1_EL1 */
422*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 2),	/* ID_ISAR2_EL1 */
423*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 3),	/* ID_ISAR3_EL1 */
424*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 4),	/* ID_ISAR4_EL1 */
425*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 5),	/* ID_ISAR5_EL1 */
426*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 6),	/* ID_MMFR4_EL1 */
427*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 2, 7),	/* ID_ISAR6_EL1 */
428*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 0),	/* MVFR0_EL1 */
429*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 1),	/* MVFR1_EL1 */
430*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 2),	/* MVFR2_EL1 */
431*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 3),
432*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 4),	/* ID_PFR2_EL1 */
433*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 5),	/* ID_DFR1_EL1 */
434*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 6),	/* ID_MMFR5_EL1 */
435*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 3, 7),
436*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 0),	/* ID_AA64PFR0_EL1 */
437*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 1),	/* ID_AA64PFR1_EL1 */
438*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 2),	/* ID_AA64PFR2_EL1 */
439*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 3),
440*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 4),	/* ID_AA64ZFR0_EL1 */
441*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 5),	/* ID_AA64SMFR0_EL1 */
442*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 6),
443*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 4, 7),
444*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 0),	/* ID_AA64DFR0_EL1 */
445*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 1),	/* ID_AA64DFR1_EL1 */
446*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 2),
447*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 3),
448*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 4),	/* ID_AA64AFR0_EL1 */
449*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 5),	/* ID_AA64AFR1_EL1 */
450*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 6),
451*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 5, 7),
452*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 0),	/* ID_AA64ISAR0_EL1 */
453*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 1),	/* ID_AA64ISAR1_EL1 */
454*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 2),	/* ID_AA64ISAR2_EL1 */
455*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 3),
456*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 4),
457*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 5),
458*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 6),
459*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 6, 7),
460*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 0),	/* ID_AA64MMFR0_EL1 */
461*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 1),	/* ID_AA64MMFR1_EL1 */
462*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 2),	/* ID_AA64MMFR2_EL1 */
463*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 3),	/* ID_AA64MMFR3_EL1 */
464*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 4),	/* ID_AA64MMFR4_EL1 */
465*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 5),
466*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 6),
467*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 0, 7, 7),
468*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 1, 0, 0),	/* SCTLR_EL1 */
469*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 1, 0, 1),	/* ACTLR_EL1 */
470*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 1, 0, 2),	/* CPACR_EL1 */
471*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 0, 0),	/* TTBR0_EL1 */
472*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 0, 1),	/* TTBR1_EL1 */
473*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 0, 2),	/* TCR_EL1 */
474*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 0, 3),	/* TCR2_EL1 */
475*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 5, 1, 0),	/* AFSR0_EL1 */
476*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 5, 1, 1),	/* AFSR1_EL1 */
477*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 5, 2, 0),	/* ESR_EL1 */
478*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 6, 0, 0),	/* FAR_EL1 */
479*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 7, 4, 0),	/* PAR_EL1 */
480*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 10, 2, 0),	/* MAIR_EL1 */
481*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 10, 2, 2),	/* PIRE0_EL1 */
482*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 10, 2, 3),	/* PIR_EL1 */
483*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 10, 2, 4),	/* POR_EL1 */
484*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 10, 3, 0),	/* AMAIR_EL1 */
485*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 12, 0, 0),	/* VBAR_EL1 */
486*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 12, 1, 1),	/* DISR_EL1 */
487*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 13, 0, 1),	/* CONTEXTIDR_EL1 */
488*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 13, 0, 4),	/* TPIDR_EL1 */
489*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 14, 1, 0),	/* CNTKCTL_EL1 */
490*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 2, 0, 0, 0),	/* CSSELR_EL1 */
491*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 10, 2, 4),	/* POR_EL0 */
492*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 13, 0, 2),	/* TPIDR_EL0 */
493*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 13, 0, 3),	/* TPIDRRO_EL0 */
494*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 0, 1),	/* CNTPCT_EL0 */
495*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 2, 1),	/* CNTP_CTL_EL0 */
496*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 2, 2),	/* CNTP_CVAL_EL0 */
497*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 4, 3, 0, 0),	/* DACR32_EL2 */
498*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 4, 5, 0, 1),	/* IFSR32_EL2 */
499*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 4, 5, 3, 0),	/* FPEXC32_EL2 */
500*67730e6cSSean Christopherson };
501*67730e6cSSean Christopherson 
502*67730e6cSSean Christopherson static __u64 pmu_regs[] = {
503*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 9, 14, 1),	/* PMINTENSET_EL1 */
504*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 9, 14, 2),	/* PMINTENCLR_EL1 */
505*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 0),	/* PMCR_EL0 */
506*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 1),	/* PMCNTENSET_EL0 */
507*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 2),	/* PMCNTENCLR_EL0 */
508*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 3),	/* PMOVSCLR_EL0 */
509*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 4),	/* PMSWINC_EL0 */
510*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 12, 5),	/* PMSELR_EL0 */
511*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 13, 0),	/* PMCCNTR_EL0 */
512*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 14, 0),	/* PMUSERENR_EL0 */
513*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 9, 14, 3),	/* PMOVSSET_EL0 */
514*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 0),
515*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 1),
516*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 2),
517*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 3),
518*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 4),
519*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 5),
520*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 6),
521*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 8, 7),
522*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 0),
523*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 1),
524*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 2),
525*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 3),
526*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 4),
527*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 5),
528*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 6),
529*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 9, 7),
530*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 0),
531*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 1),
532*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 2),
533*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 3),
534*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 4),
535*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 5),
536*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 6),
537*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 10, 7),
538*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 0),
539*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 1),
540*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 2),
541*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 3),
542*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 4),
543*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 5),
544*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 11, 6),
545*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 0),
546*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 1),
547*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 2),
548*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 3),
549*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 4),
550*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 5),
551*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 6),
552*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 12, 7),
553*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 0),
554*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 1),
555*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 2),
556*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 3),
557*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 4),
558*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 5),
559*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 6),
560*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 13, 7),
561*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 0),
562*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 1),
563*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 2),
564*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 3),
565*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 4),
566*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 5),
567*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 6),
568*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 14, 7),
569*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 0),
570*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 1),
571*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 2),
572*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 3),
573*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 4),
574*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 5),
575*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 6),
576*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 3, 14, 15, 7),	/* PMCCFILTR_EL0 */
577*67730e6cSSean Christopherson };
578*67730e6cSSean Christopherson 
579*67730e6cSSean Christopherson static __u64 vregs[] = {
580*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]),
581*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[1]),
582*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[2]),
583*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[3]),
584*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[4]),
585*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[5]),
586*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[6]),
587*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[7]),
588*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[8]),
589*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[9]),
590*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[10]),
591*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[11]),
592*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[12]),
593*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[13]),
594*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[14]),
595*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[15]),
596*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[16]),
597*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[17]),
598*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[18]),
599*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[19]),
600*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[20]),
601*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[21]),
602*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[22]),
603*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[23]),
604*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[24]),
605*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[25]),
606*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[26]),
607*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[27]),
608*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[28]),
609*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[29]),
610*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[30]),
611*67730e6cSSean Christopherson 	KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]),
612*67730e6cSSean Christopherson };
613*67730e6cSSean Christopherson 
614*67730e6cSSean Christopherson static __u64 sve_regs[] = {
615*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_VLS,
616*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(0, 0),
617*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(1, 0),
618*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(2, 0),
619*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(3, 0),
620*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(4, 0),
621*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(5, 0),
622*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(6, 0),
623*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(7, 0),
624*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(8, 0),
625*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(9, 0),
626*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(10, 0),
627*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(11, 0),
628*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(12, 0),
629*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(13, 0),
630*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(14, 0),
631*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(15, 0),
632*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(16, 0),
633*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(17, 0),
634*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(18, 0),
635*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(19, 0),
636*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(20, 0),
637*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(21, 0),
638*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(22, 0),
639*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(23, 0),
640*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(24, 0),
641*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(25, 0),
642*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(26, 0),
643*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(27, 0),
644*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(28, 0),
645*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(29, 0),
646*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(30, 0),
647*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_ZREG(31, 0),
648*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(0, 0),
649*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(1, 0),
650*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(2, 0),
651*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(3, 0),
652*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(4, 0),
653*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(5, 0),
654*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(6, 0),
655*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(7, 0),
656*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(8, 0),
657*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(9, 0),
658*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(10, 0),
659*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(11, 0),
660*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(12, 0),
661*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(13, 0),
662*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(14, 0),
663*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_PREG(15, 0),
664*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_FFR(0),
665*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 1, 2, 0),   /* ZCR_EL1 */
666*67730e6cSSean Christopherson };
667*67730e6cSSean Christopherson 
668*67730e6cSSean Christopherson static __u64 sve_rejects_set[] = {
669*67730e6cSSean Christopherson 	KVM_REG_ARM64_SVE_VLS,
670*67730e6cSSean Christopherson };
671*67730e6cSSean Christopherson 
672*67730e6cSSean Christopherson static __u64 pauth_addr_regs[] = {
673*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 1, 0),	/* APIAKEYLO_EL1 */
674*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 1, 1),	/* APIAKEYHI_EL1 */
675*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 1, 2),	/* APIBKEYLO_EL1 */
676*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 1, 3),	/* APIBKEYHI_EL1 */
677*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 2, 0),	/* APDAKEYLO_EL1 */
678*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 2, 1),	/* APDAKEYHI_EL1 */
679*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 2, 2),	/* APDBKEYLO_EL1 */
680*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 2, 3)	/* APDBKEYHI_EL1 */
681*67730e6cSSean Christopherson };
682*67730e6cSSean Christopherson 
683*67730e6cSSean Christopherson static __u64 pauth_generic_regs[] = {
684*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 3, 0),	/* APGAKEYLO_EL1 */
685*67730e6cSSean Christopherson 	ARM64_SYS_REG(3, 0, 2, 3, 1),	/* APGAKEYHI_EL1 */
686*67730e6cSSean Christopherson };
687*67730e6cSSean Christopherson 
688*67730e6cSSean Christopherson #define BASE_SUBLIST \
689*67730e6cSSean Christopherson 	{ "base", .regs = base_regs, .regs_n = ARRAY_SIZE(base_regs), }
690*67730e6cSSean Christopherson #define VREGS_SUBLIST \
691*67730e6cSSean Christopherson 	{ "vregs", .regs = vregs, .regs_n = ARRAY_SIZE(vregs), }
692*67730e6cSSean Christopherson #define PMU_SUBLIST \
693*67730e6cSSean Christopherson 	{ "pmu", .capability = KVM_CAP_ARM_PMU_V3, .feature = KVM_ARM_VCPU_PMU_V3, \
694*67730e6cSSean Christopherson 	  .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
695*67730e6cSSean Christopherson #define SVE_SUBLIST \
696*67730e6cSSean Christopherson 	{ "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE, .finalize = true, \
697*67730e6cSSean Christopherson 	  .regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \
698*67730e6cSSean Christopherson 	  .rejects_set = sve_rejects_set, .rejects_set_n = ARRAY_SIZE(sve_rejects_set), }
699*67730e6cSSean Christopherson #define PAUTH_SUBLIST							\
700*67730e6cSSean Christopherson 	{								\
701*67730e6cSSean Christopherson 		.name 		= "pauth_address",			\
702*67730e6cSSean Christopherson 		.capability	= KVM_CAP_ARM_PTRAUTH_ADDRESS,		\
703*67730e6cSSean Christopherson 		.feature	= KVM_ARM_VCPU_PTRAUTH_ADDRESS,		\
704*67730e6cSSean Christopherson 		.regs		= pauth_addr_regs,			\
705*67730e6cSSean Christopherson 		.regs_n		= ARRAY_SIZE(pauth_addr_regs),		\
706*67730e6cSSean Christopherson 	},								\
707*67730e6cSSean Christopherson 	{								\
708*67730e6cSSean Christopherson 		.name 		= "pauth_generic",			\
709*67730e6cSSean Christopherson 		.capability	= KVM_CAP_ARM_PTRAUTH_GENERIC,		\
710*67730e6cSSean Christopherson 		.feature	= KVM_ARM_VCPU_PTRAUTH_GENERIC,		\
711*67730e6cSSean Christopherson 		.regs		= pauth_generic_regs,			\
712*67730e6cSSean Christopherson 		.regs_n		= ARRAY_SIZE(pauth_generic_regs),	\
713*67730e6cSSean Christopherson 	}
714*67730e6cSSean Christopherson 
715*67730e6cSSean Christopherson static struct vcpu_reg_list vregs_config = {
716*67730e6cSSean Christopherson 	.sublists = {
717*67730e6cSSean Christopherson 	BASE_SUBLIST,
718*67730e6cSSean Christopherson 	VREGS_SUBLIST,
719*67730e6cSSean Christopherson 	{0},
720*67730e6cSSean Christopherson 	},
721*67730e6cSSean Christopherson };
722*67730e6cSSean Christopherson static struct vcpu_reg_list vregs_pmu_config = {
723*67730e6cSSean Christopherson 	.sublists = {
724*67730e6cSSean Christopherson 	BASE_SUBLIST,
725*67730e6cSSean Christopherson 	VREGS_SUBLIST,
726*67730e6cSSean Christopherson 	PMU_SUBLIST,
727*67730e6cSSean Christopherson 	{0},
728*67730e6cSSean Christopherson 	},
729*67730e6cSSean Christopherson };
730*67730e6cSSean Christopherson static struct vcpu_reg_list sve_config = {
731*67730e6cSSean Christopherson 	.sublists = {
732*67730e6cSSean Christopherson 	BASE_SUBLIST,
733*67730e6cSSean Christopherson 	SVE_SUBLIST,
734*67730e6cSSean Christopherson 	{0},
735*67730e6cSSean Christopherson 	},
736*67730e6cSSean Christopherson };
737*67730e6cSSean Christopherson static struct vcpu_reg_list sve_pmu_config = {
738*67730e6cSSean Christopherson 	.sublists = {
739*67730e6cSSean Christopherson 	BASE_SUBLIST,
740*67730e6cSSean Christopherson 	SVE_SUBLIST,
741*67730e6cSSean Christopherson 	PMU_SUBLIST,
742*67730e6cSSean Christopherson 	{0},
743*67730e6cSSean Christopherson 	},
744*67730e6cSSean Christopherson };
745*67730e6cSSean Christopherson static struct vcpu_reg_list pauth_config = {
746*67730e6cSSean Christopherson 	.sublists = {
747*67730e6cSSean Christopherson 	BASE_SUBLIST,
748*67730e6cSSean Christopherson 	VREGS_SUBLIST,
749*67730e6cSSean Christopherson 	PAUTH_SUBLIST,
750*67730e6cSSean Christopherson 	{0},
751*67730e6cSSean Christopherson 	},
752*67730e6cSSean Christopherson };
753*67730e6cSSean Christopherson static struct vcpu_reg_list pauth_pmu_config = {
754*67730e6cSSean Christopherson 	.sublists = {
755*67730e6cSSean Christopherson 	BASE_SUBLIST,
756*67730e6cSSean Christopherson 	VREGS_SUBLIST,
757*67730e6cSSean Christopherson 	PAUTH_SUBLIST,
758*67730e6cSSean Christopherson 	PMU_SUBLIST,
759*67730e6cSSean Christopherson 	{0},
760*67730e6cSSean Christopherson 	},
761*67730e6cSSean Christopherson };
762*67730e6cSSean Christopherson 
763*67730e6cSSean Christopherson struct vcpu_reg_list *vcpu_configs[] = {
764*67730e6cSSean Christopherson 	&vregs_config,
765*67730e6cSSean Christopherson 	&vregs_pmu_config,
766*67730e6cSSean Christopherson 	&sve_config,
767*67730e6cSSean Christopherson 	&sve_pmu_config,
768*67730e6cSSean Christopherson 	&pauth_config,
769*67730e6cSSean Christopherson 	&pauth_pmu_config,
770*67730e6cSSean Christopherson };
771*67730e6cSSean Christopherson int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);
772