aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/intel.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/intel.c')
-rw-r--r--arch/x86/kernel/cpu/intel.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index cc8c501b9f39..d1c372b018db 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -11,6 +11,8 @@
11#include <asm/pgtable.h> 11#include <asm/pgtable.h>
12#include <asm/msr.h> 12#include <asm/msr.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/ptrace.h>
15#include <asm/ds.h>
14 16
15#include "cpu.h" 17#include "cpu.h"
16 18
@@ -27,13 +29,14 @@
27struct movsl_mask movsl_mask __read_mostly; 29struct movsl_mask movsl_mask __read_mostly;
28#endif 30#endif
29 31
30void __cpuinit early_intel_workaround(struct cpuinfo_x86 *c) 32void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
31{ 33{
32 if (c->x86_vendor != X86_VENDOR_INTEL)
33 return;
34 /* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */ 34 /* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */
35 if (c->x86 == 15 && c->x86_cache_alignment == 64) 35 if (c->x86 == 15 && c->x86_cache_alignment == 64)
36 c->x86_cache_alignment = 128; 36 c->x86_cache_alignment = 128;
37 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
38 (c->x86 == 0x6 && c->x86_model >= 0x0e))
39 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
37} 40}
38 41
39/* 42/*
@@ -113,6 +116,8 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
113 unsigned int l2 = 0; 116 unsigned int l2 = 0;
114 char *p = NULL; 117 char *p = NULL;
115 118
119 early_init_intel(c);
120
116#ifdef CONFIG_X86_F00F_BUG 121#ifdef CONFIG_X86_F00F_BUG
117 /* 122 /*
118 * All current models of Pentium and Pentium with MMX technology CPUs 123 * All current models of Pentium and Pentium with MMX technology CPUs
@@ -132,7 +137,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
132 } 137 }
133#endif 138#endif
134 139
135 select_idle_routine(c);
136 l2 = init_intel_cacheinfo(c); 140 l2 = init_intel_cacheinfo(c);
137 if (c->cpuid_level > 9 ) { 141 if (c->cpuid_level > 9 ) {
138 unsigned eax = cpuid_eax(10); 142 unsigned eax = cpuid_eax(10);
@@ -201,16 +205,13 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
201 } 205 }
202#endif 206#endif
203 207
208 if (cpu_has_xmm2)
209 set_bit(X86_FEATURE_LFENCE_RDTSC, c->x86_capability);
204 if (c->x86 == 15) { 210 if (c->x86 == 15) {
205 set_bit(X86_FEATURE_P4, c->x86_capability); 211 set_bit(X86_FEATURE_P4, c->x86_capability);
206 set_bit(X86_FEATURE_SYNC_RDTSC, c->x86_capability);
207 } 212 }
208 if (c->x86 == 6) 213 if (c->x86 == 6)
209 set_bit(X86_FEATURE_P3, c->x86_capability); 214 set_bit(X86_FEATURE_P3, c->x86_capability);
210 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
211 (c->x86 == 0x6 && c->x86_model >= 0x0e))
212 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
213
214 if (cpu_has_ds) { 215 if (cpu_has_ds) {
215 unsigned int l1; 216 unsigned int l1;
216 rdmsr(MSR_IA32_MISC_ENABLE, l1, l2); 217 rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
@@ -219,6 +220,9 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
219 if (!(l1 & (1<<12))) 220 if (!(l1 & (1<<12)))
220 set_bit(X86_FEATURE_PEBS, c->x86_capability); 221 set_bit(X86_FEATURE_PEBS, c->x86_capability);
221 } 222 }
223
224 if (cpu_has_bts)
225 ds_init_intel(c);
222} 226}
223 227
224static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 * c, unsigned int size) 228static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 * c, unsigned int size)
@@ -342,5 +346,22 @@ unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
342EXPORT_SYMBOL(cmpxchg_386_u32); 346EXPORT_SYMBOL(cmpxchg_386_u32);
343#endif 347#endif
344 348
349#ifndef CONFIG_X86_CMPXCHG64
350unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new)
351{
352 u64 prev;
353 unsigned long flags;
354
355 /* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */
356 local_irq_save(flags);
357 prev = *(u64 *)ptr;
358 if (prev == old)
359 *(u64 *)ptr = new;
360 local_irq_restore(flags);
361 return prev;
362}
363EXPORT_SYMBOL(cmpxchg_486_u64);
364#endif
365
345// arch_initcall(intel_cpu_init); 366// arch_initcall(intel_cpu_init);
346 367