Skip to content

Commit a044ef7

Browse files
danielhbavpatel
authored andcommitted
RISC-V: KVM: use ENOENT in *_one_reg() when extension is unavailable
Following a similar logic as the previous patch let's minimize the EINVAL usage in *_one_reg() APIs by using ENOENT when an extension that implements the reg is not available. For consistency we're also replacing an EOPNOTSUPP instance that should be an ENOENT since it's an "extension is not available" error. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 2a88f38 commit a044ef7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/riscv/kvm/vcpu_onereg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu,
135135
break;
136136
case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
137137
if (!riscv_isa_extension_available(vcpu->arch.isa, ZICBOM))
138-
return -EINVAL;
138+
return -ENOENT;
139139
reg_val = riscv_cbom_block_size;
140140
break;
141141
case KVM_REG_RISCV_CONFIG_REG(zicboz_block_size):
142142
if (!riscv_isa_extension_available(vcpu->arch.isa, ZICBOZ))
143-
return -EINVAL;
143+
return -ENOENT;
144144
reg_val = riscv_cboz_block_size;
145145
break;
146146
case KVM_REG_RISCV_CONFIG_REG(mvendorid):
@@ -459,7 +459,7 @@ static int riscv_vcpu_set_isa_ext_single(struct kvm_vcpu *vcpu,
459459

460460
host_isa_ext = kvm_isa_ext_arr[reg_num];
461461
if (!__riscv_isa_extension_available(NULL, host_isa_ext))
462-
return -EOPNOTSUPP;
462+
return -ENOENT;
463463

464464
if (!vcpu->arch.ran_atleast_once) {
465465
/*

0 commit comments

Comments
 (0)