Module Name: src
Committed By: martin
Date: Fri Jul 13 15:51:28 UTC 2018
Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.98.2.5 -r1.98.2.6 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/x86/x86/identcpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.5 src/sys/arch/x86/include/specialreg.h:1.98.2.6
--- src/sys/arch/x86/include/specialreg.h:1.98.2.5 Sat Jun 9 15:12:21 2018
+++ src/sys/arch/x86/include/specialreg.h Fri Jul 13 15:51:28 2018
@@ -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
Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.4 src/sys/arch/x86/x86/identcpu.c:1.55.2.5
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.4 Sat Jun 23 11:39:02 2018
+++ src/sys/arch/x86/x86/identcpu.c Fri Jul 13 15:51:28 2018
@@ -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 @@ cpu_probe_intel_cache(struct cpu_info *c
}
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 @@ cpu_probe_intel(struct cpu_info *ci)
return;
cpu_probe_intel_cache(ci);
+ cpu_probe_intel_errata(ci);
}
static void