@@ -1064,7 +1064,12 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,
1064
1064
struct sys_reg_desc const * r , bool raz )
1065
1065
{
1066
1066
u32 id = reg_to_encoding (r );
1067
- u64 val = raz ? 0 : read_sanitised_ftr_reg (id );
1067
+ u64 val ;
1068
+
1069
+ if (raz )
1070
+ return 0 ;
1071
+
1072
+ val = read_sanitised_ftr_reg (id );
1068
1073
1069
1074
switch (id ) {
1070
1075
case SYS_ID_AA64PFR0_EL1 :
@@ -1268,16 +1273,19 @@ static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
1268
1273
return __set_id_reg (vcpu , rd , uaddr , raz );
1269
1274
}
1270
1275
1271
- static int get_raz_id_reg (struct kvm_vcpu * vcpu , const struct sys_reg_desc * rd ,
1276
+ static int set_raz_id_reg (struct kvm_vcpu * vcpu , const struct sys_reg_desc * rd ,
1272
1277
const struct kvm_one_reg * reg , void __user * uaddr )
1273
1278
{
1274
- return __get_id_reg (vcpu , rd , uaddr , true);
1279
+ return __set_id_reg (vcpu , rd , uaddr , true);
1275
1280
}
1276
1281
1277
- static int set_raz_id_reg (struct kvm_vcpu * vcpu , const struct sys_reg_desc * rd ,
1278
- const struct kvm_one_reg * reg , void __user * uaddr )
1282
+ static int get_raz_reg (struct kvm_vcpu * vcpu , const struct sys_reg_desc * rd ,
1283
+ const struct kvm_one_reg * reg , void __user * uaddr )
1279
1284
{
1280
- return __set_id_reg (vcpu , rd , uaddr , true);
1285
+ const u64 id = sys_reg_to_index (rd );
1286
+ const u64 val = 0 ;
1287
+
1288
+ return reg_to_user (uaddr , & val , id );
1281
1289
}
1282
1290
1283
1291
static int set_wi_reg (struct kvm_vcpu * vcpu , const struct sys_reg_desc * rd ,
@@ -1388,7 +1396,7 @@ static unsigned int mte_visibility(const struct kvm_vcpu *vcpu,
1388
1396
#define ID_UNALLOCATED (crm , op2 ) { \
1389
1397
Op0(3), Op1(0), CRn(0), CRm(crm), Op2(op2), \
1390
1398
.access = access_raz_id_reg, \
1391
- .get_user = get_raz_id_reg , \
1399
+ .get_user = get_raz_reg , \
1392
1400
.set_user = set_raz_id_reg, \
1393
1401
}
1394
1402
@@ -1400,7 +1408,7 @@ static unsigned int mte_visibility(const struct kvm_vcpu *vcpu,
1400
1408
#define ID_HIDDEN (name ) { \
1401
1409
SYS_DESC(SYS_##name), \
1402
1410
.access = access_raz_id_reg, \
1403
- .get_user = get_raz_id_reg , \
1411
+ .get_user = get_raz_reg , \
1404
1412
.set_user = set_raz_id_reg, \
1405
1413
}
1406
1414
@@ -1642,7 +1650,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
1642
1650
* previously (and pointlessly) advertised in the past...
1643
1651
*/
1644
1652
{ PMU_SYS_REG (SYS_PMSWINC_EL0 ),
1645
- .get_user = get_raz_id_reg , .set_user = set_wi_reg ,
1653
+ .get_user = get_raz_reg , .set_user = set_wi_reg ,
1646
1654
.access = access_pmswinc , .reset = NULL },
1647
1655
{ PMU_SYS_REG (SYS_PMSELR_EL0 ),
1648
1656
.access = access_pmselr , .reset = reset_pmselr , .reg = PMSELR_EL0 },
0 commit comments