[PATCH 1/10 -tip] x86: Add cpufeature for Processor Name

Jaswinder Singh Rajput
2009-05-12T15:46:48Z

Processor Name / Brand String (Function 8000_0002h, 8000_0003h, 8000_0004h)
Functions 8000_0002h, 8000_0003h, and 8000_0004h each return up to 16 ASCII
bytes of the processor name in the EAX, EBX, ECX and EDX registers.

X86_FEATURE_PNAME will be useful for displaying MSRs like AMD:
MSRC001_00[35:30] Processor Name String Registers

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
arch/x86/include/asm/cpufeature.h | 5 +++--
arch/x86/kernel/cpu/common.c | 10 ++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 13cc6a5..e1a4cc4 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -153,8 +153,9 @@
* Auxiliary flags: Linux defined - For features scattered in various
* CPUID levels like 0x6, 0xA etc
*/
-#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
-#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */
+#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
+#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */
+#define X86_FEATURE_PNAME (7*32+ 2) /* Processor Name */

/* Virtualization flags: Linux defined */
#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e7fd5c4..542684c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -563,6 +563,16 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
}
}

+ /*
+ * Processor Name / Brand String
+ * (Function 8000_0002h, 8000_0003h, 8000_0004h)
+ * Functions 8000_0002h, 8000_0003h, and 8000_0004h each return up to
+ * 16 ASCII bytes of the processor name in the EAX, EBX, ECX and EDX
+ * registers.
+ */
+ if (c->extended_cpuid_level >= 0x80000004)
+ set_cpu_cap(c, X86_FEATURE_PNAME);
+
if (c->extended_cpuid_level >= 0x80000008) {
u32 eax = cpuid_eax(0x80000008);

--
1.6.0.6