diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-03-14 19:03:29 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-03-18 11:59:30 -0500 |
commit | a904f7478561464f9fe74929b81fec237b6ff4c3 (patch) | |
tree | 6018ab25ea391aad0f4f33f0613e2b9fdbe36637 /arch/mips/sibyte/swarm/setup.c | |
parent | 4308cb16286c96d980570cc5319173b524220c06 (diff) |
[MIPS] Sibyte: Fix race in sb1250_gettimeoffset().
From Dave Johnson <djohnson+linuxmips@sw.starentnetworks.com>:
sb1250_gettimeoffset() simply reads the current cpu 0 timer remaining
value, however once this counter reaches 0 and the interrupt is raised,
it immediately resets and begins to count down again.
If sb1250_gettimeoffset() is called on cpu 1 via do_gettimeofday() after
the timer has reset but prior to cpu 0 processing the interrupt and
taking write_seqlock() in timer_interrupt() it will return a full value
(or close to it) causing time to jump backwards 1ms. Once cpu 0 handles
the interrupt and timer_interrupt() gets far enough along it will jump
forward 1ms.
Fix this problem by implementing mips_hpt_*() on sb1250 using a spare
timer unrelated to the existing periodic interrupt timers. It runs at
1Mhz with a full 23bit counter. This eliminated the custom
do_gettimeoffset() for sb1250 and allowed use of the generic
fixed_rate_gettimeoffset() using mips_hpt_*() and timerhi/timerlo.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/sibyte/swarm/setup.c')
-rw-r--r-- | arch/mips/sibyte/swarm/setup.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c index b614ca0ddb69..b661d2425a36 100644 --- a/arch/mips/sibyte/swarm/setup.c +++ b/arch/mips/sibyte/swarm/setup.c | |||
@@ -70,6 +70,12 @@ const char *get_system_type(void) | |||
70 | return "SiByte " SIBYTE_BOARD_NAME; | 70 | return "SiByte " SIBYTE_BOARD_NAME; |
71 | } | 71 | } |
72 | 72 | ||
73 | void __init swarm_time_init(void) | ||
74 | { | ||
75 | /* Setup HPT */ | ||
76 | sb1250_hpt_setup(); | ||
77 | } | ||
78 | |||
73 | void __init swarm_timer_setup(struct irqaction *irq) | 79 | void __init swarm_timer_setup(struct irqaction *irq) |
74 | { | 80 | { |
75 | /* | 81 | /* |
@@ -109,6 +115,7 @@ void __init plat_setup(void) | |||
109 | 115 | ||
110 | panic_timeout = 5; /* For debug. */ | 116 | panic_timeout = 5; /* For debug. */ |
111 | 117 | ||
118 | board_time_init = swarm_time_init; | ||
112 | board_timer_setup = swarm_timer_setup; | 119 | board_timer_setup = swarm_timer_setup; |
113 | board_be_handler = swarm_be_handler; | 120 | board_be_handler = swarm_be_handler; |
114 | 121 | ||