KVM: VMX: Respect interrupt window in big real mode
authorAvi Kivity <avi@redhat.com>
Sun, 19 Sep 2010 12:34:08 +0000 (14:34 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:53:02 +0000 (10:53 +0200)
If an interrupt is pending, we need to stop emulation so we
can inject it.

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

index 9d3f972aa19c07a1ac68d65fed11dc3060936312..28c72da93a1b11e2c7b7c34a6f8755f53df753ab 100644 (file)
@@ -3582,8 +3582,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) {