diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-03-08 03:46:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-08 11:22:56 -0400 |
commit | 1f442d70c84aa798e243e721eba728a98434cd86 (patch) | |
tree | b9797ff67b07415816438df8c9ddd4f7842283bb /arch/x86/kernel/cpu | |
parent | 31bbed527e7039203920c51c9fb48c27aed0820c (diff) |
x86: remove smp_apply_quirks()/smp_checks()
Impact: cleanup and code size reduction on 64-bit
This code is only applied to Intel Pentium and AMD K7 32-bit cpus.
Move those checks to intel_init()/amd_init() for 32-bit
so 64-bit will not build this code.
Also change to use cpu_index check to see if we need to emit warning.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <49B377D2.8030108@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 52 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel.c | 25 |
2 files changed, 77 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 25423a5b80ed..f47df59016c5 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <asm/io.h> | 5 | #include <asm/io.h> |
6 | #include <asm/processor.h> | 6 | #include <asm/processor.h> |
7 | #include <asm/apic.h> | 7 | #include <asm/apic.h> |
8 | #include <asm/cpu.h> | ||
8 | 9 | ||
9 | #ifdef CONFIG_X86_64 | 10 | #ifdef CONFIG_X86_64 |
10 | # include <asm/numa_64.h> | 11 | # include <asm/numa_64.h> |
@@ -141,6 +142,55 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) | |||
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ||
145 | static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) | ||
146 | { | ||
147 | #ifdef CONFIG_SMP | ||
148 | /* calling is from identify_secondary_cpu() ? */ | ||
149 | if (c->cpu_index == boot_cpu_id) | ||
150 | return; | ||
151 | |||
152 | /* | ||
153 | * Certain Athlons might work (for various values of 'work') in SMP | ||
154 | * but they are not certified as MP capable. | ||
155 | */ | ||
156 | /* Athlon 660/661 is valid. */ | ||
157 | if ((c->x86_model == 6) && ((c->x86_mask == 0) || | ||
158 | (c->x86_mask == 1))) | ||
159 | goto valid_k7; | ||
160 | |||
161 | /* Duron 670 is valid */ | ||
162 | if ((c->x86_model == 7) && (c->x86_mask == 0)) | ||
163 | goto valid_k7; | ||
164 | |||
165 | /* | ||
166 | * Athlon 662, Duron 671, and Athlon >model 7 have capability | ||
167 | * bit. It's worth noting that the A5 stepping (662) of some | ||
168 | * Athlon XP's have the MP bit set. | ||
169 | * See http://www.heise.de/newsticker/data/jow-18.10.01-000 for | ||
170 | * more. | ||
171 | */ | ||
172 | if (((c->x86_model == 6) && (c->x86_mask >= 2)) || | ||
173 | ((c->x86_model == 7) && (c->x86_mask >= 1)) || | ||
174 | (c->x86_model > 7)) | ||
175 | if (cpu_has_mp) | ||
176 | goto valid_k7; | ||
177 | |||
178 | /* If we get here, not a certified SMP capable AMD system. */ | ||
179 | |||
180 | /* | ||
181 | * Don't taint if we are running SMP kernel on a single non-MP | ||
182 | * approved Athlon | ||
183 | */ | ||
184 | WARN_ONCE(1, "WARNING: This combination of AMD" | ||
185 | "processors is not suitable for SMP.\n"); | ||
186 | if (!test_taint(TAINT_UNSAFE_SMP)) | ||
187 | add_taint(TAINT_UNSAFE_SMP); | ||
188 | |||
189 | valid_k7: | ||
190 | ; | ||
191 | #endif | ||
192 | } | ||
193 | |||
144 | static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) | 194 | static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) |
145 | { | 195 | { |
146 | u32 l, h; | 196 | u32 l, h; |
@@ -175,6 +225,8 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) | |||
175 | } | 225 | } |
176 | 226 | ||
177 | set_cpu_cap(c, X86_FEATURE_K7); | 227 | set_cpu_cap(c, X86_FEATURE_K7); |
228 | |||
229 | amd_k7_smp_check(c); | ||
178 | } | 230 | } |
179 | #endif | 231 | #endif |
180 | 232 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 25c559ba8d54..191117f1ad51 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | #include <asm/ds.h> | 14 | #include <asm/ds.h> |
15 | #include <asm/bugs.h> | 15 | #include <asm/bugs.h> |
16 | #include <asm/cpu.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_X86_64 | 18 | #ifdef CONFIG_X86_64 |
18 | #include <asm/topology.h> | 19 | #include <asm/topology.h> |
@@ -110,6 +111,28 @@ static void __cpuinit trap_init_f00f_bug(void) | |||
110 | } | 111 | } |
111 | #endif | 112 | #endif |
112 | 113 | ||
114 | static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) | ||
115 | { | ||
116 | #ifdef CONFIG_SMP | ||
117 | /* calling is from identify_secondary_cpu() ? */ | ||
118 | if (c->cpu_index == boot_cpu_id) | ||
119 | return; | ||
120 | |||
121 | /* | ||
122 | * Mask B, Pentium, but not Pentium MMX | ||
123 | */ | ||
124 | if (c->x86 == 5 && | ||
125 | c->x86_mask >= 1 && c->x86_mask <= 4 && | ||
126 | c->x86_model <= 3) { | ||
127 | /* | ||
128 | * Remember we have B step Pentia with bugs | ||
129 | */ | ||
130 | WARN_ONCE(1, "WARNING: SMP operation may be unreliable" | ||
131 | "with B stepping processors.\n"); | ||
132 | } | ||
133 | #endif | ||
134 | } | ||
135 | |||
113 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) | 136 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) |
114 | { | 137 | { |
115 | unsigned long lo, hi; | 138 | unsigned long lo, hi; |
@@ -186,6 +209,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) | |||
186 | #ifdef CONFIG_X86_NUMAQ | 209 | #ifdef CONFIG_X86_NUMAQ |
187 | numaq_tsc_disable(); | 210 | numaq_tsc_disable(); |
188 | #endif | 211 | #endif |
212 | |||
213 | intel_smp_check(c); | ||
189 | } | 214 | } |
190 | #else | 215 | #else |
191 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) | 216 | static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) |