From patchwork Wed Apr 8 03:23:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 16997 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n383RUDR000528 for ; Wed, 8 Apr 2009 03:27:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbZDHD1M (ORCPT ); Tue, 7 Apr 2009 23:27:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752172AbZDHD1L (ORCPT ); Tue, 7 Apr 2009 23:27:11 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51209 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbZDHD1K (ORCPT ); Tue, 7 Apr 2009 23:27:10 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n383R9Pm007691; Tue, 7 Apr 2009 23:27:09 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n383RAEq026274; Tue, 7 Apr 2009 23:27:11 -0400 Received: from localhost.localdomain (vpn-10-15.bos.redhat.com [10.16.10.15]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n383R7YH015313; Tue, 7 Apr 2009 23:27:08 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, avi@redhat.com Subject: [PATCH] do not keep interrupt window closed by sti in real mode Date: Wed, 8 Apr 2009 00:23:37 -0300 Message-Id: <1239161017-7398-1-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org While in real mode, sti does not block interrupts from the subsequent instruction. This is stated at Intel SDM Volume 2b, page 4-432 Without this patch, I cannot boot gpxe option roms at vmx machines. This is described at https://bugzilla.redhat.com/show_bug.cgi?id=494469 Signed-off-by: Glauber Costa --- arch/x86/kvm/vmx.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c6997c0..51e0b8a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2490,18 +2490,19 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu) static void vmx_update_window_states(struct kvm_vcpu *vcpu) { u32 guest_intr = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); + int rmode = vcpu->arch.rmode.active; vcpu->arch.nmi_window_open = - !(guest_intr & (GUEST_INTR_STATE_STI | - GUEST_INTR_STATE_MOV_SS | + (rmode || !(guest_intr & GUEST_INTR_STATE_STI)) && + !(guest_intr & (GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_NMI)); if (!cpu_has_virtual_nmis() && to_vmx(vcpu)->soft_vnmi_blocked) vcpu->arch.nmi_window_open = 0; vcpu->arch.interrupt_window_open = ((vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && - !(guest_intr & (GUEST_INTR_STATE_STI | - GUEST_INTR_STATE_MOV_SS))); + (rmode || !(guest_intr & GUEST_INTR_STATE_STI)) && + !(guest_intr & GUEST_INTR_STATE_MOV_SS)); } static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu)