Patch "clockevents/drivers/i8253: Add support for PIT shutdown quirk" has been added to the 4.19-stable tree

gregkh at gregkh at
Mon Nov 19 13:00:03 UTC 2018

This is a note to let you know that I've just added the patch titled

    clockevents/drivers/i8253: Add support for PIT shutdown quirk

to the 4.19-stable tree which can be found at:;a=summary

The filename of the patch is:
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at> know about it.

>From 35b69a420bfb56b7b74cb635ea903db05e357bec Mon Sep 17 00:00:00 2001
From: Michael Kelley <mikelley at>
Date: Sun, 4 Nov 2018 03:48:54 +0000
Subject: clockevents/drivers/i8253: Add support for PIT shutdown quirk

From: Michael Kelley <mikelley at>

commit 35b69a420bfb56b7b74cb635ea903db05e357bec upstream.

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 at>
Signed-off-by: Thomas Gleixner <tglx at>
Cc: "gregkh at" <gregkh at>
Cc: "devel at" <devel at>
Cc: "daniel.lezcano at" <daniel.lezcano at>
Cc: "virtualization at" <virtualization at>
Cc: "jgross at" <jgross at>
Cc: "akataria at" <akataria at>
Cc: "olaf at" <olaf at>
Cc: "apw at" <apw at>
Cc: vkuznets <vkuznets at>
Cc: "jasowang at" <jasowang at>
Cc: "marcelo.cerri at" <marcelo.cerri at>
Cc: KY Srinivasan <kys at>
Cc: stable at
Signed-off-by: Greg Kroah-Hartman <gregkh at>

 drivers/clocksource/i8253.c |   14 ++++++++++++--
 include/linux/i8253.h       |    1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

--- a/drivers/clocksource/i8253.c
+++ b/drivers/clocksource/i8253.c
@@ -20,6 +20,13 @@
+ * 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_on_shutdown __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_eve
 	outb_p(0x30, PIT_MODE);
-	outb_p(0, PIT_CH0);
-	outb_p(0, PIT_CH0);
+	if (i8253_clear_counter_on_shutdown) {
+		outb_p(0, PIT_CH0);
+		outb_p(0, PIT_CH0);
+	}
 	return 0;
--- 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_on_shutdown;
 extern struct clock_event_device i8253_clockevent;
 extern void clockevent_i8253_init(bool oneshot);

Patches currently in stable-queue which might be from mikelley at are


More information about the devel mailing list