Skip to content

Commit 72d43d9

Browse files
committed
x86: HPET: read back compare register before reading counter
After fixing the u32 thinko I sill had occasional hickups on ATI chipsets with small deltas. There seems to be a delay between writing the compare register and the transffer to the internal register which triggers the interrupt. Reading back the value makes sure, that it hit the internal match register befor we compare against the counter value. Signed-off-by: Thomas Gleixner <[email protected]>
1 parent f767625 commit 72d43d9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/x86/kernel/hpet.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ static int hpet_legacy_next_event(unsigned long delta,
278278
cnt += (u32) delta;
279279
hpet_writel(cnt, HPET_T0_CMP);
280280

281+
/*
282+
* We need to read back the CMP register to make sure that
283+
* what we wrote hit the chip before we compare it to the
284+
* counter.
285+
*/
286+
WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt);
287+
281288
return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
282289
}
283290

0 commit comments

Comments
 (0)