aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-07-07 20:29:18 -0400
committerH. Peter Anvin <hpa@zytor.com>2010-07-07 20:29:18 -0400
commitbdc802dcca1709b01988d57e91f9f35ce1609fcc (patch)
treec0f933ee09e214dd98d789243aa0914a5d9a821f
parent24da9c26f3050aee9314ec09930a24c80fe76352 (diff)
x86, cpu: Support the features flags in new CPUID leaf 7
Intel has defined CPUID leaf 7 as the next set of feature flags (see the AVX specification, version 007). Add support for this new feature flags word. Signed-off-by: H. Peter Anvin <hpa@zytor.com> LKML-Reference: <tip-*@vger.kernel.org>
-rw-r--r--arch/x86/include/asm/cpufeature.h13
-rw-r--r--arch/x86/include/asm/required-features.h2
-rw-r--r--arch/x86/kernel/cpu/common.c10
3 files changed, 21 insertions, 4 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index aeb6f3f9b2ca..3ec9275cea46 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -6,7 +6,7 @@
6 6
7#include <asm/required-features.h> 7#include <asm/required-features.h>
8 8
9#define NCAPINTS 9 /* N 32-bit words worth of info */ 9#define NCAPINTS 10 /* N 32-bit words worth of info */
10 10
11/* 11/*
12 * Note: If the comment begins with a quoted string, that string is used 12 * Note: If the comment begins with a quoted string, that string is used
@@ -159,14 +159,14 @@
159 159
160/* 160/*
161 * Auxiliary flags: Linux defined - For features scattered in various 161 * Auxiliary flags: Linux defined - For features scattered in various
162 * CPUID levels like 0x6, 0xA etc 162 * CPUID levels like 0x6, 0xA etc, word 7
163 */ 163 */
164#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ 164#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
165#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ 165#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */
166#define X86_FEATURE_CPB (7*32+ 2) /* AMD Core Performance Boost */ 166#define X86_FEATURE_CPB (7*32+ 2) /* AMD Core Performance Boost */
167#define X86_FEATURE_EPB (7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */ 167#define X86_FEATURE_EPB (7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
168 168
169/* Virtualization flags: Linux defined */ 169/* Virtualization flags: Linux defined, word 8 */
170#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ 170#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
171#define X86_FEATURE_VNMI (8*32+ 1) /* Intel Virtual NMI */ 171#define X86_FEATURE_VNMI (8*32+ 1) /* Intel Virtual NMI */
172#define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */ 172#define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */
@@ -177,6 +177,9 @@
177#define X86_FEATURE_SVML (8*32+7) /* "svm_lock" AMD SVM locking MSR */ 177#define X86_FEATURE_SVML (8*32+7) /* "svm_lock" AMD SVM locking MSR */
178#define X86_FEATURE_NRIPS (8*32+8) /* "nrip_save" AMD SVM next_rip save */ 178#define X86_FEATURE_NRIPS (8*32+8) /* "nrip_save" AMD SVM next_rip save */
179 179
180/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
181#define X86_FEATURE_FSGSBASE (9*32+0) /* {RD/WR}{FS/GS}BASE instructions*/
182
180#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 183#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
181 184
182#include <asm/asm.h> 185#include <asm/asm.h>
@@ -197,7 +200,9 @@ extern const char * const x86_power_flags[32];
197 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \ 200 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
198 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \ 201 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
199 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \ 202 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
200 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \ 203 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) || \
204 (((bit)>>5)==8 && (1UL<<((bit)&31) & REQUIRED_MASK8)) || \
205 (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) ) \
201 ? 1 : \ 206 ? 1 : \
202 test_cpu_cap(c, bit)) 207 test_cpu_cap(c, bit))
203 208
diff --git a/arch/x86/include/asm/required-features.h b/arch/x86/include/asm/required-features.h
index 64cf2d24fad1..6c7fc25f2c34 100644
--- a/arch/x86/include/asm/required-features.h
+++ b/arch/x86/include/asm/required-features.h
@@ -84,5 +84,7 @@
84#define REQUIRED_MASK5 0 84#define REQUIRED_MASK5 0
85#define REQUIRED_MASK6 0 85#define REQUIRED_MASK6 0
86#define REQUIRED_MASK7 0 86#define REQUIRED_MASK7 0
87#define REQUIRED_MASK8 0
88#define REQUIRED_MASK9 0
87 89
88#endif /* _ASM_X86_REQUIRED_FEATURES_H */ 90#endif /* _ASM_X86_REQUIRED_FEATURES_H */
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 68e4a6f2211e..c7358303d8cd 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -551,6 +551,16 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
551 c->x86_capability[4] = excap; 551 c->x86_capability[4] = excap;
552 } 552 }
553 553
554 /* Additional Intel-defined flags: level 0x00000007 */
555 if (c->cpuid_level >= 0x00000007) {
556 u32 eax, ebx, ecx, edx;
557
558 cpuid_count(0x00000007, 0, &eax, &ebx, &ecx, &edx);
559
560 if (eax > 0)
561 c->x86_capability[9] = ebx;
562 }
563
554 /* AMD-defined flags: level 0x80000001 */ 564 /* AMD-defined flags: level 0x80000001 */
555 xlvl = cpuid_eax(0x80000000); 565 xlvl = cpuid_eax(0x80000000);
556 c->extended_cpuid_level = xlvl; 566 c->extended_cpuid_level = xlvl;