aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/cpu/Makefile2
-rw-r--r--arch/i386/kernel/cpu/addon_cpuid_features.c50
-rw-r--r--arch/i386/kernel/cpu/common.c2
-rw-r--r--arch/i386/kernel/cpu/proc.c6
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/setup.c8
-rw-r--r--include/asm-i386/cpufeature.h11
-rw-r--r--include/asm-i386/processor.h1
-rw-r--r--include/asm-i386/required-features.h1
-rw-r--r--include/asm-x86_64/processor.h1
-rw-r--r--include/asm-x86_64/required-features.h1
11 files changed, 82 insertions, 3 deletions
diff --git a/arch/i386/kernel/cpu/Makefile b/arch/i386/kernel/cpu/Makefile
index 74f27a463db0..0b6a8551e9e2 100644
--- a/arch/i386/kernel/cpu/Makefile
+++ b/arch/i386/kernel/cpu/Makefile
@@ -8,7 +8,7 @@ obj-y += amd.o
8obj-y += cyrix.o 8obj-y += cyrix.o
9obj-y += centaur.o 9obj-y += centaur.o
10obj-y += transmeta.o 10obj-y += transmeta.o
11obj-y += intel.o intel_cacheinfo.o 11obj-y += intel.o intel_cacheinfo.o addon_cpuid_features.o
12obj-y += rise.o 12obj-y += rise.o
13obj-y += nexgen.o 13obj-y += nexgen.o
14obj-y += umc.o 14obj-y += umc.o
diff --git a/arch/i386/kernel/cpu/addon_cpuid_features.c b/arch/i386/kernel/cpu/addon_cpuid_features.c
new file mode 100644
index 000000000000..3e91d3ee26ec
--- /dev/null
+++ b/arch/i386/kernel/cpu/addon_cpuid_features.c
@@ -0,0 +1,50 @@
1
2/*
3 * Routines to indentify additional cpu features that are scattered in
4 * cpuid space.
5 */
6
7#include <linux/cpu.h>
8
9#include <asm/processor.h>
10
11struct cpuid_bit {
12 u16 feature;
13 u8 reg;
14 u8 bit;
15 u32 level;
16};
17
18enum cpuid_regs {
19 CR_EAX = 0,
20 CR_ECX,
21 CR_EDX,
22 CR_EBX
23};
24
25void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
26{
27 u32 max_level;
28 u32 regs[4];
29 const struct cpuid_bit *cb;
30
31 static const struct cpuid_bit cpuid_bits[] = {
32 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
33 { 0, 0, 0, 0 }
34 };
35
36 for (cb = cpuid_bits; cb->feature; cb++) {
37
38 /* Verify that the level is valid */
39 max_level = cpuid_eax(cb->level & 0xffff0000);
40 if (max_level < cb->level ||
41 max_level > (cb->level | 0xffff))
42 continue;
43
44 cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
45 &regs[CR_ECX], &regs[CR_EDX]);
46
47 if (regs[cb->reg] & (1 << cb->bit))
48 set_bit(cb->feature, c->x86_capability);
49 }
50}
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 794d593c47eb..e5419a9dec88 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -353,6 +353,8 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 * c)
353 if ( xlvl >= 0x80000004 ) 353 if ( xlvl >= 0x80000004 )
354 get_model_name(c); /* Default name */ 354 get_model_name(c); /* Default name */
355 } 355 }
356
357 init_scattered_cpuid_features(c);
356 } 358 }
357 359
358 early_intel_workaround(c); 360 early_intel_workaround(c);
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c
index ed73091d3dd0..1e31b6caffb1 100644
--- a/arch/i386/kernel/cpu/proc.c
+++ b/arch/i386/kernel/cpu/proc.c
@@ -65,6 +65,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
65 "osvw", "ibs", NULL, NULL, NULL, NULL, 65 "osvw", "ibs", NULL, NULL, NULL, NULL,
66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
68
69 /* Auxiliary (Linux-defined) */
70 "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
71 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
72 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
73 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
68 }; 74 };
69 static const char * const x86_power_flags[] = { 75 static const char * const x86_power_flags[] = {
70 "ts", /* temperature sensor */ 76 "ts", /* temperature sensor */
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index de1de8a2fd84..47f1dc30bf56 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_PCI) += early-quirks.o
44 44
45obj-y += topology.o 45obj-y += topology.o
46obj-y += intel_cacheinfo.o 46obj-y += intel_cacheinfo.o
47obj-y += addon_cpuid_features.o
47obj-y += pcspeaker.o 48obj-y += pcspeaker.o
48 49
49CFLAGS_vsyscall.o := $(PROFILING) -g0 50CFLAGS_vsyscall.o := $(PROFILING) -g0
@@ -55,6 +56,7 @@ cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
55topology-y += ../../i386/kernel/topology.o 56topology-y += ../../i386/kernel/topology.o
56microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 57microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
57intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o 58intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
59addon_cpuid_features-y += ../../i386/kernel/cpu/addon_cpuid_features.o
58quirks-y += ../../i386/kernel/quirks.o 60quirks-y += ../../i386/kernel/quirks.o
59i8237-y += ../../i386/kernel/i8237.o 61i8237-y += ../../i386/kernel/i8237.o
60msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 62msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index dc7630d06460..33ef718f8cb5 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -846,6 +846,8 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
846 c->x86_capability[2] = cpuid_edx(0x80860001); 846 c->x86_capability[2] = cpuid_edx(0x80860001);
847 } 847 }
848 848
849 init_scattered_cpuid_features(c);
850
849 c->apicid = phys_pkg_id(0); 851 c->apicid = phys_pkg_id(0);
850 852
851 /* 853 /*
@@ -973,6 +975,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
973 "osvw", "ibs", NULL, NULL, NULL, NULL, 975 "osvw", "ibs", NULL, NULL, NULL, NULL,
974 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 976 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
975 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 977 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
978
979 /* Auxiliary (Linux-defined) */
980 "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
981 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
982 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
983 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
976 }; 984 };
977 static char *x86_power_flags[] = { 985 static char *x86_power_flags[] = {
978 "ts", /* temperature sensor */ 986 "ts", /* temperature sensor */
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 7ea5f4a6706f..c961c03cf1e2 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -12,7 +12,7 @@
12#endif 12#endif
13#include <asm/required-features.h> 13#include <asm/required-features.h>
14 14
15#define NCAPINTS 7 /* N 32-bit words worth of info */ 15#define NCAPINTS 8 /* N 32-bit words worth of info */
16 16
17/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ 17/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
18#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ 18#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
@@ -109,6 +109,12 @@
109#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */ 109#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
110#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */ 110#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
111 111
112/*
113 * Auxiliary flags: Linux defined - For features scattered in various
114 * CPUID levels like 0x6, 0xA etc
115 */
116#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
117
112#define cpu_has(c, bit) \ 118#define cpu_has(c, bit) \
113 (__builtin_constant_p(bit) && \ 119 (__builtin_constant_p(bit) && \
114 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ 120 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
@@ -117,7 +123,8 @@
117 (((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \ 123 (((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \
118 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \ 124 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
119 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \ 125 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
120 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) ) \ 126 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
127 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
121 ? 1 : \ 128 ? 1 : \
122 test_bit(bit, (c)->x86_capability)) 129 test_bit(bit, (c)->x86_capability))
123#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) 130#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 338668bfb0a2..94e0c147c165 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -119,6 +119,7 @@ void __init cpu_detect(struct cpuinfo_x86 *c);
119extern void identify_boot_cpu(void); 119extern void identify_boot_cpu(void);
120extern void identify_secondary_cpu(struct cpuinfo_x86 *); 120extern void identify_secondary_cpu(struct cpuinfo_x86 *);
121extern void print_cpu_info(struct cpuinfo_x86 *); 121extern void print_cpu_info(struct cpuinfo_x86 *);
122extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
122extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 123extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
123extern unsigned short num_cache_leaves; 124extern unsigned short num_cache_leaves;
124 125
diff --git a/include/asm-i386/required-features.h b/include/asm-i386/required-features.h
index a9c3b1147bd0..65848a007050 100644
--- a/include/asm-i386/required-features.h
+++ b/include/asm-i386/required-features.h
@@ -50,5 +50,6 @@
50#define REQUIRED_MASK4 0 50#define REQUIRED_MASK4 0
51#define REQUIRED_MASK5 0 51#define REQUIRED_MASK5 0
52#define REQUIRED_MASK6 0 52#define REQUIRED_MASK6 0
53#define REQUIRED_MASK7 0
53 54
54#endif 55#endif
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index df6457248d62..efc87a5aff7f 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -100,6 +100,7 @@ extern char ignore_irq13;
100 100
101extern void identify_cpu(struct cpuinfo_x86 *); 101extern void identify_cpu(struct cpuinfo_x86 *);
102extern void print_cpu_info(struct cpuinfo_x86 *); 102extern void print_cpu_info(struct cpuinfo_x86 *);
103extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
103extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 104extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
104extern unsigned short num_cache_leaves; 105extern unsigned short num_cache_leaves;
105 106
diff --git a/include/asm-x86_64/required-features.h b/include/asm-x86_64/required-features.h
index 262f3159d032..e80d5761b00a 100644
--- a/include/asm-x86_64/required-features.h
+++ b/include/asm-x86_64/required-features.h
@@ -41,5 +41,6 @@
41#define REQUIRED_MASK4 0 41#define REQUIRED_MASK4 0
42#define REQUIRED_MASK5 0 42#define REQUIRED_MASK5 0
43#define REQUIRED_MASK6 0 43#define REQUIRED_MASK6 0
44#define REQUIRED_MASK7 0
44 45
45#endif 46#endif