]> err.no Git - linux-2.6/commitdiff
x86: convert TSC disabling to generic cpuid disable bitmap
authorAndi Kleen <ak@suse.de>
Wed, 30 Jan 2008 12:33:20 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:20 +0000 (13:33 +0100)
Fix from: Ian Campbell <ijc@hellion.org.uk>

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/numaq_32.c
arch/x86/kernel/tsc_32.c
arch/x86/mach-voyager/setup.c
arch/x86/xen/time.c
include/asm-x86/cpufeature.h
include/asm-x86/tsc.h

index a96abd453e0dd3e4610f3addf918e14541b9d76a..9b95edcfc6ae23696fc7566087adc601afa6f388 100644 (file)
@@ -154,7 +154,7 @@ static void __init check_config(void)
  * If we configured ourselves for a TSC, we'd better have one!
  */
 #ifdef CONFIG_X86_TSC
-       if (!cpu_has_tsc && !tsc_disable)
+       if (!cpu_has_tsc)
                panic("Kernel compiled for Pentium+, requires TSC feature!");
 #endif
 
index c66991a04a8a369f889f824d27e6733ba0be45c8..dfc9563fc4f02cd510412c8ff4b3e8d678ee1798 100644 (file)
@@ -446,10 +446,6 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
         * we do "generic changes."
         */
 
-       /* TSC disabled? */
-       if ( tsc_disable )
-               clear_bit(X86_FEATURE_TSC, c->x86_capability);
-
        /* If the model name is still unset, do table lookup. */
        if ( !c->x86_model_id[0] ) {
                char *p;
@@ -650,11 +646,6 @@ void __cpuinit cpu_init(void)
 
        if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
                clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
-       if (tsc_disable && cpu_has_tsc) {
-               printk(KERN_NOTICE "Disabling TSC...\n");
-               /**** FIX-HPA: DOES THIS REALLY BELONG HERE? ****/
-               clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability);
-       }
 
        load_idt(&idt_descr);
        switch_to_new_gdt();
index 9000d82c6dc0a784de020d1723ae75522bee9082..e65281b1634b790bd151c479fc96f3846febe87d 100644 (file)
@@ -82,7 +82,7 @@ static int __init numaq_tsc_disable(void)
 {
        if (num_online_nodes() > 1) {
                printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
-               tsc_disable = 1;
+               setup_clear_cpu_cap(X86_FEATURE_TSC);
        }
        return 0;
 }
index 2a7b95bd850956e354d123c499e85f26c3ee57f5..43517e324be83e73096fe28a39ec5275c9a378e0 100644 (file)
@@ -24,8 +24,6 @@ static int tsc_enabled;
 unsigned int tsc_khz;
 EXPORT_SYMBOL_GPL(tsc_khz);
 
-int tsc_disable;
-
 #ifdef CONFIG_X86_TSC
 static int __init tsc_setup(char *str)
 {
@@ -40,8 +38,7 @@ static int __init tsc_setup(char *str)
  */
 static int __init tsc_setup(char *str)
 {
-       tsc_disable = 1;
-
+       setup_clear_cpu_cap(X86_FEATURE_TSC);
        return 1;
 }
 #endif
@@ -395,7 +392,7 @@ void __init tsc_init(void)
 {
        int cpu;
 
-       if (!cpu_has_tsc || tsc_disable)
+       if (!cpu_has_tsc)
                goto out_no_tsc;
 
        cpu_khz = calculate_cpu_khz();
@@ -439,10 +436,5 @@ void __init tsc_init(void)
        return;
 
 out_no_tsc:
-       /*
-        * Set the tsc_disable flag if there's no TSC support, this
-        * makes it a fast flag for the kernel to see whether it
-        * should be using the TSC.
-        */
-       tsc_disable = 1;
+       setup_clear_cpu_cap(X86_FEATURE_TSC);
 }
index 81257a861984306584544912f8530b1b6832fcf9..5ae5466b9eb9c3b9850fca6617e36dab2c653da7 100644 (file)
@@ -37,7 +37,7 @@ void __init pre_setup_arch_hook(void)
 {
        /* Voyagers run their CPUs from independent clocks, so disable
         * the TSC code because we can't sync them */
-       tsc_disable = 1;
+       setup_clear_cpu_cap(X86_FEATURE_TSC);
 }
 
 void __init trap_init_hook(void)
index d083ff5ef088eba01ddebb86cabccf4fa9a4202b..b3721fd6877b1ea03f1d22cc12c5c1a8566ef04a 100644 (file)
@@ -592,7 +592,7 @@ __init void xen_time_init(void)
        set_normalized_timespec(&wall_to_monotonic,
                                -xtime.tv_sec, -xtime.tv_nsec);
 
-       tsc_disable = 0;
+       setup_force_cpu_cap(X86_FEATURE_TSC);
 
        xen_setup_timer(cpu);
        xen_setup_cpu_clockevents();
index b8f53f869e1f0c3152df94032048597c3127c0f5..3fb7dfa7fc915b66f827c722ec31efc70cd63810 100644 (file)
        clear_cpu_cap(&boot_cpu_data, bit);     \
        set_bit(bit, cleared_cpu_caps);         \
 } while (0)
+#define setup_force_cpu_cap(bit) do { \
+       set_cpu_cap(&boot_cpu_data, bit);       \
+       clear_bit(bit, cleared_cpu_caps);       \
+} while (0)
 
 #define cpu_has_fpu            boot_cpu_has(X86_FEATURE_FPU)
 #define cpu_has_vme            boot_cpu_has(X86_FEATURE_VME)
index 071e0ce5b664dd9ae428b056860b020f1b39eb15..a6e8d35c3f86775e0c8ef24acd781e795234cf9c 100644 (file)
@@ -16,8 +16,6 @@ typedef unsigned long long cycles_t;
 
 extern unsigned int cpu_khz;
 extern unsigned int tsc_khz;
-/* flag for disabling the tsc */
-extern int tsc_disable;
 
 extern void disable_TSC(void);