Skip to content

Commit 24433b2

Browse files
committed
RISC-V: KVM: Fix error code returned for Ssaia ONE_REG
Return -ENOENT for Ssaia ONE_REG when Ssaia is not enabled for a VCPU. This will make Ssaia ONE_REG error codes consistent with other ONE_REG interfaces of KVM RISC-V. Fixes: 2a88f38 ("RISC-V: KVM: return ENOENT in *_one_reg() when reg is unknown") Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260120080013.2153519-3-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 45700a7 commit 24433b2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/riscv/kvm/aia.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ int kvm_riscv_vcpu_aia_get_csr(struct kvm_vcpu *vcpu,
185185
struct kvm_vcpu_aia_csr *csr = &vcpu->arch.aia_context.guest_csr;
186186
unsigned long regs_max = sizeof(struct kvm_riscv_aia_csr) / sizeof(unsigned long);
187187

188+
if (!riscv_isa_extension_available(vcpu->arch.isa, SSAIA))
189+
return -ENOENT;
188190
if (reg_num >= regs_max)
189191
return -ENOENT;
190192

@@ -204,6 +206,8 @@ int kvm_riscv_vcpu_aia_set_csr(struct kvm_vcpu *vcpu,
204206
struct kvm_vcpu_aia_csr *csr = &vcpu->arch.aia_context.guest_csr;
205207
unsigned long regs_max = sizeof(struct kvm_riscv_aia_csr) / sizeof(unsigned long);
206208

209+
if (!riscv_isa_extension_available(vcpu->arch.isa, SSAIA))
210+
return -ENOENT;
207211
if (reg_num >= regs_max)
208212
return -ENOENT;
209213

0 commit comments

Comments
 (0)