linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/cpu: Probe CPUID leaf 6 even when cpuid_level == 6
@ 2016-12-15 18:14 Andy Lutomirski
  2016-12-15 19:17 ` Borislav Petkov
  2016-12-19 10:56 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Lutomirski @ 2016-12-15 18:14 UTC (permalink / raw)
  To: x86
  Cc: Borislav Petkov, linux-kernel@vger.kernel.org, Brian Gerst,
	Andy Lutomirski

A typo (or mis-merge?) resulted in leaf 6 only being probed if
cpuid_level >= 7.

Fixes: 2ccd71f1b278 ("x86/cpufeature: Move some of the scattered feature bits to x86_capability")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---

I don't know what CPUs, if any, are affected, and the bug is minor anyway,
so the major advantage of applying this is to remove a head-scratcher when
reading the code, I think.

 arch/x86/kernel/cpu/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index cc9e980c68ec..d61722821b7b 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -667,13 +667,14 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 		c->x86_capability[CPUID_1_EDX] = edx;
 	}
 
+	/* Thermal and Power Management Leaf: level 0x00000006 (eax) */
+	if (c->cpuid_level >= 0x00000006)
+		c->x86_capability[CPUID_6_EAX] = cpuid_eax(0x00000006);
+
 	/* Additional Intel-defined flags: level 0x00000007 */
 	if (c->cpuid_level >= 0x00000007) {
 		cpuid_count(0x00000007, 0, &eax, &ebx, &ecx, &edx);
-
 		c->x86_capability[CPUID_7_0_EBX] = ebx;
-
-		c->x86_capability[CPUID_6_EAX] = cpuid_eax(0x00000006);
 		c->x86_capability[CPUID_7_ECX] = ecx;
 	}
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-20  9:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-15 18:14 [PATCH] x86/cpu: Probe CPUID leaf 6 even when cpuid_level == 6 Andy Lutomirski
2016-12-15 19:17 ` Borislav Petkov
2016-12-19 10:56 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
2016-12-20  7:05   ` H. Peter Anvin
2016-12-20  9:27     ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).