@@ -2281,15 +2281,6 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
2281
2281
"trap of EL2 register redirected to EL1" );
2282
2282
}
2283
2283
2284
- #define EL2_REG (name , acc , rst , v ) { \
2285
- SYS_DESC(SYS_##name), \
2286
- .access = acc, \
2287
- .reset = rst, \
2288
- .reg = name, \
2289
- .visibility = el2_visibility, \
2290
- .val = v, \
2291
- }
2292
-
2293
2284
#define EL2_REG_FILTERED (name , acc , rst , v , filter ) { \
2294
2285
SYS_DESC(SYS_##name), \
2295
2286
.access = acc, \
@@ -2299,6 +2290,9 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
2299
2290
.val = v, \
2300
2291
}
2301
2292
2293
+ #define EL2_REG (name , acc , rst , v ) \
2294
+ EL2_REG_FILTERED(name, acc, rst, v, el2_visibility)
2295
+
2302
2296
#define EL2_REG_VNCR (name , rst , v ) EL2_REG(name, bad_vncr_trap, rst, v)
2303
2297
#define EL2_REG_REDIR (name , rst , v ) EL2_REG(name, bad_redir_trap, rst, v)
2304
2298
@@ -2446,6 +2440,16 @@ static unsigned int sve_el2_visibility(const struct kvm_vcpu *vcpu,
2446
2440
return __el2_visibility (vcpu , rd , sve_visibility );
2447
2441
}
2448
2442
2443
+ static unsigned int vncr_el2_visibility (const struct kvm_vcpu * vcpu ,
2444
+ const struct sys_reg_desc * rd )
2445
+ {
2446
+ if (el2_visibility (vcpu , rd ) == 0 &&
2447
+ kvm_has_feat (vcpu -> kvm , ID_AA64MMFR4_EL1 , NV_frac , NV2_ONLY ))
2448
+ return 0 ;
2449
+
2450
+ return REG_HIDDEN ;
2451
+ }
2452
+
2449
2453
static bool access_zcr_el2 (struct kvm_vcpu * vcpu ,
2450
2454
struct sys_reg_params * p ,
2451
2455
const struct sys_reg_desc * r )
@@ -3263,6 +3267,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
3263
3267
tcr2_el2_visibility ),
3264
3268
EL2_REG_VNCR (VTTBR_EL2 , reset_val , 0 ),
3265
3269
EL2_REG_VNCR (VTCR_EL2 , reset_val , 0 ),
3270
+ EL2_REG_FILTERED (VNCR_EL2 , bad_vncr_trap , reset_val , 0 ,
3271
+ vncr_el2_visibility ),
3266
3272
3267
3273
{ SYS_DESC (SYS_DACR32_EL2 ), undef_access , reset_unknown , DACR32_EL2 },
3268
3274
EL2_REG_VNCR (HDFGRTR_EL2 , reset_val , 0 ),
0 commit comments