Commit 0746096f authored by Marc Zyngier's avatar Marc Zyngier

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: default avatarOliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240904082419.1982402-4-maz@kernel.orgSigned-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 84ed4545
...@@ -2084,17 +2084,6 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu, ...@@ -2084,17 +2084,6 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
#define EL2_REG_VNCR(name, rst, v) EL2_REG(name, bad_vncr_trap, rst, v) #define EL2_REG_VNCR(name, rst, v) EL2_REG(name, bad_vncr_trap, rst, v)
#define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v) #define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v)
/*
* EL{0,1}2 registers are the EL2 view on an EL0 or EL1 register when
* HCR_EL2.E2H==1, and only in the sysreg table for convenience of
* handling traps. Given that, they are always hidden from userspace.
*/
static unsigned int hidden_user_visibility(const struct kvm_vcpu *vcpu,
const struct sys_reg_desc *rd)
{
return REG_HIDDEN_USER;
}
/* /*
* Since reset() callback and field val are not used for idregs, they will be * Since reset() callback and field val are not used for idregs, they will be
* used for specific purposes for idregs. * 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, ...@@ -4273,7 +4262,7 @@ int kvm_sys_reg_get_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
int ret; int ret;
r = id_to_sys_reg_desc(vcpu, reg->id, table, num); r = id_to_sys_reg_desc(vcpu, reg->id, table, num);
if (!r || sysreg_hidden_user(vcpu, r)) if (!r || sysreg_hidden(vcpu, r))
return -ENOENT; return -ENOENT;
if (r->get_user) { if (r->get_user) {
...@@ -4317,7 +4306,7 @@ int kvm_sys_reg_set_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg, ...@@ -4317,7 +4306,7 @@ int kvm_sys_reg_set_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
return -EFAULT; return -EFAULT;
r = id_to_sys_reg_desc(vcpu, reg->id, table, num); r = id_to_sys_reg_desc(vcpu, reg->id, table, num);
if (!r || sysreg_hidden_user(vcpu, r)) if (!r || sysreg_hidden(vcpu, r))
return -ENOENT; return -ENOENT;
if (sysreg_user_write_ignore(vcpu, r)) if (sysreg_user_write_ignore(vcpu, r))
...@@ -4403,7 +4392,7 @@ static int walk_one_sys_reg(const struct kvm_vcpu *vcpu, ...@@ -4403,7 +4392,7 @@ static int walk_one_sys_reg(const struct kvm_vcpu *vcpu,
if (!(rd->reg || rd->get_user)) if (!(rd->reg || rd->get_user))
return 0; return 0;
if (sysreg_hidden_user(vcpu, rd)) if (sysreg_hidden(vcpu, rd))
return 0; return 0;
if (!copy_reg_to_user(rd, uind)) if (!copy_reg_to_user(rd, uind))
......
...@@ -95,9 +95,8 @@ struct sys_reg_desc { ...@@ -95,9 +95,8 @@ struct sys_reg_desc {
}; };
#define REG_HIDDEN (1 << 0) /* hidden from userspace and guest */ #define REG_HIDDEN (1 << 0) /* hidden from userspace and guest */
#define REG_HIDDEN_USER (1 << 1) /* hidden from userspace only */ #define REG_RAZ (1 << 1) /* RAZ from userspace and guest */
#define REG_RAZ (1 << 2) /* RAZ from userspace and guest */ #define REG_USER_WI (1 << 2) /* WI from userspace only */
#define REG_USER_WI (1 << 3) /* WI from userspace only */
static __printf(2, 3) static __printf(2, 3)
inline void print_sys_reg_msg(const struct sys_reg_params *p, 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, ...@@ -165,15 +164,6 @@ static inline bool sysreg_hidden(const struct kvm_vcpu *vcpu,
return sysreg_visibility(vcpu, r) & REG_HIDDEN; return sysreg_visibility(vcpu, r) & REG_HIDDEN;
} }
static inline bool sysreg_hidden_user(const struct kvm_vcpu *vcpu,
const struct sys_reg_desc *r)
{
if (likely(!r->visibility))
return false;
return r->visibility(vcpu, r) & (REG_HIDDEN | REG_HIDDEN_USER);
}
static inline bool sysreg_visible_as_raz(const struct kvm_vcpu *vcpu, static inline bool sysreg_visible_as_raz(const struct kvm_vcpu *vcpu,
const struct sys_reg_desc *r) const struct sys_reg_desc *r)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment