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

From: Feng Tang
Date: Wed Oct 09 2019 - 01:59:13 EST


Hi Kai-Heng,

On Thu, Aug 29, 2019 at 5:14 PM Kai-Heng Feng
<kai.heng.feng@xxxxxxxxxxxxx> wrote:
>
> 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.

Sorry for chiming late.

We have disabled the HPET for Baytrail platforms in
commit 62187910b0fc : x86/intel: Add quirk to disable HPET for the
Baytrail platform

Which added a quirk in
@@ -567,6 +577,12 @@ static struct chipset early_qrk[] __initdata = {
+ /*
+ * HPET on current version of Baytrail platform has accuracy
+ * problems, disable it for now:
+ */
+ { PCI_VENDOR_ID_INTEL, 0x0f00,
+ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},

So maybe we can unify the method to disable HPET. (btw, I have no idea
about the healthy info of HPET for Kabylake, just want to comment
on the disabling method).

Thanks,
Feng

>
> [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
>