Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/x86 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/3b97d07e35d6
branches:  netbsd-8
changeset: 320605:3b97d07e35d6
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jul 13 15:51:28 2018 +0000

description:
Pull up following revision(s) (requested by maya in ticket #912):

        sys/arch/x86/x86/identcpu.c: revision 1.79
        sys/arch/x86/include/specialreg.h: revision 1.127

Disable MWAIT/MONITOR on Apollo Lake CPUs to workaround APL30 errata.

We use MWAIT/MONITOR to hatch secondary CPUs. The errata means that
the wakeup may not happen, so SMP boot fails.
Use wrmsr to disable it in hardware too, for extra paranoia.

PR port-amd64/53420,
also reported on netbsd-users by joern clausen and ssartor.

diffstat:

 sys/arch/x86/include/specialreg.h |   3 ++-
 sys/arch/x86/x86/identcpu.c       |  23 +++++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diffs (68 lines):

diff -r b893611902bb -r 3b97d07e35d6 sys/arch/x86/include/specialreg.h
--- a/sys/arch/x86/include/specialreg.h Fri Jul 13 15:49:55 2018 +0000
+++ b/sys/arch/x86/include/specialreg.h Fri Jul 13 15:51:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: specialreg.h,v 1.98.2.5 2018/06/09 15:12:21 martin Exp $       */
+/*     $NetBSD: specialreg.h,v 1.98.2.6 2018/07/13 15:51:28 martin Exp $       */
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -683,6 +683,7 @@
 #define MSR_THERM_STATUS       0x19c
 #define MSR_THERM2_CTL         0x19d   /* Pentium M */
 #define MSR_MISC_ENABLE                0x1a0
+#define        IA32_MISC_MWAIT_EN      0x40000
 #define MSR_TEMPERATURE_TARGET 0x1a2
 #define MSR_DEBUGCTLMSR                0x1d9
 #define MSR_LASTBRANCHFROMIP   0x1db
diff -r b893611902bb -r 3b97d07e35d6 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Fri Jul 13 15:49:55 2018 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Fri Jul 13 15:51:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $ */
+/*     $NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -189,6 +189,24 @@
 }
 
 static void
+cpu_probe_intel_errata(struct cpu_info *ci)
+{
+       u_int family, model, stepping;
+
+       family = CPUID_TO_FAMILY(ci->ci_signature);
+       model = CPUID_TO_MODEL(ci->ci_signature);
+       stepping = CPUID_TO_STEPPING(ci->ci_signature);
+
+       if (family == 0x6 && model == 0x5C && stepping == 0x9) { /* Apollo Lake */
+               wrmsr(MSR_MISC_ENABLE,
+                   rdmsr(MSR_MISC_ENABLE) & ~IA32_MISC_MWAIT_EN);
+
+               cpu_feature[1] &= ~CPUID2_MONITOR;
+               ci->ci_feat_val[1] &= ~CPUID2_MONITOR;
+       }
+}
+
+static void
 cpu_probe_intel(struct cpu_info *ci)
 {
 
@@ -196,6 +214,7 @@
                return;
 
        cpu_probe_intel_cache(ci);
+       cpu_probe_intel_errata(ci);
 }
 
 static void



Home | Main Index | Thread Index | Old Index