From owner-svn-src-all@freebsd.org Wed May 2 08:19:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA827FC5BF7; Wed, 2 May 2018 08:19:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8AE07746DB; Wed, 2 May 2018 08:19:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8027266F5; Wed, 2 May 2018 08:19:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w428J682090387; Wed, 2 May 2018 08:19:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w428J6LF090386; Wed, 2 May 2018 08:19:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805020819.w428J6LF090386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 2 May 2018 08:19:06 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 333166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2018 08:19:07 -0000 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);