MMIO/PIO emulation should be interrupted if the system is restarted.
Otherwise in progress IO emulation continues at the instruction pointer,
even after vcpus' IP has been modified by KVM_SET_REGS.

Use IP change as an indicator to reset MMIO/PIO emulation state.

Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e8ba99c..9f7ce41 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6144,6 +6144,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, 
struct kvm_regs *regs)
        kvm_register_write(vcpu, VCPU_REGS_R15, regs->r15);
 #endif
 
+       /* stop IO emulation cycle if RIP changes */
+       if (kvm_rip_read(vcpu) != regs->rip)
+               vcpu->arch.complete_userspace_io = NULL;
+
        kvm_rip_write(vcpu, regs->rip);
        kvm_set_rflags(vcpu, regs->rflags);
 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to