summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorAvi Kivity2012-06-10 17:07:57 +0200
committerAvi Kivity2012-07-09 13:19:02 +0200
commitbdea48e305389b3c8c0f786a317f9da984c16604 (patch)
tree55f7789969d10b22ba6ea0e4f11f67dc422133e6 /arch/x86/kvm/vmx.c
parentKVM: x86 emulator: emulate SGDT/SIDT (diff)
downloadkernel-qcow2-linux-bdea48e305389b3c8c0f786a317f9da984c16604.tar.gz
kernel-qcow2-linux-bdea48e305389b3c8c0f786a317f9da984c16604.tar.xz
kernel-qcow2-linux-bdea48e305389b3c8c0f786a317f9da984c16604.zip
KVM: VMX: Fix interrupt exit condition during emulation
Checking EFLAGS.IF is incorrect as we might be in interrupt shadow. If that is the case, the main loop will notice that and not inject the interrupt, causing an endless loop. Fix by using vmx_interrupt_allowed() to check if we can inject an interrupt instead. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index debac4984347..6cdb40457695 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4983,8 +4983,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING;
while (!guest_state_valid(vcpu) && count-- != 0) {
- if (intr_window_requested
- && (kvm_get_rflags(&vmx->vcpu) & X86_EFLAGS_IF))
+ if (intr_window_requested && vmx_interrupt_allowed(vcpu))
return handle_interrupt_window(&vmx->vcpu);
err = emulate_instruction(vcpu, 0);