Skip to content

Commit 1099c80

Browse files
danielhbavpatel
authored andcommitted
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 <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Signed-off-by: Anup Patel <[email protected]>
1 parent 63bd660 commit 1099c80

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/riscv/kvm/vcpu_onereg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ static int riscv_vcpu_set_isa_ext_single(struct kvm_vcpu *vcpu,
482482
if (!__riscv_isa_extension_available(NULL, host_isa_ext))
483483
return -ENOENT;
484484

485+
if (reg_val == test_bit(host_isa_ext, vcpu->arch.isa))
486+
return 0;
487+
485488
if (!vcpu->arch.ran_atleast_once) {
486489
/*
487490
* All multi-letter extension and a few single letter

0 commit comments

Comments
 (0)