aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-07-11 15:18:29 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 13:55:54 -0400
commitec481536b15eb0520d8f0204b0294480050fe1f8 (patch)
tree3f959a26ca58477734ea1e4d5370b2d3a33a1680 /arch/x86_64
parentf8c09377d754f35a135454181b869ab527cc0757 (diff)
Unify the CPU features vectors between i386 and x86-64
Unify the handling of the CPU features vectors between i386 and x86-64. This also adopts the collapsing of features which are required at compile-time into constant tests from x86-64 to i386. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/setup.c13
-rw-r--r--arch/x86_64/kernel/verify_cpu.S22
2 files changed, 11 insertions, 24 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index eb6524f3ac29..dc7630d06460 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -931,7 +931,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
931 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", 931 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
932 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", 932 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
933 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", 933 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
934 "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL, 934 "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
935 935
936 /* AMD-defined */ 936 /* AMD-defined */
937 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 937 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -947,10 +947,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
947 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 947 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
948 948
949 /* Other (Linux-defined) */ 949 /* Other (Linux-defined) */
950 "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, 950 "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
951 "constant_tsc", NULL, NULL, 951 NULL, NULL, NULL, NULL,
952 "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 952 "constant_tsc", "up", NULL, "arch_perfmon",
953 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 953 "pebs", "bts", NULL, "sync_rdtsc",
954 "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
954 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 955 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
955 956
956 /* Intel-defined (#2) */ 957 /* Intel-defined (#2) */
@@ -961,7 +962,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
961 962
962 /* VIA/Cyrix/Centaur-defined */ 963 /* VIA/Cyrix/Centaur-defined */
963 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", 964 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
964 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 965 "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
965 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 966 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
966 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 967 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
967 968
diff --git a/arch/x86_64/kernel/verify_cpu.S b/arch/x86_64/kernel/verify_cpu.S
index e035f5948199..45b6f8a975a1 100644
--- a/arch/x86_64/kernel/verify_cpu.S
+++ b/arch/x86_64/kernel/verify_cpu.S
@@ -37,20 +37,6 @@ verify_cpu:
37 pushl $0 # Kill any dangerous flags 37 pushl $0 # Kill any dangerous flags
38 popfl 38 popfl
39 39
40 /* minimum CPUID flags for x86-64 as defined by AMD */
41#define M(x) (1<<(x))
42#define M2(a,b) M(a)|M(b)
43#define M4(a,b,c,d) M(a)|M(b)|M(c)|M(d)
44
45#define SSE_MASK \
46 (M2(X86_FEATURE_XMM,X86_FEATURE_XMM2))
47#define REQUIRED_MASK1 \
48 (M4(X86_FEATURE_FPU,X86_FEATURE_PSE,X86_FEATURE_TSC,X86_FEATURE_MSR)|\
49 M4(X86_FEATURE_PAE,X86_FEATURE_CX8,X86_FEATURE_PGE,X86_FEATURE_CMOV)|\
50 M(X86_FEATURE_FXSR))
51#define REQUIRED_MASK2 \
52 (M(X86_FEATURE_LM - 32))
53
54 pushfl # standard way to check for cpuid 40 pushfl # standard way to check for cpuid
55 popl %eax 41 popl %eax
56 movl %eax,%ebx 42 movl %eax,%ebx
@@ -79,8 +65,8 @@ verify_cpu:
79verify_cpu_noamd: 65verify_cpu_noamd:
80 movl $0x1,%eax # Does the cpu have what it takes 66 movl $0x1,%eax # Does the cpu have what it takes
81 cpuid 67 cpuid
82 andl $REQUIRED_MASK1,%edx 68 andl $REQUIRED_MASK0,%edx
83 xorl $REQUIRED_MASK1,%edx 69 xorl $REQUIRED_MASK0,%edx
84 jnz verify_cpu_no_longmode 70 jnz verify_cpu_no_longmode
85 71
86 movl $0x80000000,%eax # See if extended cpuid is implemented 72 movl $0x80000000,%eax # See if extended cpuid is implemented
@@ -90,8 +76,8 @@ verify_cpu_noamd:
90 76
91 movl $0x80000001,%eax # Does the cpu have what it takes 77 movl $0x80000001,%eax # Does the cpu have what it takes
92 cpuid 78 cpuid
93 andl $REQUIRED_MASK2,%edx 79 andl $REQUIRED_MASK1,%edx
94 xorl $REQUIRED_MASK2,%edx 80 xorl $REQUIRED_MASK1,%edx
95 jnz verify_cpu_no_longmode 81 jnz verify_cpu_no_longmode
96 82
97verify_cpu_sse_test: 83verify_cpu_sse_test: