From: Prarit Bhargava <prarit@redhat.com> Date: Mon, 15 Dec 2008 15:26:28 -0500 Subject: [x86] consistent time options for x86_64 and i386 Message-id: 4946BD74.8050404@redhat.com O-Subject: Re: [RHEL 5.4 PATCH]: Consistent time options for x86_64 and i386 Bugzilla: 475374 RH-Acked-by: Brian Maly <bmaly@redhat.com> x86_64 uses nopmtimer, nohpet, and notsc to control which clock is used for the GTOD clock. i386 uses "clock=[hpet|pmtmr|tsc]" to control which clock is used for both the wall and the GTOD clock. Make them consistent between arches. disable_pmtmr() is not upstream -- I have pushed a patch to add it upstream. Tested on an xw9400 with HPET enabled and disabled on both i386 & x86_64 by me. Resolves BZ 475374. diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c index cf206c8..df5eee4 100644 --- a/arch/i386/kernel/time_hpet.c +++ b/arch/i386/kernel/time_hpet.c @@ -247,6 +247,13 @@ static int __init hpet_setup(char* str) __setup("hpet=", hpet_setup); +static int __init disable_hpet(char *str) +{ + boot_hpet_disable = 1; + return 1; +} +__setup("nohpet", disable_hpet); + #ifdef CONFIG_HPET_EMULATE_RTC /* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET * is enabled, we support RTC interrupt functionality in software. diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 82ba6a8..9ad5528 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c @@ -1444,6 +1444,25 @@ int __init notsc_setup(char *s) __setup("notsc", notsc_setup); +static int __init boot_override_clock(char *str) +{ + /* For x86, only have hpet, pmtmr, tsc */ + if (!strcmp(str, "hpet")) { + pmtmr_ioport = 0; + notsc = 1; + } else if (!strcmp(str, "pmtmr") || !strcmp(str, "pmtimer")) { + nohpet = 1; + notsc = 1; + } else if (!strcmp(str, "tsc")) { + nohpet = 1; + pmtmr_ioport = 0; + } else + printk(KERN_WARNING "%s is unknown clock source\n", str); + + return 1; +} +__setup("clock=", boot_override_clock); + #ifdef CONFIG_TICK_DIVIDER diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 7ad3be8..a770228 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c @@ -174,4 +174,11 @@ pm_good: return clocksource_register(&clocksource_acpi_pm); } + +static int __init disable_pmtmr(char *str) +{ + pmtmr_ioport = 0; + return 1; +} +__setup("nopmtimer", disable_pmtmr); module_init(init_acpi_pm_clocksource);