Commit e97ba483 authored by John Stultz's avatar John Stultz Committed by Linus Torvalds

[PATCH] linux-2.5.45_notsc-warning_A0

This is a minor cleanup that removes two instances of CONFIG_X86_TSC
(lets the compiler optimize it out), and adds a warning message should
anyone pass "notsc" to a kernel compiled w/ CONFIG_X86_TSC (which
ignores it).

This is basically a forward port of a patch I got into 2.4 a while back.
parent b7c1dee7
...@@ -50,9 +50,16 @@ static int __init tsc_setup(char *str) ...@@ -50,9 +50,16 @@ static int __init tsc_setup(char *str)
tsc_disable = 1; tsc_disable = 1;
return 1; return 1;
} }
#else
#define tsc_disable 0
__setup("notsc", tsc_setup); static int __init tsc_setup(char *str)
{
printk("notsc: Kernel compiled with CONFIG_X86_TSC, cannot disable TSC.\n");
return 1;
}
#endif #endif
__setup("notsc", tsc_setup);
int __init get_model_name(struct cpuinfo_x86 *c) int __init get_model_name(struct cpuinfo_x86 *c)
{ {
...@@ -303,10 +310,8 @@ void __init identify_cpu(struct cpuinfo_x86 *c) ...@@ -303,10 +310,8 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
*/ */
/* TSC disabled? */ /* TSC disabled? */
#ifndef CONFIG_X86_TSC
if ( tsc_disable ) if ( tsc_disable )
clear_bit(X86_FEATURE_TSC, c->x86_capability); clear_bit(X86_FEATURE_TSC, c->x86_capability);
#endif
/* FXSR disabled? */ /* FXSR disabled? */
if (disable_x86_fxsr) { if (disable_x86_fxsr) {
...@@ -442,14 +447,12 @@ void __init cpu_init (void) ...@@ -442,14 +447,12 @@ void __init cpu_init (void)
if (cpu_has_vme || cpu_has_tsc || cpu_has_de) 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); clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
#ifndef CONFIG_X86_TSC
if (tsc_disable && cpu_has_tsc) { if (tsc_disable && cpu_has_tsc) {
printk(KERN_NOTICE "Disabling TSC...\n"); printk(KERN_NOTICE "Disabling TSC...\n");
/**** FIX-HPA: DOES THIS REALLY BELONG HERE? ****/ /**** FIX-HPA: DOES THIS REALLY BELONG HERE? ****/
clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability); clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability);
set_in_cr4(X86_CR4_TSD); set_in_cr4(X86_CR4_TSD);
} }
#endif
/* /*
* Initialize the per-CPU GDT with the boot GDT, * Initialize the per-CPU GDT with the boot GDT,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment