[RFC PATCH v2 16/28] KVM: arm64: Make ID registers without id_reg_info writable
Reiji Watanabe
reijiw at google.com
Tue Nov 2 23:25:08 PDT 2021
Make ID registers that don't have id_reg_info writable.
Signed-off-by: Reiji Watanabe <reijiw at google.com>
---
arch/arm64/kvm/sys_regs.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 99dc2d622df2..1b4ffbf539a7 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1836,16 +1836,12 @@ static int __set_id_reg(struct kvm_vcpu *vcpu,
if (err)
return err;
- /* Don't allow to change the reg unless the reg has id_reg_info */
- if (val != read_id_reg(vcpu, rd, raz) && !GET_ID_REG_INFO(encoding))
- return -EINVAL;
-
/* Don't allow to change the reg after the first KVM_RUN. */
- if (vcpu->arch.has_run_once)
+ if ((val != read_id_reg(vcpu, rd, raz)) && vcpu->arch.has_run_once)
return -EINVAL;
if (raz)
- return 0;
+ return (val == 0) ? 0 : -EINVAL;
err = validate_id_reg(vcpu, rd, val);
if (err)
--
2.33.1.1089.g2158813163f-goog
More information about the linux-arm-kernel
mailing list