diff options
author | Chris McDermott <lcm@us.ibm.com> | 2006-02-11 20:55:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-12 00:41:11 -0500 |
commit | 33042a9ff4d126ba944b9dc3076665a2029e0a34 (patch) | |
tree | d5cf22cebc02316058ad860feecef20742a4ae5e | |
parent | e00d82d07fb112446586d225763d3572e64b7abf (diff) |
[PATCH] x86-64: Fix HPET timer on x460
[description from AK]
The IBM Summit 3 chipset doesn't implement the HPET timer replacement
option. Since the current Linux code relies on it use a mixed mode with
both PIT for the interrupt and HPET counters for the time keeping. That
was already implemented, but didn't work properly because it was still
using the last interrupt offset in HPET. This resulted in x460 not
booting. Fix this up by using the free running HPET counter.
Shouldn't affect any other machine because they either use full HPET mode
or no HPET at all.
TBD needs a similar 32bit fix.
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: Bob Picco <bob.picco@hp.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/x86_64/kernel/apic.c | 2 | ||||
-rw-r--r-- | arch/x86_64/kernel/time.c | 12 | ||||
-rw-r--r-- | include/asm-x86_64/hpet.h | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c index 6147770b4347..7a0a3e8d5d72 100644 --- a/arch/x86_64/kernel/apic.c +++ b/arch/x86_64/kernel/apic.c | |||
@@ -708,7 +708,7 @@ static void setup_APIC_timer(unsigned int clocks) | |||
708 | local_irq_save(flags); | 708 | local_irq_save(flags); |
709 | 709 | ||
710 | /* wait for irq slice */ | 710 | /* wait for irq slice */ |
711 | if (vxtime.hpet_address) { | 711 | if (vxtime.hpet_address && hpet_use_timer) { |
712 | int trigger = hpet_readl(HPET_T0_CMP); | 712 | int trigger = hpet_readl(HPET_T0_CMP); |
713 | while (hpet_readl(HPET_COUNTER) >= trigger) | 713 | while (hpet_readl(HPET_COUNTER) >= trigger) |
714 | /* do nothing */ ; | 714 | /* do nothing */ ; |
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index dba7237be5c1..3c58c30506a1 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -59,7 +59,7 @@ static int notsc __initdata = 0; | |||
59 | unsigned int cpu_khz; /* TSC clocks / usec, not used here */ | 59 | unsigned int cpu_khz; /* TSC clocks / usec, not used here */ |
60 | static unsigned long hpet_period; /* fsecs / HPET clock */ | 60 | static unsigned long hpet_period; /* fsecs / HPET clock */ |
61 | unsigned long hpet_tick; /* HPET clocks / interrupt */ | 61 | unsigned long hpet_tick; /* HPET clocks / interrupt */ |
62 | static int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */ | 62 | int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */ |
63 | unsigned long vxtime_hz = PIT_TICK_RATE; | 63 | unsigned long vxtime_hz = PIT_TICK_RATE; |
64 | int report_lost_ticks; /* command line option */ | 64 | int report_lost_ticks; /* command line option */ |
65 | unsigned long long monotonic_base; | 65 | unsigned long long monotonic_base; |
@@ -326,7 +326,10 @@ static noinline void handle_lost_ticks(int lost, struct pt_regs *regs) | |||
326 | print_symbol("rip %s\n", regs->rip); | 326 | print_symbol("rip %s\n", regs->rip); |
327 | if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) { | 327 | if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) { |
328 | printk(KERN_WARNING "Falling back to HPET\n"); | 328 | printk(KERN_WARNING "Falling back to HPET\n"); |
329 | vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; | 329 | if (hpet_use_timer) |
330 | vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; | ||
331 | else | ||
332 | vxtime.last = hpet_readl(HPET_COUNTER); | ||
330 | vxtime.mode = VXTIME_HPET; | 333 | vxtime.mode = VXTIME_HPET; |
331 | do_gettimeoffset = do_gettimeoffset_hpet; | 334 | do_gettimeoffset = do_gettimeoffset_hpet; |
332 | } | 335 | } |
@@ -988,7 +991,10 @@ void __init time_init_gtod(void) | |||
988 | notsc = 1; | 991 | notsc = 1; |
989 | if (vxtime.hpet_address && notsc) { | 992 | if (vxtime.hpet_address && notsc) { |
990 | timetype = hpet_use_timer ? "HPET" : "PIT/HPET"; | 993 | timetype = hpet_use_timer ? "HPET" : "PIT/HPET"; |
991 | vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; | 994 | if (hpet_use_timer) |
995 | vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; | ||
996 | else | ||
997 | vxtime.last = hpet_readl(HPET_COUNTER); | ||
992 | vxtime.mode = VXTIME_HPET; | 998 | vxtime.mode = VXTIME_HPET; |
993 | do_gettimeoffset = do_gettimeoffset_hpet; | 999 | do_gettimeoffset = do_gettimeoffset_hpet; |
994 | #ifdef CONFIG_X86_PM_TIMER | 1000 | #ifdef CONFIG_X86_PM_TIMER |
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h index c20c28f5c7a0..08b75c15269a 100644 --- a/include/asm-x86_64/hpet.h +++ b/include/asm-x86_64/hpet.h | |||
@@ -55,6 +55,8 @@ extern int is_hpet_enabled(void); | |||
55 | extern int hpet_rtc_timer_init(void); | 55 | extern int hpet_rtc_timer_init(void); |
56 | extern int oem_force_hpet_timer(void); | 56 | extern int oem_force_hpet_timer(void); |
57 | 57 | ||
58 | extern int hpet_use_timer; | ||
59 | |||
58 | #ifdef CONFIG_HPET_EMULATE_RTC | 60 | #ifdef CONFIG_HPET_EMULATE_RTC |
59 | extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); | 61 | extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); |
60 | extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); | 62 | extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); |