[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1541093509-10576-1-git-send-email-mikelley@microsoft.com>
Date: Thu, 1 Nov 2018 17:32:32 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: "virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
"jgross@...e.com" <jgross@...e.com>,
"akataria@...are.com" <akataria@...are.com>,
"olaf@...fle.de" <olaf@...fle.de>,
"apw@...onical.com" <apw@...onical.com>,
vkuznets <vkuznets@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"marcelo.cerri@...onical.com" <marcelo.cerri@...onical.com>,
KY Srinivasan <kys@...rosoft.com>
CC: Michael Kelley <mikelley@...rosoft.com>
Subject: [PATCH 2/2] i8253: Fix PIT shutdown quirk on Hyper-V
pit_shutdown() doesn't work on Hyper-V because of a quirk in the
PIT emulation. This problem exists in all versions of Hyper-V and
had not been noticed previously. When the counter register is set
to zero, the emulated PIT continues to interrupt @18.2 HZ. So
skip setting the counter register when running on Hyper-V.
Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
---
drivers/clocksource/i8253.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c
index 9c38895..62025c8 100644
--- a/drivers/clocksource/i8253.c
+++ b/drivers/clocksource/i8253.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/i8253.h>
#include <linux/smp.h>
+#include <linux/hypervisor.h>
/*
* Protects access to I/O ports
@@ -109,8 +110,17 @@ 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);
+
+ /*
+ * A quirk in Hyper-V's emulation of the PIT causes the PIT
+ * to continue to run and interrupt @18.2 Hz when the counter
+ * register is set to zero. So skip setting the counter
+ * register when running as a guest on Hyper-V.
+ */
+ if (!hypervisor_is_mshyperv()) {
+ outb_p(0, PIT_CH0);
+ outb_p(0, PIT_CH0);
+ }
raw_spin_unlock(&i8253_lock);
return 0;
--
1.8.3.1
Powered by blists - more mailing lists