Skip to content

Commit c7db342

Browse files
jones-drewavpatel
authored andcommitted
riscv: KVM: Fix hart suspend status check
"Not stopped" means started or suspended so we need to check for a single state in order to have a chance to check for each state. Also, we need to use target_vcpu when checking for the suspend state. Fixes: 763c8be ("RISC-V: KVM: Implement SBI HSM suspend call") Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20250217084506.18763-8-ajones@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 0ad2507 commit c7db342

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/riscv/kvm/vcpu_sbi_hsm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu)
7979
target_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, target_vcpuid);
8080
if (!target_vcpu)
8181
return SBI_ERR_INVALID_PARAM;
82-
if (!kvm_riscv_vcpu_stopped(target_vcpu))
83-
return SBI_HSM_STATE_STARTED;
84-
else if (vcpu->stat.generic.blocking)
82+
if (kvm_riscv_vcpu_stopped(target_vcpu))
83+
return SBI_HSM_STATE_STOPPED;
84+
else if (target_vcpu->stat.generic.blocking)
8585
return SBI_HSM_STATE_SUSPENDED;
8686
else
87-
return SBI_HSM_STATE_STOPPED;
87+
return SBI_HSM_STATE_STARTED;
8888
}
8989

9090
static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,

0 commit comments

Comments
 (0)