x86/hpet: Use another crystalball to evaluate HPET usability
authorThomas Gleixner <tglx@linutronix.de>
Wed, 20 Oct 2021 10:50:15 +0000 (12:50 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 20 Oct 2021 10:50:15 +0000 (12:50 +0200)
commitc12731493ae39640c4e44d9fe2029c3165f9f429
treef393fbb11a3afa245207bf6f449d96607face867
parent6d187caae50284625af8799a79712c7a4c6a9a59
x86/hpet: Use another crystalball to evaluate HPET usability

On recent Intel systems the HPET stops working when the system reaches PC10
idle state.

The approach of adding PCI ids to the early quirks to disable HPET on
these systems is a whack a mole game which makes no sense.

Check for PC10 instead and force disable HPET if supported. The check is
overbroad as it does not take ACPI, mwait-idle enablement and command
line parameters into account. That's fine as long as there is at least
PMTIMER available to calibrate the TSC frequency. The decision can be
overruled by adding "clocksource=hpet" on the Xen command line.

Remove the related PCI quirks for affected Coffee Lake systems as they
are not longer required. That should also cover all other systems, i.e.
Ice Lake, Tiger Lake, and newer generations, which are most likely
affected by this as well.

Fixes: Yet another hardware trainwreck
Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[Linux commit: 6e3cd95234dc1eda488f4f487c281bac8fef4d9b]

I have to admit that the purpose of checking CPUID5_ECX_INTERRUPT_BREAK
is unclear to me, but I didn't want to diverge in technical aspects from
the Linux commit.

In mwait_pc10_supported(), besides some cosmetic adjustments, avoid UB
from shifting left a signed 4-bit constant by 28 bits.

Pull in Linux'es MSR_PKG_CST_CONFIG_CONTROL.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/cpu/mwait-idle.c
xen/arch/x86/time.c
xen/include/asm-x86/msr-index.h
xen/include/asm-x86/mwait.h