Skip to content

Commit

Permalink
RISC-V: KVM: Return correct code for hsm stop function
Browse files Browse the repository at this point in the history
According to the SBI specification, the stop function can only
return error code SBI_ERR_FAILED. However, currently it returns
-EINVAL which will be mapped SBI_ERR_INVALID_PARAM.

Return an linux error code that maps to SBI_ERR_FAILED i.e doesn't map
to any other SBI error code. While EACCES is not the best error code
to describe the situation, it is close enough and will be replaced
with SBI error codes directly anyways.

Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information
Atish Patra authored and Anup Patel committed Feb 7, 2023
1 parent 026bac4 commit 8cdb8a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/riscv/kvm/vcpu_sbi_hsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int kvm_sbi_hsm_vcpu_start(struct kvm_vcpu *vcpu)
static int kvm_sbi_hsm_vcpu_stop(struct kvm_vcpu *vcpu)
{
if (vcpu->arch.power_off)
return -EINVAL;
return -EACCES;

kvm_riscv_vcpu_power_off(vcpu);

Expand Down

0 comments on commit 8cdb8a5

Please sign in to comment.