]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/xstate: Don't special case feature collection
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 19 Jul 2019 14:07:06 +0000 (16:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 Jul 2019 14:07:06 +0000 (16:07 +0200)
The logic in xstate_init() is a rementent of the pre-featuremask days.
Collect the xstate features in generic_identify(), like all other feature
leaves, after which identify_cpu() will apply the known_feature[] mask derived
from the automatically generated CPUID information.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
master commit: 65c165d6595f2762da577cb428e3bc61e32e0899
master date: 2019-03-12 13:57:13 +0000

xen/arch/x86/cpu/common.c
xen/arch/x86/xstate.c

index de6c5c903f326db2053a0cfef54f24d22277c68b..53bb0a9e7c4e71dfb36a57ae185fc0aded915425 100644 (file)
@@ -414,6 +414,10 @@ static void generic_identify(struct cpuinfo_x86 *c)
                            &c->x86_capability[cpufeat_word(X86_FEATURE_FSGSBASE)],
                            &c->x86_capability[cpufeat_word(X86_FEATURE_PKU)],
                            &c->x86_capability[cpufeat_word(X86_FEATURE_AVX512_4VNNIW)]);
+       if (c->cpuid_level >= 0xd)
+               cpuid_count(0xd, 1,
+                           &c->x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)],
+                           &tmp, &tmp, &tmp);
 }
 
 /*
index 15edd5df96ebaf6c84be57c78f3904e3c198dc43..858d1a6573e3d1eb87eefe849013451a4fb5a889 100644 (file)
@@ -628,19 +628,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         BUG_ON(xsave_cntxt_size != _xstate_ctxt_size(feature_mask));
     }
 
-    /* Check extended XSAVE features. */
-    cpuid_count(XSTATE_CPUID, 1, &eax, &ebx, &ecx, &edx);
-
-    /* Mask out features not currently understood by Xen. */
-    eax &= (cpufeat_mask(X86_FEATURE_XSAVEOPT) |
-            cpufeat_mask(X86_FEATURE_XSAVEC) |
-            cpufeat_mask(X86_FEATURE_XGETBV1) |
-            cpufeat_mask(X86_FEATURE_XSAVES));
-
-    c->x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)] = eax;
-
-    BUG_ON(eax != boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)]);
-
     if ( setup_xstate_features(bsp) && bsp )
         BUG();
 }