From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 4/4] KVM: VMX: Respect interrupt window in big real mode Date: Sun, 19 Sep 2010 14:34:08 +0200 Message-ID: <1284899648-19958-5-git-send-email-avi@redhat.com> References: <1284899648-19958-1-git-send-email-avi@redhat.com> Cc: Mohammed Gamal To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57192 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753572Ab0ISMeL (ORCPT ); Sun, 19 Sep 2010 08:34:11 -0400 In-Reply-To: <1284899648-19958-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: If an interrupt is pending, we need to stop emulation so we can inject it. Signed-off-by: Avi Kivity --- 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