KVM: VMX: Qualify check for host NMI
authorAvi Kivity <avi@redhat.com>
Mon, 7 Mar 2011 15:20:29 +0000 (17:20 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 11 May 2011 11:56:56 +0000 (07:56 -0400)
Check for the exit reason first; this allows us, later,
to avoid a VMREAD for VM_EXIT_INTR_INFO_FIELD.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c

index 53bf6ae493e3be85f9f99158f7394abe44a4f091..89130ba3b698f484bc292fba1ba3ea2d5276b738 100644 (file)
@@ -3905,7 +3905,8 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
                kvm_machine_check();
 
        /* We need to handle NMIs before interrupts are enabled */
-       if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
+       if (vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI &&
+           (exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
            (exit_intr_info & INTR_INFO_VALID_MASK)) {
                kvm_before_handle_nmi(&vmx->vcpu);
                asm("int $2");