[PATCH] x86/hpet: Disable HPET on Intel Coffe Lake

From: Kai-Heng Feng
Date: Thu Aug 29 2019 - 05:12:52 EST


Some Coffee Lake platforms have skewed HPET timer once the SoCs entered
PC10, and marked TSC as unstable clocksource as result.

Harry Pan identified it's a firmware bug [1].

To prevent creating a circular dependency between HPET and TSC, let's
disable HPET on affected platforms.

[1]: https://lore.kernel.org/lkml/20190516090651.1396-1-harry.pan@xxxxxxxxx/
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203183

Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
arch/x86/kernel/hpet.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index c6f791bc481e..07e9ec6f85b6 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -7,7 +7,9 @@
#include <linux/cpu.h>
#include <linux/irq.h>

+#include <asm/cpu_device_id.h>
#include <asm/hpet.h>
+#include <asm/intel-family.h>
#include <asm/time.h>

#undef pr_fmt
@@ -806,6 +808,12 @@ static bool __init hpet_counting(void)
return false;
}

+static const struct x86_cpu_id hpet_blacklist[] __initconst = {
+ { X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_MOBILE },
+ { X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_DESKTOP },
+ { }
+};
+
/**
* hpet_enable - Try to setup the HPET timer. Returns 1 on success.
*/
@@ -819,6 +827,9 @@ int __init hpet_enable(void)
if (!is_hpet_capable())
return 0;

+ if (!hpet_force_user && x86_match_cpu(hpet_blacklist))
+ return 0;
+
hpet_set_mapping();
if (!hpet_virt_address)
return 0;
--
2.17.1