Skip to contentSkip to conversation

x86/cpufeature changes for v3.17

GIT PULL Ingo Molnar 1 participant 1 message Aug 4, 2014 x86

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: af0fa6f6b5851761e9fbf79eb14ba86e857b4e7b x86, cpu: Kill cpu_has_mp

The main changes in this cycle were:

* Continued cleanups of CPU bugs mis-marked as 'missing features', by Borislav Petkov.

* Detect the xsaves/xrstors feature and releated cleanup, by Fenghua Yu.

Thanks,

Ingo

------------------>
Borislav Petkov (4):
x86, cpufeature: Convert more "features" to bugs x86/cpufeature: Add bug flags to /proc/cpuinfo x86, amd: Cleanup init_amd
x86, cpu: Kill cpu_has_mp

Fenghua Yu (2):
x86/cpufeature.h: Reformat x86 feature macros x86/xsaves: Detect xsaves/xrstors feature

 arch/x86/include/asm/apic.h           |   2 +-
 arch/x86/include/asm/cpufeature.h     | 409 +++++++++++++++++-----------------
 arch/x86/include/asm/fpu-internal.h   |   2 +-
 arch/x86/include/asm/mwait.h          |   2 +-
 arch/x86/include/uapi/asm/msr-index.h |   2 +
 arch/x86/kernel/cpu/amd.c             | 341 ++++++++++++++--------------
 arch/x86/kernel/cpu/common.c          |   9 +
 arch/x86/kernel/cpu/intel.c           |   4 +-
 arch/x86/kernel/cpu/mkcapflags.sh     |  51 +++--
 arch/x86/kernel/cpu/proc.c            |   8 +
 arch/x86/kernel/cpu/scattered.c       |   1 -
 11 files changed, 433 insertions(+), 398 deletions(-)
arch/x86/include/asm/apic.h +1 -1
index 19b0eba..79752f2 100644
@@ -99,7 +99,7 @@ static inline void native_apic_mem_write(u32 reg, u32 v)
 {
 	volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
 
-	alternative_io("movl %0, %1", "xchgl %0, %1", X86_FEATURE_11AP,
+	alternative_io("movl %0, %1", "xchgl %0, %1", X86_BUG_11AP,
 		       ASM_OUTPUT2("=r" (v), "=m" (*addr)),
 		       ASM_OUTPUT2("0" (v), "m" (*addr)));
 }
arch/x86/include/asm/cpufeature.h +210 -199

486 lines not on this page · raw message

arch/x86/include/asm/fpu-internal.h +1 -1
index 115e368..e3b8542 100644
@@ -293,7 +293,7 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
 	/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
 	   is pending.  Clear the x87 state here by setting it to fixed
 	   values. "m" is a random variable that should be in L1 */
-	if (unlikely(static_cpu_has_safe(X86_FEATURE_FXSAVE_LEAK))) {
+	if (unlikely(static_cpu_has_bug_safe(X86_BUG_FXSAVE_LEAK))) {
 		asm volatile(
 			"fnclex\n\t"
 			"emms\n\t"
arch/x86/include/asm/mwait.h +1 -1
index 1da25a5..a1410db 100644
@@ -43,7 +43,7 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
 static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
 {
 	if (!current_set_polling_and_test()) {
-		if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
+		if (static_cpu_has_bug(X86_BUG_CLFLUSH_MONITOR)) {
 			mb();
 			clflush((void *)&current_thread_info()->flags);
 			mb();
arch/x86/include/uapi/asm/msr-index.h +2 -0
index fcf2b3a..5cd1569 100644
@@ -297,6 +297,8 @@
 #define MSR_IA32_TSC_ADJUST             0x0000003b
 #define MSR_IA32_BNDCFGS		0x00000d90
 
+#define MSR_IA32_XSS			0x00000da0
+
 #define FEATURE_CONTROL_LOCKED				(1<<0)
 #define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX	(1<<1)
 #define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX	(1<<2)
arch/x86/kernel/cpu/amd.c +162 -179

442 lines not on this page · raw message

arch/x86/kernel/cpu/common.c +9 -0
index ef1b93f..188a8c5 100644
@@ -634,6 +634,15 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 		c->x86_capability[9] = ebx;
 	}
 
+	/* Extended state features: level 0x0000000d */
+	if (c->cpuid_level >= 0x0000000d) {
+		u32 eax, ebx, ecx, edx;
+
+		cpuid_count(0x0000000d, 1, &eax, &ebx, &ecx, &edx);
+
+		c->x86_capability[10] = eax;
+	}
+
 	/* AMD-defined flags: level 0x80000001 */
 	xlvl = cpuid_eax(0x80000000);
 	c->extended_cpuid_level = xlvl;
arch/x86/kernel/cpu/intel.c +2 -2
index a800290..0fd9557 100644
@@ -253,7 +253,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
 	 */
 	if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
 	    (c->x86_mask < 0x6 || c->x86_mask == 0xb))
-		set_cpu_cap(c, X86_FEATURE_11AP);
+		set_cpu_bug(c, X86_BUG_11AP);
 
 
 #ifdef CONFIG_X86_INTEL_USERCOPY
@@ -391,7 +391,7 @@ static void init_intel(struct cpuinfo_x86 *c)
 
 	if (c->x86 == 6 && cpu_has_clflush &&
 	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
-		set_cpu_cap(c, X86_FEATURE_CLFLUSH_MONITOR);
+		set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);
 
 #ifdef CONFIG_X86_64
 	if (c->x86 == 15)
arch/x86/kernel/cpu/mkcapflags.sh +37 -14

71 lines not on this page · raw message

arch/x86/kernel/cpu/proc.c +8 -0
index 06fe3ed..5433658 100644
@@ -97,6 +97,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		if (cpu_has(c, i) && x86_cap_flags[i] != NULL)
 			seq_printf(m, " %s", x86_cap_flags[i]);
 
+	seq_printf(m, "\nbugs\t\t:");
+	for (i = 0; i < 32*NBUGINTS; i++) {
+		unsigned int bug_bit = 32*NCAPINTS + i;
+
+		if (cpu_has_bug(c, bug_bit) && x86_bug_flags[i])
+			seq_printf(m, " %s", x86_bug_flags[i]);
+	}
+
 	seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
 		   c->loops_per_jiffy/(500000/HZ),
 		   (c->loops_per_jiffy/(5000/HZ)) % 100);
arch/x86/kernel/cpu/scattered.c +0 -1
index b6f794a..4a8013d 100644
@@ -38,7 +38,6 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c)
 		{ X86_FEATURE_PTS,		CR_EAX, 6, 0x00000006, 0 },
 		{ X86_FEATURE_APERFMPERF,	CR_ECX, 0, 0x00000006, 0 },
 		{ X86_FEATURE_EPB,		CR_ECX, 3, 0x00000006, 0 },
-		{ X86_FEATURE_XSAVEOPT,		CR_EAX,	0, 0x0000000d, 1 },
 		{ X86_FEATURE_HW_PSTATE,	CR_EDX, 7, 0x80000007, 0 },
 		{ X86_FEATURE_CPB,		CR_EDX, 9, 0x80000007, 0 },
 		{ X86_FEATURE_PROC_FEEDBACK,	CR_EDX,11, 0x80000007, 0 },