Skip to content

Commit 0746096

Browse files
author
Marc Zyngier
committed
KVM: arm64: Get rid of REG_HIDDEN_USER visibility qualifier
Now that REG_HIDDEN_USER has no direct user anymore, remove it entirely and update all users of sysreg_hidden_user() to call sysreg_hidden() instead. Reviewed-by: Oliver Upton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 84ed454 commit 0746096

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,17 +2084,6 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
20842084
#define EL2_REG_VNCR(name, rst, v) EL2_REG(name, bad_vncr_trap, rst, v)
20852085
#define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v)
20862086

2087-
/*
2088-
* EL{0,1}2 registers are the EL2 view on an EL0 or EL1 register when
2089-
* HCR_EL2.E2H==1, and only in the sysreg table for convenience of
2090-
* handling traps. Given that, they are always hidden from userspace.
2091-
*/
2092-
static unsigned int hidden_user_visibility(const struct kvm_vcpu *vcpu,
2093-
const struct sys_reg_desc *rd)
2094-
{
2095-
return REG_HIDDEN_USER;
2096-
}
2097-
20982087
/*
20992088
* Since reset() callback and field val are not used for idregs, they will be
21002089
* used for specific purposes for idregs.
@@ -4273,7 +4262,7 @@ int kvm_sys_reg_get_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
42734262
int ret;
42744263

42754264
r = id_to_sys_reg_desc(vcpu, reg->id, table, num);
4276-
if (!r || sysreg_hidden_user(vcpu, r))
4265+
if (!r || sysreg_hidden(vcpu, r))
42774266
return -ENOENT;
42784267

42794268
if (r->get_user) {
@@ -4317,7 +4306,7 @@ int kvm_sys_reg_set_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
43174306
return -EFAULT;
43184307

43194308
r = id_to_sys_reg_desc(vcpu, reg->id, table, num);
4320-
if (!r || sysreg_hidden_user(vcpu, r))
4309+
if (!r || sysreg_hidden(vcpu, r))
43214310
return -ENOENT;
43224311

43234312
if (sysreg_user_write_ignore(vcpu, r))
@@ -4403,7 +4392,7 @@ static int walk_one_sys_reg(const struct kvm_vcpu *vcpu,
44034392
if (!(rd->reg || rd->get_user))
44044393
return 0;
44054394

4406-
if (sysreg_hidden_user(vcpu, rd))
4395+
if (sysreg_hidden(vcpu, rd))
44074396
return 0;
44084397

44094398
if (!copy_reg_to_user(rd, uind))

arch/arm64/kvm/sys_regs.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ struct sys_reg_desc {
9595
};
9696

9797
#define REG_HIDDEN (1 << 0) /* hidden from userspace and guest */
98-
#define REG_HIDDEN_USER (1 << 1) /* hidden from userspace only */
99-
#define REG_RAZ (1 << 2) /* RAZ from userspace and guest */
100-
#define REG_USER_WI (1 << 3) /* WI from userspace only */
98+
#define REG_RAZ (1 << 1) /* RAZ from userspace and guest */
99+
#define REG_USER_WI (1 << 2) /* WI from userspace only */
101100

102101
static __printf(2, 3)
103102
inline void print_sys_reg_msg(const struct sys_reg_params *p,
@@ -165,15 +164,6 @@ static inline bool sysreg_hidden(const struct kvm_vcpu *vcpu,
165164
return sysreg_visibility(vcpu, r) & REG_HIDDEN;
166165
}
167166

168-
static inline bool sysreg_hidden_user(const struct kvm_vcpu *vcpu,
169-
const struct sys_reg_desc *r)
170-
{
171-
if (likely(!r->visibility))
172-
return false;
173-
174-
return r->visibility(vcpu, r) & (REG_HIDDEN | REG_HIDDEN_USER);
175-
}
176-
177167
static inline bool sysreg_visible_as_raz(const struct kvm_vcpu *vcpu,
178168
const struct sys_reg_desc *r)
179169
{

0 commit comments

Comments
 (0)