]> err.no Git - linux-2.6/blobdiff - arch/x86/kvm/x86.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-inttypes
[linux-2.6] / arch / x86 / kvm / x86.c
index 0735efbfa71254fbef6c38a2a2a86b54f104c59c..21338bdb28ff88a2577fb22d79aadfd9fee3cf39 100644 (file)
@@ -3022,6 +3022,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 
        kvm_x86_ops->decache_regs(vcpu);
 
+       vcpu->arch.exception.pending = false;
+
        vcpu_put(vcpu);
 
        return 0;
@@ -3484,7 +3486,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
        }
 
        if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) {
-               cseg_desc.type &= ~(1 << 8); //clear the B flag
+               cseg_desc.type &= ~(1 << 1); //clear the B flag
                save_guest_segment_descriptor(vcpu, tr_seg.selector,
                                              &cseg_desc);
        }
@@ -3510,7 +3512,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
        }
 
        if (reason != TASK_SWITCH_IRET) {
-               nseg_desc.type |= (1 << 8);
+               nseg_desc.type |= (1 << 1);
                save_guest_segment_descriptor(vcpu, tss_selector,
                                              &nseg_desc);
        }
@@ -3701,10 +3703,19 @@ void fx_init(struct kvm_vcpu *vcpu)
 {
        unsigned after_mxcsr_mask;
 
+       /*
+        * Touch the fpu the first time in non atomic context as if
+        * this is the first fpu instruction the exception handler
+        * will fire before the instruction returns and it'll have to
+        * allocate ram with GFP_KERNEL.
+        */
+       if (!used_math())
+               fx_save(&vcpu->arch.host_fx_image);
+
        /* Initialize guest FPU by resetting ours and saving into guest's */
        preempt_disable();
        fx_save(&vcpu->arch.host_fx_image);
-       fpu_init();
+       fx_finit();
        fx_save(&vcpu->arch.guest_fx_image);
        fx_restore(&vcpu->arch.host_fx_image);
        preempt_enable();
@@ -3909,6 +3920,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
        kvm_free_physmem(kvm);
        if (kvm->arch.apic_access_page)
                put_page(kvm->arch.apic_access_page);
+       if (kvm->arch.ept_identity_pagetable)
+               put_page(kvm->arch.ept_identity_pagetable);
        kfree(kvm);
 }