Greg Kroah-Hartman
2018-Nov-19 16:29 UTC
[PATCH 4.4 136/160] clockevents/drivers/i8253: Add support for PIT shutdown quirk
4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Kelley <mikelley at microsoft.com> 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 microsoft.com> Signed-off-by: Thomas Gleixner <tglx at linutronix.de> Cc: "gregkh at linuxfoundation.org" <gregkh at linuxfoundation.org> Cc: "devel at linuxdriverproject.org" <devel at linuxdriverproject.org> Cc: "daniel.lezcano at linaro.org" <daniel.lezcano at linaro.org> Cc: "virtualization at lists.linux-foundation.org" <virtualization at lists.linux-foundation.org> Cc: "jgross at suse.com" <jgross at suse.com> Cc: "akataria at vmware.com" <akataria at vmware.com> Cc: "olaf at aepfle.de" <olaf at aepfle.de> Cc: "apw at canonical.com" <apw at canonical.com> Cc: vkuznets <vkuznets at redhat.com> Cc: "jasowang at redhat.com" <jasowang at redhat.com> Cc: "marcelo.cerri at canonical.com" <marcelo.cerri at canonical.com> Cc: KY Srinivasan <kys at microsoft.com> Cc: stable at vger.kernel.org Link: https://lkml.kernel.org/r/1541303219-11142-2-git-send-email-mikelley at microsoft.com Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org> --- 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 @@ -19,6 +19,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_on_shutdown = true; + #ifdef CONFIG_CLKSRC_I8253 /* * Since the PIT overflows every tick, its not very useful @@ -108,8 +115,11 @@ static int pit_shutdown(struct clock_eve raw_spin_lock(&i8253_lock); 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); + } raw_spin_unlock(&i8253_lock); 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);
Reasonably Related Threads
- [PATCH 4.19 129/205] clockevents/drivers/i8253: Add support for PIT shutdown quirk
- [PATCH 4.18 104/171] clockevents/drivers/i8253: Add support for PIT shutdown quirk
- [PATCH 4.14 072/124] clockevents/drivers/i8253: Add support for PIT shutdown quirk
- [PATCH 4.9 52/83] clockevents/drivers/i8253: Add support for PIT shutdown quirk
- [tip:x86/urgent] clockevents/drivers/i8253: Add support for PIT shutdown quirk