]> xenbits.xensource.com Git - xen.git/commitdiff
x86/cpuid: Avoid unconditionally clobbering ITSC for guests
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 13 May 2016 18:38:41 +0000 (19:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 May 2016 14:54:49 +0000 (15:54 +0100)
In general, Invariant TSC is not a feature which can be advertised to guests,
because it cannot be guaranteed across migrate.  domain_cpuid() goes so far as
to deliberately clobber the feature flag under a number of circumstances.

Because ITSC is absent from the static {pv,hvm}_featureset masks, c/s b648feff
"xen/x86: Improvements to in-hypervisor cpuid sanity checks" caused ITSC to be
unconditionally masked out.

As an interim solution, include the hosts idea of ITSC along with the static
{pv,hvm}_featureset when restricting the guests view of features.  This causes
the hardware domain, and VMs explicitly configured with ITSC and no-migrate to
be offered ITSC (subject to hardware availability).

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/traps.c

index 7492030a131a4212d9ca8e700621b2c8836867a9..5040a5c8640b59e4cd5b8fd3c7fc9611693d1a69 100644 (file)
@@ -3509,7 +3509,8 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
         break;
 
     case 0x80000007:
-        *edx &= hvm_featureset[FEATURESET_e7d];
+        *edx &= (hvm_featureset[FEATURESET_e7d] |
+                 (host_featureset[FEATURESET_e7d] & cpufeat_mask(X86_FEATURE_ITSC)));
         break;
 
     case 0x80000008:
index 0052ab8a0fbcb833ff8e6ad07934ab60b843d6c0..1ef8401b01e05ec0f6b530d97abf42eed21262fa 100644 (file)
@@ -1142,7 +1142,8 @@ void pv_cpuid(struct cpu_user_regs *regs)
         break;
 
     case 0x80000007:
-        d &= pv_featureset[FEATURESET_e7d];
+        d &= (pv_featureset[FEATURESET_e7d] |
+              (host_featureset[FEATURESET_e7d] & cpufeat_mask(X86_FEATURE_ITSC)));
         break;
 
     case 0x80000008: