public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: x86: stop IO emulation cycle if instruction pointer is modified
@ 2013-07-05 19:16 Marcelo Tosatti
  2013-07-06  7:41 ` Gleb Natapov
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2013-07-05 19:16 UTC (permalink / raw)
  To: kvm-devel; +Cc: Gleb Natapov


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 <mtosatti@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);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-08 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-05 19:16 KVM: x86: stop IO emulation cycle if instruction pointer is modified Marcelo Tosatti
2013-07-06  7:41 ` Gleb Natapov
2013-07-08 21:16   ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox