Merge tag 'kvm-x86-6.1-2' of https://github.com/sean-jc/linux into HEAD
[linux-2.6-block.git] / arch / x86 / kvm / cpuid.c
index ffdc28684cb7981f7395fae81e54dd5e361c727f..7065462378e2933d7c76711a54cc64c70140443a 100644 (file)
@@ -324,7 +324,6 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
 {
        struct kvm_lapic *apic = vcpu->arch.apic;
        struct kvm_cpuid_entry2 *best;
-       u64 guest_supported_xcr0;
 
        best = kvm_find_cpuid_entry(vcpu, 1);
        if (best && apic) {
@@ -336,10 +335,16 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
                kvm_apic_set_version(vcpu);
        }
 
-       guest_supported_xcr0 =
+       vcpu->arch.guest_supported_xcr0 =
                cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent);
 
-       vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0;
+       /*
+        * FP+SSE can always be saved/restored via KVM_{G,S}ET_XSAVE, even if
+        * XSAVE/XCRO are not exposed to the guest, and even if XSAVE isn't
+        * supported by the host.
+        */
+       vcpu->arch.guest_fpu.fpstate->user_xfeatures = vcpu->arch.guest_supported_xcr0 |
+                                                      XFEATURE_MASK_FPSSE;
 
        kvm_update_pv_runtime(vcpu);
 
@@ -913,8 +918,6 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
                        entry->edx = 0;
                }
                break;
-       case 9:
-               break;
        case 0xa: { /* Architectural Performance Monitoring */
                union cpuid10_eax eax;
                union cpuid10_edx edx;