Skip to content

Commit 404ee5b

Browse files
Andi KleenIngo Molnar
authored andcommitted
x86: convert TSC disabling to generic cpuid disable bitmap
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>
1 parent 8424950 commit 404ee5b

8 files changed

Lines changed: 11 additions & 26 deletions

File tree

‎arch/x86/kernel/cpu/bugs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void __init check_config(void)
154154
* If we configured ourselves for a TSC, we'd better have one!
155155
*/
156156
#ifdef CONFIG_X86_TSC
157-
if (!cpu_has_tsc && !tsc_disable)
157+
if (!cpu_has_tsc)
158158
panic("Kernel compiled for Pentium+, requires TSC feature!");
159159
#endif
160160

‎arch/x86/kernel/cpu/common.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,6 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
446446
* we do "generic changes."
447447
*/
448448

449-
/* TSC disabled? */
450-
if ( tsc_disable )
451-
clear_bit(X86_FEATURE_TSC, c->x86_capability);
452-
453449
/* If the model name is still unset, do table lookup. */
454450
if ( !c->x86_model_id[0] ) {
455451
char *p;
@@ -650,11 +646,6 @@ void __cpuinit cpu_init(void)
650646

651647
if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
652648
clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
653-
if (tsc_disable && cpu_has_tsc) {
654-
printk(KERN_NOTICE "Disabling TSC...\n");
655-
/**** FIX-HPA: DOES THIS REALLY BELONG HERE? ****/
656-
clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability);
657-
}
658649

659650
load_idt(&idt_descr);
660651
switch_to_new_gdt();

‎arch/x86/kernel/numaq_32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static int __init numaq_tsc_disable(void)
8282
{
8383
if (num_online_nodes() > 1) {
8484
printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
85-
tsc_disable = 1;
85+
setup_clear_cpu_cap(X86_FEATURE_TSC);
8686
}
8787
return 0;
8888
}

‎arch/x86/kernel/tsc_32.c‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ static int tsc_enabled;
2424
unsigned int tsc_khz;
2525
EXPORT_SYMBOL_GPL(tsc_khz);
2626

27-
int tsc_disable;
28-
2927
#ifdef CONFIG_X86_TSC
3028
static int __init tsc_setup(char *str)
3129
{
@@ -40,8 +38,7 @@ static int __init tsc_setup(char *str)
4038
*/
4139
static int __init tsc_setup(char *str)
4240
{
43-
tsc_disable = 1;
44-
41+
setup_clear_cpu_cap(X86_FEATURE_TSC);
4542
return 1;
4643
}
4744
#endif
@@ -395,7 +392,7 @@ void __init tsc_init(void)
395392
{
396393
int cpu;
397394

398-
if (!cpu_has_tsc || tsc_disable)
395+
if (!cpu_has_tsc)
399396
goto out_no_tsc;
400397

401398
cpu_khz = calculate_cpu_khz();
@@ -439,10 +436,5 @@ void __init tsc_init(void)
439436
return;
440437

441438
out_no_tsc:
442-
/*
443-
* Set the tsc_disable flag if there's no TSC support, this
444-
* makes it a fast flag for the kernel to see whether it
445-
* should be using the TSC.
446-
*/
447-
tsc_disable = 1;
439+
setup_clear_cpu_cap(X86_FEATURE_TSC);
448440
}

‎arch/x86/mach-voyager/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void __init pre_setup_arch_hook(void)
3737
{
3838
/* Voyagers run their CPUs from independent clocks, so disable
3939
* the TSC code because we can't sync them */
40-
tsc_disable = 1;
40+
setup_clear_cpu_cap(X86_FEATURE_TSC);
4141
}
4242

4343
void __init trap_init_hook(void)

‎arch/x86/xen/time.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ __init void xen_time_init(void)
592592
set_normalized_timespec(&wall_to_monotonic,
593593
-xtime.tv_sec, -xtime.tv_nsec);
594594

595-
tsc_disable = 0;
595+
setup_force_cpu_cap(X86_FEATURE_TSC);
596596

597597
xen_setup_timer(cpu);
598598
xen_setup_cpu_clockevents();

‎include/asm-x86/cpufeature.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@
135135
clear_cpu_cap(&boot_cpu_data, bit); \
136136
set_bit(bit, cleared_cpu_caps); \
137137
} while (0)
138+
#define setup_force_cpu_cap(bit) do { \
139+
set_cpu_cap(&boot_cpu_data, bit); \
140+
clear_bit(bit, cleared_cpu_caps); \
141+
} while (0)
138142

139143
#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
140144
#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)

‎include/asm-x86/tsc.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ typedef unsigned long long cycles_t;
1616

1717
extern unsigned int cpu_khz;
1818
extern unsigned int tsc_khz;
19-
/* flag for disabling the tsc */
20-
extern int tsc_disable;
2119

2220
extern void disable_TSC(void);
2321

0 commit comments

Comments
 (0)