Message ID | 20250217084506.18763-8-ajones@ventanamicro.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | riscv: KVM: Fix a few SBI issues | expand |
On Mon, Feb 17, 2025 at 2:15 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > "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: 763c8bed8c05 ("RISC-V: KVM: Implement SBI HSM suspend call") > Signed-off-by: Andrew Jones <ajones@ventanamicro.com> LGTM. Reviewed-by: Anup Patel <anup@brainfault.org> Regards, Anup > --- > arch/riscv/kvm/vcpu_sbi_hsm.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c > index dce667f4b6ab..13a35eb77e8e 100644 > --- a/arch/riscv/kvm/vcpu_sbi_hsm.c > +++ b/arch/riscv/kvm/vcpu_sbi_hsm.c > @@ -79,12 +79,12 @@ static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu) > target_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, target_vcpuid); > if (!target_vcpu) > return SBI_ERR_INVALID_PARAM; > - if (!kvm_riscv_vcpu_stopped(target_vcpu)) > - return SBI_HSM_STATE_STARTED; > - else if (vcpu->stat.generic.blocking) > + if (kvm_riscv_vcpu_stopped(target_vcpu)) > + return SBI_HSM_STATE_STOPPED; > + else if (target_vcpu->stat.generic.blocking) > return SBI_HSM_STATE_SUSPENDED; > else > - return SBI_HSM_STATE_STOPPED; > + return SBI_HSM_STATE_STARTED; > } > > static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run, > -- > 2.48.1 >
diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c index dce667f4b6ab..13a35eb77e8e 100644 --- a/arch/riscv/kvm/vcpu_sbi_hsm.c +++ b/arch/riscv/kvm/vcpu_sbi_hsm.c @@ -79,12 +79,12 @@ static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu) target_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, target_vcpuid); if (!target_vcpu) return SBI_ERR_INVALID_PARAM; - if (!kvm_riscv_vcpu_stopped(target_vcpu)) - return SBI_HSM_STATE_STARTED; - else if (vcpu->stat.generic.blocking) + if (kvm_riscv_vcpu_stopped(target_vcpu)) + return SBI_HSM_STATE_STOPPED; + else if (target_vcpu->stat.generic.blocking) return SBI_HSM_STATE_SUSPENDED; else - return SBI_HSM_STATE_STOPPED; + return SBI_HSM_STATE_STARTED; } static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
"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: 763c8bed8c05 ("RISC-V: KVM: Implement SBI HSM suspend call") Signed-off-by: Andrew Jones <ajones@ventanamicro.com> --- arch/riscv/kvm/vcpu_sbi_hsm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)