Skip to content

Commit 4782ccc

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: Remove internal accessor helpers for id regs
The internal accessors are only ever called once. Dump out their contents in the caller. No functional change intended. 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 34b4d20 commit 4782ccc

File tree

1 file changed

+12
-34
lines changed

1 file changed

+12
-34
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,25 +1153,17 @@ static unsigned int raz_visibility(const struct kvm_vcpu *vcpu,
11531153

11541154
/* cpufeature ID register access trap handlers */
11551155

1156-
static bool __access_id_reg(struct kvm_vcpu *vcpu,
1157-
struct sys_reg_params *p,
1158-
const struct sys_reg_desc *r,
1159-
bool raz)
1160-
{
1161-
if (p->is_write)
1162-
return write_to_read_only(vcpu, p, r);
1163-
1164-
p->regval = read_id_reg(vcpu, r, raz);
1165-
return true;
1166-
}
1167-
11681156
static bool access_id_reg(struct kvm_vcpu *vcpu,
11691157
struct sys_reg_params *p,
11701158
const struct sys_reg_desc *r)
11711159
{
11721160
bool raz = sysreg_visible_as_raz(vcpu, r);
11731161

1174-
return __access_id_reg(vcpu, p, r, raz);
1162+
if (p->is_write)
1163+
return write_to_read_only(vcpu, p, r);
1164+
1165+
p->regval = read_id_reg(vcpu, r, raz);
1166+
return true;
11751167
}
11761168

11771169
/* Visibility overrides for SVE-specific control registers */
@@ -1226,39 +1218,25 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
12261218
* are stored, and for set_id_reg() we don't allow the effective value
12271219
* to be changed.
12281220
*/
1229-
static int __get_id_reg(const struct kvm_vcpu *vcpu,
1230-
const struct sys_reg_desc *rd, u64 *val,
1231-
bool raz)
1232-
{
1233-
*val = read_id_reg(vcpu, rd, raz);
1234-
return 0;
1235-
}
1236-
1237-
static int __set_id_reg(const struct kvm_vcpu *vcpu,
1238-
const struct sys_reg_desc *rd, u64 val,
1239-
bool raz)
1240-
{
1241-
/* This is what we mean by invariant: you can't change it. */
1242-
if (val != read_id_reg(vcpu, rd, raz))
1243-
return -EINVAL;
1244-
1245-
return 0;
1246-
}
1247-
12481221
static int get_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
12491222
u64 *val)
12501223
{
12511224
bool raz = sysreg_visible_as_raz(vcpu, rd);
12521225

1253-
return __get_id_reg(vcpu, rd, val, raz);
1226+
*val = read_id_reg(vcpu, rd, raz);
1227+
return 0;
12541228
}
12551229

12561230
static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
12571231
u64 val)
12581232
{
12591233
bool raz = sysreg_visible_as_raz(vcpu, rd);
12601234

1261-
return __set_id_reg(vcpu, rd, val, raz);
1235+
/* This is what we mean by invariant: you can't change it. */
1236+
if (val != read_id_reg(vcpu, rd, raz))
1237+
return -EINVAL;
1238+
1239+
return 0;
12621240
}
12631241

12641242
static int get_raz_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,

0 commit comments

Comments
 (0)