Date: Wed, 2 May 2018 08:19:06 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r333166 - stable/11/sys/x86/x86 Message-ID: <201805020819.w428J6LF090386@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed May 2 08:19:06 2018 New Revision: 333166 URL: https://svnweb.freebsd.org/changeset/base/333166 Log: MFC r333026: Handle Apollo Lake errata APL31. MFC r333034: Tweaks for r333026. Modified: stable/11/sys/x86/x86/cpu_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Wed May 2 08:16:38 2018 (r333165) +++ stable/11/sys/x86/x86/cpu_machdep.c Wed May 2 08:19:06 2018 (r333166) @@ -602,6 +602,11 @@ out: busy, curcpu); } +static int cpu_idle_apl31_workaround; +SYSCTL_INT(_machdep, OID_AUTO, idle_apl31, CTLFLAG_RW, + &cpu_idle_apl31_workaround, 0, + "Apollo Lake APL31 MWAIT bug workaround"); + int cpu_idle_wakeup(int cpu) { @@ -613,7 +618,7 @@ cpu_idle_wakeup(int cpu) return (0); case STATE_MWAIT: atomic_store_int(state, STATE_RUNNING); - return (1); + return (cpu_idle_apl31_workaround ? 0 : 1); case STATE_RUNNING: return (1); default: @@ -722,6 +727,17 @@ cpu_idle_tun(void *unused __unused) if (TUNABLE_STR_FETCH("machdep.idle", tunvar, sizeof(tunvar))) cpu_idle_selector(tunvar); + if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_id == 0x506c9) { + /* + * Apollo Lake errata APL31 (public errata APL30). + * Stores to the armed address range may not trigger + * MWAIT to resume execution. OS needs to use + * interrupts to wake processors from MWAIT-induced + * sleep states. + */ + cpu_idle_apl31_workaround = 1; + } + TUNABLE_INT_FETCH("machdep.idle_apl31", &cpu_idle_apl31_workaround); } SYSINIT(cpu_idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, cpu_idle_tun, NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805020819.w428J6LF090386>