public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Cc: Mohammed Gamal <m.gamal005@gmail.com>
Subject: [PATCH 4/4] KVM: VMX: Respect interrupt window in big real mode
Date: Sun, 19 Sep 2010 14:34:08 +0200	[thread overview]
Message-ID: <1284899648-19958-5-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1284899648-19958-1-git-send-email-avi@redhat.com>

If an interrupt is pending, we need to stop emulation so we
can inject it.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/vmx.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2572153..1a5ecfd 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3588,8 +3588,17 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
 	struct vcpu_vmx *vmx = to_vmx(vcpu);
 	enum emulation_result err = EMULATE_DONE;
 	int ret = 1;
+	u32 cpu_exec_ctrl;
+	bool intr_window_requested;
+
+	cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
+	intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING;
 
 	while (!guest_state_valid(vcpu)) {
+		if (intr_window_requested
+		    && (kvm_get_rflags(&vmx->vcpu) & X86_EFLAGS_IF))
+			return handle_interrupt_window(&vmx->vcpu);
+
 		err = emulate_instruction(vcpu, 0, 0, 0);
 
 		if (err == EMULATE_DO_MMIO) {
-- 
1.7.2.3


  parent reply	other threads:[~2010-09-19 12:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-19 12:34 [PATCH 0/4] Real mode interrupt injection emulation Avi Kivity
2010-09-19 12:34 ` [PATCH 1/4] KVM: x86 emulator: Expose emulate_int_real() Avi Kivity
2010-09-19 12:34 ` [PATCH 2/4] KVM: Add kvm_inject_realmode_interrupt() wrapper Avi Kivity
2010-09-19 12:34 ` [PATCH 3/4] KVM: VMX: Emulated real mode interrupt injection Avi Kivity
2010-09-20 17:30   ` Marcelo Tosatti
2010-09-21 11:56     ` Avi Kivity
2010-09-21 15:36       ` Marcelo Tosatti
2010-09-21 16:00         ` Avi Kivity
2010-09-19 12:34 ` Avi Kivity [this message]
2010-09-19 15:25 ` [PATCH 0/4] Real mode interrupt injection emulation Avi Kivity
2010-09-21 18:32 ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1284899648-19958-5-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=m.gamal005@gmail.com \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox