Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 Disable MWAIT/MONITOR on Apollo Lake CPUs to wo...
details: https://anonhg.NetBSD.org/src/rev/9cbfe0d97034
branches: trunk
changeset: 320396:9cbfe0d97034
user: maya <maya%NetBSD.org@localhost>
date: Wed Jul 04 07:55:57 2018 +0000
description:
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 13a161bc974c -r 9cbfe0d97034 sys/arch/x86/include/specialreg.h
--- a/sys/arch/x86/include/specialreg.h Wed Jul 04 07:38:38 2018 +0000
+++ b/sys/arch/x86/include/specialreg.h Wed Jul 04 07:55:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: specialreg.h,v 1.126 2018/05/31 03:29:01 msaitoh Exp $ */
+/* $NetBSD: specialreg.h,v 1.127 2018/07/04 07:55:57 maya 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 13a161bc974c -r 9cbfe0d97034 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c Wed Jul 04 07:38:38 2018 +0000
+++ b/sys/arch/x86/x86/identcpu.c Wed Jul 04 07:55:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: identcpu.c,v 1.78 2018/07/01 07:59:30 maxv Exp $ */
+/* $NetBSD: identcpu.c,v 1.79 2018/07/04 07:55:57 maya 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.78 2018/07/01 07:59:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.79 2018/07/04 07:55:57 maya Exp $");
#include "opt_xen.h"
@@ -190,6 +190,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)
{
@@ -197,6 +215,7 @@
return;
cpu_probe_intel_cache(ci);
+ cpu_probe_intel_errata(ci);
}
static void
Home |
Main Index |
Thread Index |
Old Index