From dab4a15f7c87407f38727b73ecc46debd840b0e9 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 9 Oct 2007 12:12:19 +0200 Subject: [PATCH] --- yaml --- r: 72127 b: refs/heads/master c: 1b6269db3f83396c2fd2c8d0f3e0f37ac0e6ba05 h: refs/heads/master i: 72125: 9851f3ba793b4557c515f5520085d26c57808f50 72123: 05d0498183181b3721d11cc31b476dfcb4358007 72119: 1d5e646360d2d5662615aceac1a957dcff3bff3e 72111: 08e645f19aab7e106624d28ced292ef0cdfbaea1 72095: b7aff1df9a777806d1006fe353ff1d63fc238740 72063: 38a2b68f3b6eaeffb1b2d1bd077a4f4fdda7d486 v: v3 --- [refs] | 2 +- trunk/drivers/kvm/vmx.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index f671e10d11cf..185b8f96896f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7f2145ad6f3e7060147a2a4c4db35c641ff61b5c +refs/heads/master: 1b6269db3f83396c2fd2c8d0f3e0f37ac0e6ba05 diff --git a/trunk/drivers/kvm/vmx.c b/trunk/drivers/kvm/vmx.c index 4f115a8e45ef..bcc1e398a976 100644 --- a/trunk/drivers/kvm/vmx.c +++ b/trunk/drivers/kvm/vmx.c @@ -1760,10 +1760,8 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) set_bit(irq / BITS_PER_LONG, &vcpu->irq_summary); } - if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) { /* nmi */ - asm ("int $2"); - return 1; - } + if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) /* nmi */ + return 1; /* already handled by vmx_vcpu_run() */ if (is_no_device(intr_info)) { vmx_fpu_activate(vcpu); @@ -2196,6 +2194,7 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { struct vcpu_vmx *vmx = to_vmx(vcpu); + u32 intr_info; /* * Loading guest fpu may have cleared host cr0.ts @@ -2322,6 +2321,12 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); vmx->launched = 1; + + intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + + /* We need to handle NMIs before interrupts are enabled */ + if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) /* nmi */ + asm("int $2"); } static void vmx_inject_page_fault(struct kvm_vcpu *vcpu,