summaryrefslogtreecommitdiff
path: root/arch/riscv/kvm/vcpu.c
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2022-12-07 06:46:21 +0300
committerAnup Patel <anup@brainfault.org>2022-12-07 06:46:21 +0300
commitaf934432e4a169f7252a114a6c5c7289366bd0ab (patch)
tree97490558e21e1d0fbf0638bb8c405573d7213d50 /arch/riscv/kvm/vcpu.c
parentb3f2575a993497dde19c18db73208325e8efba60 (diff)
downloadlinux-af934432e4a169f7252a114a6c5c7289366bd0ab.tar.xz
RISC-V: KVM: Exit run-loop immediately if xfer_to_guest fails
If xfer_to_guest_mode_handle_work() fails in the run-loop then exit the run-loop immediately instead of doing it after some more work. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'arch/riscv/kvm/vcpu.c')
-rw-r--r--arch/riscv/kvm/vcpu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index 71ebbc4821f0..17d5b3f8c2ee 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -984,8 +984,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
while (ret > 0) {
/* Check conditions before entering the guest */
ret = xfer_to_guest_mode_handle_work(vcpu);
- if (!ret)
- ret = 1;
+ if (ret)
+ continue;
+ ret = 1;
kvm_riscv_gstage_vmid_update(vcpu);