From: Michael Kelley <mikelley@microsoft.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"jgross@suse.com" <jgross@suse.com>,
"akataria@vmware.com" <akataria@vmware.com>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"apw@canonical.com" <apw@canonical.com>,
vkuznets <vkuznets@redhat.com>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
KY Srinivasan <kys@microsoft.com>
Cc: Michael Kelley <mikelley@microsoft.com>
Subject: [PATCH v2 1/2] i8253: Add support for PIT shutdown quirk
Date: Sun, 4 Nov 2018 03:48:54 +0000 [thread overview]
Message-ID: <1541303219-11142-2-git-send-email-mikelley@microsoft.com> (raw)
In-Reply-To: <1541303219-11142-1-git-send-email-mikelley@microsoft.com>
Add support for platforms where pit_shutdown() doesn't work because
of a quirk in the PIT emulation. On these platforms setting the
counter register to zero causes the PIT to start running again,
negating the shutdown. Provide a global variable that controls
whether the counter register is zero'ed, which platform specific
code can override.
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
drivers/clocksource/i8253.c | 14 ++++++++++++--
include/linux/i8253.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c
index 9c38895..2a4202a 100644
--- a/drivers/clocksource/i8253.c
+++ b/drivers/clocksource/i8253.c
@@ -20,6 +20,13 @@
DEFINE_RAW_SPINLOCK(i8253_lock);
EXPORT_SYMBOL(i8253_lock);
+/*
+ * Handle PIT quirk in pit_shutdown() where zeroing the counter register
+ * restarts the PIT, negating the shutdown. On platforms with the quirk,
+ * platform specific code can set this to false.
+ */
+bool i8253_clear_counter __ro_after_init = true;
+
#ifdef CONFIG_CLKSRC_I8253
/*
* Since the PIT overflows every tick, its not very useful
@@ -109,8 +116,11 @@ static int pit_shutdown(struct clock_event_device *evt)
raw_spin_lock(&i8253_lock);
outb_p(0x30, PIT_MODE);
- outb_p(0, PIT_CH0);
- outb_p(0, PIT_CH0);
+
+ if (i8253_clear_counter) {
+ outb_p(0, PIT_CH0);
+ outb_p(0, PIT_CH0);
+ }
raw_spin_unlock(&i8253_lock);
return 0;
diff --git a/include/linux/i8253.h b/include/linux/i8253.h
index e6bb36a..31c4be5 100644
--- a/include/linux/i8253.h
+++ b/include/linux/i8253.h
@@ -21,6 +21,7 @@
#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)
extern raw_spinlock_t i8253_lock;
+extern bool i8253_clear_counter;
extern struct clock_event_device i8253_clockevent;
extern void clockevent_i8253_init(bool oneshot);
--
1.8.3.1
next prev parent reply other threads:[~2018-11-04 3:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-04 3:48 [PATCH v2 0/2] i8253: Fix PIT shutdown quirk on Hyper-V Michael Kelley
2018-11-04 3:48 ` Michael Kelley [this message]
2018-11-04 10:09 ` [tip:x86/urgent] clockevents/drivers/i8253: Add support for PIT shutdown quirk tip-bot for Michael Kelley
2018-11-04 10:09 ` tip-bot for Michael Kelley
2018-11-04 3:48 ` [PATCH v2 2/2] x86/hyper-v: Enable " Michael Kelley
2018-11-04 10:10 ` [tip:x86/urgent] " tip-bot for Michael Kelley
2018-11-04 10:10 ` tip-bot for Michael Kelley
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=1541303219-11142-2-git-send-email-mikelley@microsoft.com \
--to=mikelley@microsoft.com \
--cc=akataria@vmware.com \
--cc=apw@canonical.com \
--cc=daniel.lezcano@linaro.org \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=jgross@suse.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.cerri@canonical.com \
--cc=olaf@aepfle.de \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.org \
--cc=vkuznets@redhat.com \
/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.