Skip to contentSkip to conversation

x86/cpufeature changes for v4.11

GIT PULL Ingo Molnar 1 participant 1 message Feb 20, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-cpufeature-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cpufeature-for-linus

# HEAD: 3bba73b1b7a88d88c3ea16b7914c13d475e4a87b x86/cpufeature: Move RING3MWAIT feature to avoid conflicts

The main changes in this cycle were related to enable ring-3 MONITOR/MWAIT instructions support on supported CPUs, by Grzegorz Andrejczuk and Piotr Luc.

Thanks,

Ingo

------------------>
Grzegorz Andrejczuk (4):
x86/msr: Add MSR_MISC_FEATURE_ENABLES and RING3MWAIT bit x86/elf: Add HWCAP2 to expose ring 3 MONITOR/MWAIT x86/cpufeature: Add RING3MWAIT to CPU features x86/cpufeature: Enable RING3MWAIT for Knights Landing

Piotr Luc (2):
x86/cpufeature: Add AVX512_VPOPCNTDQ feature x86/cpufeature: Enable RING3MWAIT for Knights Mill

Thomas Gleixner (1):
x86/cpufeature: Move RING3MWAIT feature to avoid conflicts

 Documentation/admin-guide/kernel-parameters.txt |  4 +++
 arch/x86/include/asm/cpufeatures.h              |  4 +--
 arch/x86/include/asm/elf.h                      |  9 +++++
 arch/x86/include/asm/msr-index.h                |  5 +++
 arch/x86/include/uapi/asm/hwcap2.h              |  7 ++++
 arch/x86/kernel/cpu/common.c                    |  3 ++
 arch/x86/kernel/cpu/intel.c                     | 44 +++++++++++++++++++++++++
 arch/x86/kernel/fpu/xstate.c                    |  1 +
 tools/arch/x86/include/asm/cpufeatures.h        |  1 +
 9 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/include/uapi/asm/hwcap2.h
Documentation/admin-guide/kernel-parameters.txt +4 -0
index be7c0d9506b1..cfbb3fc938f7 100644
@@ -3563,6 +3563,10 @@
 	rhash_entries=	[KNL,NET]
 			Set number of hash buckets for route cache
 
+	ring3mwait=disable
+			[KNL] Disable ring 3 MONITOR/MWAIT feature on supported
+			CPUs.
+
 	ro		[KNL] Mount root device read-only on boot
 
 	rodata=		[KNL]
arch/x86/include/asm/cpufeatures.h +2 -2
index eafee3161d1c..43c4ea9cd907 100644
@@ -186,7 +186,7 @@
  *
  * Reuse free bits when adding new feature flags!
  */
-
+#define X86_FEATURE_RING3MWAIT	( 7*32+ 0) /* Ring 3 MONITOR/MWAIT */
 #define X86_FEATURE_CPB		( 7*32+ 2) /* AMD Core Performance Boost */
 #define X86_FEATURE_EPB		( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
 #define X86_FEATURE_CAT_L3	( 7*32+ 4) /* Cache Allocation Technology L3 */
@@ -288,6 +288,7 @@
 #define X86_FEATURE_AVX512VBMI  (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
 #define X86_FEATURE_PKU		(16*32+ 3) /* Protection Keys for Userspace */
 #define X86_FEATURE_OSPKE	(16*32+ 4) /* OS Protection Keys Enable */
+#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */
 #define X86_FEATURE_RDPID	(16*32+ 22) /* RDPID instruction */
 
 /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
@@ -320,5 +321,4 @@
 #define X86_BUG_SWAPGS_FENCE	X86_BUG(11) /* SWAPGS without input dep on GS */
 #define X86_BUG_MONITOR		X86_BUG(12) /* IPI required to wake up remote CPU */
 #define X86_BUG_AMD_E400	X86_BUG(13) /* CPU is among the affected by Erratum 400 */
-
 #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/elf.h +9 -0
index e7f155c3045e..9d49c18b5ea9 100644
@@ -258,6 +258,15 @@ extern int force_personality32;
 
 #define ELF_HWCAP		(boot_cpu_data.x86_capability[CPUID_1_EDX])
 
+extern u32 elf_hwcap2;
+
+/*
+ * HWCAP2 supplies mask with kernel enabled CPU features, so that
+ * the application can discover that it can safely use them.
+ * The bits are defined in uapi/asm/hwcap2.h.
+ */
+#define ELF_HWCAP2		(elf_hwcap2)
+
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
    intent than poking at uname or /proc/cpuinfo.
arch/x86/include/asm/msr-index.h +5 -0
index 710273c617b8..00293a94ffaf 100644
@@ -543,6 +543,11 @@
 #define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT	39
 #define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT)
 
+/* MISC_FEATURE_ENABLES non-architectural features */
+#define MSR_MISC_FEATURE_ENABLES	0x00000140
+
+#define MSR_MISC_FEATURE_ENABLES_RING3MWAIT_BIT		1
+
 #define MSR_IA32_TSC_DEADLINE		0x000006E0
 
 /* P4/Xeon+ specific */
arch/x86/include/uapi/asm/hwcap2.h new file +7 -0
new file mode 100644
index 000000000000..0bd2be5c7617
@@ -0,0 +1,7 @@
+#ifndef _ASM_X86_HWCAP2_H
+#define _ASM_X86_HWCAP2_H
+
+/* MONITOR/MWAIT enabled in Ring 3 */
+#define HWCAP2_RING3MWAIT		(1 << 0)
+
+#endif
arch/x86/kernel/cpu/common.c +3 -0
index 9bab7a8a4293..f879429cfcaa 100644
@@ -35,6 +35,7 @@
 #include <asm/desc.h>
 #include <asm/fpu/internal.h>
 #include <asm/mtrr.h>
+#include <asm/hwcap2.h>
 #include <linux/numa.h>
 #include <asm/asm.h>
 #include <asm/bugs.h>
@@ -51,6 +52,8 @@
 
 #include "cpu.h"
 
+u32 elf_hwcap2 __read_mostly;
+
 /* all of these masks are initialized in setup_cpu_local_masks() */
 cpumask_var_t cpu_initialized_mask;
 cpumask_var_t cpu_callout_mask;
arch/x86/kernel/cpu/intel.c +44 -0

62 lines not on this page · raw message

arch/x86/kernel/fpu/xstate.c +1 -0
index 1d7770447b3e..35f7024aace5 100644
@@ -78,6 +78,7 @@ void fpu__xstate_clear_all_cpu_caps(void)
 	setup_clear_cpu_cap(X86_FEATURE_PKU);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512_4VNNIW);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512_4FMAPS);
+	setup_clear_cpu_cap(X86_FEATURE_AVX512_VPOPCNTDQ);
 }
 
 /*
tools/arch/x86/include/asm/cpufeatures.h +1 -0
index cddd5d06e1cb..3603556fa0d9 100644
@@ -280,6 +280,7 @@
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
 #define X86_FEATURE_PKU		(16*32+ 3) /* Protection Keys for Userspace */
 #define X86_FEATURE_OSPKE	(16*32+ 4) /* OS Protection Keys Enable */
+#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */
 
 /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
 #define X86_FEATURE_OVERFLOW_RECOV (17*32+0) /* MCA overflow recovery support */