aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r--drivers/kvm/vmx.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 4f115a8e45ef..bb56ae3f89b6 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -523,6 +523,8 @@ static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu)
523 523
524static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) 524static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
525{ 525{
526 if (vcpu->rmode.active)
527 rflags |= IOPL_MASK | X86_EFLAGS_VM;
526 vmcs_writel(GUEST_RFLAGS, rflags); 528 vmcs_writel(GUEST_RFLAGS, rflags);
527} 529}
528 530
@@ -1128,6 +1130,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
1128 fix_rmode_seg(VCPU_SREG_GS, &vcpu->rmode.gs); 1130 fix_rmode_seg(VCPU_SREG_GS, &vcpu->rmode.gs);
1129 fix_rmode_seg(VCPU_SREG_FS, &vcpu->rmode.fs); 1131 fix_rmode_seg(VCPU_SREG_FS, &vcpu->rmode.fs);
1130 1132
1133 kvm_mmu_reset_context(vcpu);
1131 init_rmode_tss(vcpu->kvm); 1134 init_rmode_tss(vcpu->kvm);
1132} 1135}
1133 1136
@@ -1760,10 +1763,8 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1760 set_bit(irq / BITS_PER_LONG, &vcpu->irq_summary); 1763 set_bit(irq / BITS_PER_LONG, &vcpu->irq_summary);
1761 } 1764 }
1762 1765
1763 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) { /* nmi */ 1766 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) /* nmi */
1764 asm ("int $2"); 1767 return 1; /* already handled by vmx_vcpu_run() */
1765 return 1;
1766 }
1767 1768
1768 if (is_no_device(intr_info)) { 1769 if (is_no_device(intr_info)) {
1769 vmx_fpu_activate(vcpu); 1770 vmx_fpu_activate(vcpu);
@@ -2196,6 +2197,7 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
2196static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 2197static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2197{ 2198{
2198 struct vcpu_vmx *vmx = to_vmx(vcpu); 2199 struct vcpu_vmx *vmx = to_vmx(vcpu);
2200 u32 intr_info;
2199 2201
2200 /* 2202 /*
2201 * Loading guest fpu may have cleared host cr0.ts 2203 * Loading guest fpu may have cleared host cr0.ts
@@ -2322,6 +2324,12 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2322 2324
2323 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 2325 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
2324 vmx->launched = 1; 2326 vmx->launched = 1;
2327
2328 intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
2329
2330 /* We need to handle NMIs before interrupts are enabled */
2331 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) /* nmi */
2332 asm("int $2");
2325} 2333}
2326 2334
2327static void vmx_inject_page_fault(struct kvm_vcpu *vcpu, 2335static void vmx_inject_page_fault(struct kvm_vcpu *vcpu,