]> xenbits.xensource.com Git - xen.git/commitdiff
x86/cpu: Fix common cpuid faulting probing for AMD and Hygon
authorPu Wen <puwen@hygon.cn>
Thu, 4 Apr 2019 13:45:42 +0000 (21:45 +0800)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 6 Jun 2019 14:28:20 +0000 (15:28 +0100)
There is no MSR_INTEL_PLATFORM_INFO for AMD and Hygon families. Read
this MSR will stop the Xen initialization process in some Hygon
systems or produce GPF(0). So directly return false in the function
probe_cpuid_faulting() if !cpu_has_hypervisor.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Acked-by: Jan Beulich <jbeulich@suse.com>
[Rebase over 0cd074144cb "x86/cpu: Renumber X86_VENDOR_* to form a bitmap"]
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/common.c

index 4eee12da23fa7e74580956af459c1a44b6145527..31294927a1a29a5173d61d6df0515b18507eeb3f 100644 (file)
@@ -113,6 +113,14 @@ bool __init probe_cpuid_faulting(void)
        uint64_t val;
        int rc;
 
+       /*
+        * Don't bother looking for CPUID faulting if we aren't virtualised on
+        * AMD or Hygon hardware - it won't be present.
+        */
+       if ((boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
+           !cpu_has_hypervisor)
+               return false;
+
        if ((rc = rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val)) == 0)
                raw_msr_policy.plaform_info.cpuid_faulting =
                        val & MSR_PLATFORM_INFO_CPUID_FAULTING;