Skip to content

Commit 1de72c7

Browse files
kelleymhKAGA-KOKO
authored andcommitted
x86/hyper-v: Enable PIT shutdown quirk
Hyper-V emulation of the PIT has a quirk such that the normal PIT shutdown path doesn't work, because clearing the counter register restarts the timer. Disable the counter clearing on PIT shutdown. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org> Cc: "devel@linuxdriverproject.org" <devel@linuxdriverproject.org> Cc: "daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org> Cc: "virtualization@lists.linux-foundation.org" <virtualization@lists.linux-foundation.org> Cc: "jgross@suse.com" <jgross@suse.com> Cc: "akataria@vmware.com" <akataria@vmware.com> Cc: "olaf@aepfle.de" <olaf@aepfle.de> Cc: "apw@canonical.com" <apw@canonical.com> Cc: vkuznets <vkuznets@redhat.com> Cc: "jasowang@redhat.com" <jasowang@redhat.com> Cc: "marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com> Cc: KY Srinivasan <kys@microsoft.com> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/1541303219-11142-3-git-send-email-mikelley@microsoft.com
1 parent 35b69a4 commit 1de72c7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/interrupt.h>
2121
#include <linux/irq.h>
2222
#include <linux/kexec.h>
23+
#include <linux/i8253.h>
2324
#include <asm/processor.h>
2425
#include <asm/hypervisor.h>
2526
#include <asm/hyperv-tlfs.h>
@@ -295,6 +296,16 @@ static void __init ms_hyperv_init_platform(void)
295296
if (efi_enabled(EFI_BOOT))
296297
x86_platform.get_nmi_reason = hv_get_nmi_reason;
297298

299+
/*
300+
* Hyper-V VMs have a PIT emulation quirk such that zeroing the
301+
* counter register during PIT shutdown restarts the PIT. So it
302+
* continues to interrupt @18.2 HZ. Setting i8253_clear_counter
303+
* to false tells pit_shutdown() not to zero the counter so that
304+
* the PIT really is shutdown. Generation 2 VMs don't have a PIT,
305+
* and setting this value has no effect.
306+
*/
307+
i8253_clear_counter_on_shutdown = false;
308+
298309
#if IS_ENABLED(CONFIG_HYPERV)
299310
/*
300311
* Setup the hook to get control post apic initialization.

0 commit comments

Comments
 (0)