From: Daniel Henrique Barboza Date: Thu, 3 Aug 2023 16:33:00 +0000 (-0300) Subject: RISC-V: KVM: avoid EBUSY when writing the same isa_ext val X-Git-Tag: v6.6-rc1~36^2~5^2~16 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1099c80906d358db542c64aba370291ae4b932b7;p=linux-2.6-block.git RISC-V: KVM: avoid EBUSY when writing the same isa_ext val riscv_vcpu_set_isa_ext_single() will prevent any write of isa_ext regs if the vcpu already started spinning. But if there's no extension state (enabled/disabled) made by the userspace, there's no need to -EBUSY out - we can treat the operation as a no-op. zicbom/zicboz_block_size, ISA config reg and mvendorid/march/mimpid already works in a more permissive manner w.r.t userspace writes being a no-op, so let's do the same with isa_ext writes. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Signed-off-by: Anup Patel --- diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 81cb6b2784db..989ea32dbcbe 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -482,6 +482,9 @@ static int riscv_vcpu_set_isa_ext_single(struct kvm_vcpu *vcpu, if (!__riscv_isa_extension_available(NULL, host_isa_ext)) return -ENOENT; + if (reg_val == test_bit(host_isa_ext, vcpu->arch.isa)) + return 0; + if (!vcpu->arch.ran_atleast_once) { /* * All multi-letter extension and a few single letter