Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbdGEKkL (ORCPT ); Wed, 5 Jul 2017 06:40:11 -0400 Received: from terminus.zytor.com ([65.50.211.136]:57119 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751626AbdGEKkJ (ORCPT ); Wed, 5 Jul 2017 06:40:09 -0400 Date: Wed, 5 Jul 2017 03:32:23 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: mgorman@suse.de, akpm@linux-foundation.org, torvalds@linux-foundation.org, riel@redhat.com, linux-kernel@vger.kernel.org, bp@suse.de, hpa@zytor.com, peterz@infradead.org, arjan@linux.intel.com, luto@kernel.org, dave.hansen@intel.com, nadav.amit@gmail.com, bp@alien8.de, mingo@kernel.org, tglx@linutronix.de Reply-To: bp@alien8.de, luto@kernel.org, nadav.amit@gmail.com, dave.hansen@intel.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com, arjan@linux.intel.com, linux-kernel@vger.kernel.org, bp@suse.de, akpm@linux-foundation.org, mgorman@suse.de, riel@redhat.com, torvalds@linux-foundation.org In-Reply-To: <2e391769192a4d31b808410c383c6bf0734bc6ea.1498751203.git.luto@kernel.org> References: <2e391769192a4d31b808410c383c6bf0734bc6ea.1498751203.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm: Disable PCID on 32-bit kernels Git-Commit-ID: cba4671af7550e008f7a7835f06df0763825bf3e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2851 Lines: 79 Commit-ID: cba4671af7550e008f7a7835f06df0763825bf3e Gitweb: http://git.kernel.org/tip/cba4671af7550e008f7a7835f06df0763825bf3e Author: Andy Lutomirski AuthorDate: Thu, 29 Jun 2017 08:53:19 -0700 Committer: Ingo Molnar CommitDate: Wed, 5 Jul 2017 10:52:57 +0200 x86/mm: Disable PCID on 32-bit kernels 32-bit kernels on new hardware will see PCID in CPUID, but PCID can only be used in 64-bit mode. Rather than making all PCID code conditional, just disable the feature on 32-bit builds. Signed-off-by: Andy Lutomirski Reviewed-by: Nadav Amit Reviewed-by: Borislav Petkov Reviewed-by: Thomas Gleixner Cc: Andrew Morton Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dave Hansen Cc: Linus Torvalds Cc: Mel Gorman Cc: Peter Zijlstra Cc: Rik van Riel Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/2e391769192a4d31b808410c383c6bf0734bc6ea.1498751203.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/disabled-features.h | 4 +++- arch/x86/kernel/cpu/bugs.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index 5dff775..c10c912 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -21,11 +21,13 @@ # define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) # define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31)) # define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) +# define DISABLE_PCID 0 #else # define DISABLE_VME 0 # define DISABLE_K6_MTRR 0 # define DISABLE_CYRIX_ARR 0 # define DISABLE_CENTAUR_MCR 0 +# define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31)) #endif /* CONFIG_X86_64 */ #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS @@ -49,7 +51,7 @@ #define DISABLED_MASK1 0 #define DISABLED_MASK2 0 #define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) -#define DISABLED_MASK4 0 +#define DISABLED_MASK4 (DISABLE_PCID) #define DISABLED_MASK5 0 #define DISABLED_MASK6 0 #define DISABLED_MASK7 0 diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 0af86d9..db68488 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -21,6 +21,14 @@ void __init check_bugs(void) { +#ifdef CONFIG_X86_32 + /* + * Regardless of whether PCID is enumerated, the SDM says + * that it can't be enabled in 32-bit mode. + */ + setup_clear_cpu_cap(X86_FEATURE_PCID); +#endif + identify_boot_cpu(); if (!IS_ENABLED(CONFIG_SMP)) {