Skip to content

Commit 6fa0fdd

Browse files
committed
Merge branch 'timers-for-linus-hpet' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus-hpet' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, hpet: Add reference to chipset erratum documentation for disable-hpet-msi-quirk x86, hpet: Restrict read back to affected ATI chipsets
2 parents 7d02093 + fec84e3 commit 6fa0fdd

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

‎arch/x86/include/asm/hpet.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ extern unsigned long force_hpet_address;
6868
extern u8 hpet_blockid;
6969
extern int hpet_force_user;
7070
extern u8 hpet_msi_disable;
71+
extern u8 hpet_readback_cmp;
7172
extern int is_hpet_enabled(void);
7273
extern int hpet_enable(void);
7374
extern void hpet_disable(void);

‎arch/x86/kernel/hpet.c‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
unsigned long hpet_address;
3737
u8 hpet_blockid; /* OS timer block num */
3838
u8 hpet_msi_disable;
39+
u8 hpet_readback_cmp;
3940

4041
#ifdef CONFIG_PCI_MSI
4142
static unsigned long hpet_num_timers;
@@ -395,19 +396,23 @@ static int hpet_next_event(unsigned long delta,
395396
* at that point and we would wait for the next hpet interrupt
396397
* forever. We found out that reading the CMP register back
397398
* forces the transfer so we can rely on the comparison with
398-
* the counter register below. If the read back from the
399-
* compare register does not match the value we programmed
400-
* then we might have a real hardware problem. We can not do
401-
* much about it here, but at least alert the user/admin with
402-
* a prominent warning.
403-
* An erratum on some chipsets (ICH9,..), results in comparator read
404-
* immediately following a write returning old value. Workaround
405-
* for this is to read this value second time, when first
406-
* read returns old value.
399+
* the counter register below.
400+
*
401+
* That works fine on those ATI chipsets, but on newer Intel
402+
* chipsets (ICH9...) this triggers due to an erratum: Reading
403+
* the comparator immediately following a write is returning
404+
* the old value.
405+
*
406+
* We restrict the read back to the affected ATI chipsets (set
407+
* by quirks) and also run it with hpet=verbose for debugging
408+
* purposes.
407409
*/
408-
if (unlikely((u32)hpet_readl(HPET_Tn_CMP(timer)) != cnt)) {
409-
WARN_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt,
410-
KERN_WARNING "hpet: compare register read back failed.\n");
410+
if (hpet_readback_cmp || hpet_verbose) {
411+
u32 cmp = hpet_readl(HPET_Tn_CMP(timer));
412+
413+
if (cmp != cnt)
414+
printk_once(KERN_WARNING
415+
"hpet: compare register read back failed.\n");
411416
}
412417

413418
return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;

‎arch/x86/kernel/quirks.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,18 @@ void force_hpet_resume(void)
495495
/*
496496
* HPET MSI on some boards (ATI SB700/SB800) has side effect on
497497
* floppy DMA. Disable HPET MSI on such platforms.
498+
* See erratum #27 (Misinterpreted MSI Requests May Result in
499+
* Corrupted LPC DMA Data) in AMD Publication #46837,
500+
* "SB700 Family Product Errata", Rev. 1.0, March 2010.
501+
*
502+
* Also force the read back of the CMP register in hpet_next_event()
503+
* to work around the problem that the CMP register write seems to be
504+
* delayed. See hpet_next_event() for details.
498505
*/
499506
static void force_disable_hpet_msi(struct pci_dev *unused)
500507
{
501508
hpet_msi_disable = 1;
509+
hpet_readback_cmp = 1;
502510
}
503511

504512
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,

0 commit comments

Comments
 (0)