From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Juergen Gross" <jgross@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86: avoid HPET use on certain Intel platforms
Date: Fri, 22 Nov 2019 13:46:46 +0100 [thread overview]
Message-ID: <fba2992c-e306-dfb2-8edb-20fe5d18ca98@suse.com> (raw)
Linux commit fc5db58539b49351e76f19817ed1102bf7c712d0 says
"Some Coffee Lake platforms have a skewed HPET timer once the SoCs entered
PC10, which in consequence marks TSC as unstable because HPET is used as
watchdog clocksource for TSC."
Follow this for Xen as well. Looking at its patch context made me notice
they have a pre-existing quirk for Bay Trail as well. The comment there,
however, points at a Cherry Trail document. Looking at the datasheets of
both, there appear to be similar issues, so go beyond Linux'es coverage
and exclude both. Also key the disable on the PCI IDs of the actual
affected devices, rather than those of 00:00.0.
Apply the workarounds only when the use of HPET was not explicitly
requested on the command line and when use of (deep) C-states was not
disabled.
Adjust a few types in touched or nearby code at the same time.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -18,6 +18,7 @@
#include <xen/timer.h>
#include <xen/smp.h>
#include <xen/irq.h>
+#include <xen/pci_ids.h>
#include <xen/softirq.h>
#include <xen/efi.h>
#include <xen/cpuidle.h>
@@ -367,12 +368,41 @@ static u64 read_hpet_count(void)
return hpet_read32(HPET_COUNTER);
}
-static s64 __init init_hpet(struct platform_timesource *pts)
+static int64_t __init init_hpet(struct platform_timesource *pts)
{
- u64 hpet_rate = hpet_setup(), start;
- u32 count, target;
+ uint64_t hpet_rate, start;
+ uint32_t count, target;
- if ( hpet_rate == 0 )
+ if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
+ cpuidle_using_deep_cstate() )
+ {
+ if ( pci_conf_read16(PCI_SBDF(0, 0, 0x1f, 0),
+ PCI_VENDOR_ID) == PCI_VENDOR_ID_INTEL )
+ switch ( pci_conf_read16(PCI_SBDF(0, 0, 0x1f, 0), PCI_DEVICE_ID) )
+ {
+ /* HPET on Bay Trail platforms will halt in deep C states. */
+ case 0x0f1c:
+ /* HPET on Cherry Trail platforms will halt in deep C states. */
+ case 0x229c:
+ hpet_address = 0;
+ break;
+ }
+
+ /*
+ * Some Coffee Lake platforms have a skewed HPET timer once the SoCs
+ * entered PC10.
+ */
+ if ( pci_conf_read16(PCI_SBDF(0, 0, 0, 0),
+ PCI_VENDOR_ID) == PCI_VENDOR_ID_INTEL &&
+ pci_conf_read16(PCI_SBDF(0, 0, 0, 0),
+ PCI_DEVICE_ID) == 0x3ec4 )
+ hpet_address = 0;
+
+ if ( !hpet_address )
+ printk("Disabling HPET for being unreliable\n");
+ }
+
+ if ( (hpet_rate = hpet_setup()) == 0 )
return 0;
pts->frequency = hpet_rate;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2019-11-22 12:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-22 12:46 Jan Beulich [this message]
2019-11-22 12:50 ` [Xen-devel] [PATCH] x86: avoid HPET use on certain Intel platforms Andrew Cooper
2019-11-22 12:57 ` Jan Beulich
2019-11-22 12:58 ` Andrew Cooper
2019-11-22 13:36 ` Jan Beulich
2019-11-22 23:10 ` Andreas Kinzler
2019-11-25 10:15 ` Jan Beulich
2019-11-25 12:46 ` Andreas Kinzler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fba2992c-e306-dfb2-8edb-20fe5d18ca98@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=jgross@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.