aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2008-01-30 07:32:37 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:37 -0500
commit707fa8ed923b1b6a3d7af0d386b0b3abad28ed19 (patch)
tree181c7fe62e4c392486a06380df4da870bfaa40bf
parentde4218634e3df6d73a3e6cdfdf3a17fa3bc7e013 (diff)
x86: Implement support to synchronize RDTSC with LFENCE on Intel CPUs
According to Intel RDTSC can be always synchronized with LFENCE on all current CPUs. Implement the necessary CPUID bit for that. It is unclear yet if that is true for all future CPUs too, but if there's another way the kernel can be always updated. Cc: asit.k.mallick@intel.com Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/cpu/intel.c3
-rw-r--r--arch/x86/kernel/setup_64.c5
-rw-r--r--include/asm-x86/cpufeature.h1
3 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index e4b7e73e9024..0a4abdb61ae4 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -203,9 +203,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
203 } 203 }
204#endif 204#endif
205 205
206 if (cpu_has_xmm)
207 set_bit(X86_FEATURE_LFENCE_RDTSC, c->x86_capability);
206 if (c->x86 == 15) { 208 if (c->x86 == 15) {
207 set_bit(X86_FEATURE_P4, c->x86_capability); 209 set_bit(X86_FEATURE_P4, c->x86_capability);
208 set_bit(X86_FEATURE_SYNC_RDTSC, c->x86_capability);
209 } 210 }
210 if (c->x86 == 6) 211 if (c->x86 == 6)
211 set_bit(X86_FEATURE_P3, c->x86_capability); 212 set_bit(X86_FEATURE_P3, c->x86_capability);
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 2139aa6ac469..bc7758ea06af 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -888,10 +888,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
888 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); 888 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
889 if (c->x86 == 6) 889 if (c->x86 == 6)
890 set_cpu_cap(c, X86_FEATURE_REP_GOOD); 890 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
891 if (c->x86 == 15) 891 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
892 set_cpu_cap(c, X86_FEATURE_SYNC_RDTSC);
893 else
894 clear_cpu_cap(c, X86_FEATURE_SYNC_RDTSC);
895 c->x86_max_cores = intel_num_cpu_cores(c); 892 c->x86_max_cores = intel_num_cpu_cores(c);
896 893
897 srat_detect_node(); 894 srat_detect_node();
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
index 7d53eea8b946..c1a7e07859c8 100644
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -80,6 +80,7 @@
80#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */ 80#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
81#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */ 81#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
82#define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */ 82#define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */
83#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
83 84
84/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 85/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
85#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 86#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */