Skip to content

Commit cdd5036

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: Drop raz parameter from read_id_reg()
There is no longer a need for caller-specified RAZ visibility. Hoist the call to sysreg_visible_as_raz() into read_id_reg() and drop the parameter. No functional change intended. Suggested-by: Reiji Watanabe <[email protected]> Signed-off-by: Oliver Upton <[email protected]> Reviewed-by: Reiji Watanabe <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4782ccc commit cdd5036

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,13 +1063,12 @@ static bool access_arch_timer(struct kvm_vcpu *vcpu,
10631063
}
10641064

10651065
/* Read a sanitised cpufeature ID register by sys_reg_desc */
1066-
static u64 read_id_reg(const struct kvm_vcpu *vcpu,
1067-
struct sys_reg_desc const *r, bool raz)
1066+
static u64 read_id_reg(const struct kvm_vcpu *vcpu, struct sys_reg_desc const *r)
10681067
{
10691068
u32 id = reg_to_encoding(r);
10701069
u64 val;
10711070

1072-
if (raz)
1071+
if (sysreg_visible_as_raz(vcpu, r))
10731072
return 0;
10741073

10751074
val = read_sanitised_ftr_reg(id);
@@ -1157,12 +1156,10 @@ static bool access_id_reg(struct kvm_vcpu *vcpu,
11571156
struct sys_reg_params *p,
11581157
const struct sys_reg_desc *r)
11591158
{
1160-
bool raz = sysreg_visible_as_raz(vcpu, r);
1161-
11621159
if (p->is_write)
11631160
return write_to_read_only(vcpu, p, r);
11641161

1165-
p->regval = read_id_reg(vcpu, r, raz);
1162+
p->regval = read_id_reg(vcpu, r);
11661163
return true;
11671164
}
11681165

@@ -1199,7 +1196,7 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
11991196
return -EINVAL;
12001197

12011198
/* We can only differ with CSV[23], and anything else is an error */
1202-
val ^= read_id_reg(vcpu, rd, false);
1199+
val ^= read_id_reg(vcpu, rd);
12031200
val &= ~((0xFUL << ID_AA64PFR0_CSV2_SHIFT) |
12041201
(0xFUL << ID_AA64PFR0_CSV3_SHIFT));
12051202
if (val)
@@ -1221,19 +1218,15 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
12211218
static int get_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
12221219
u64 *val)
12231220
{
1224-
bool raz = sysreg_visible_as_raz(vcpu, rd);
1225-
1226-
*val = read_id_reg(vcpu, rd, raz);
1221+
*val = read_id_reg(vcpu, rd);
12271222
return 0;
12281223
}
12291224

12301225
static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
12311226
u64 val)
12321227
{
1233-
bool raz = sysreg_visible_as_raz(vcpu, rd);
1234-
12351228
/* This is what we mean by invariant: you can't change it. */
1236-
if (val != read_id_reg(vcpu, rd, raz))
1229+
if (val != read_id_reg(vcpu, rd))
12371230
return -EINVAL;
12381231

12391232
return 0;

0 commit comments

Comments
 (0)