rpms/kernel/F-10 linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch, NONE, 1.1 linux-2.6-x86-hpet-stop-counter-when-programming.patch, NONE, 1.1 kernel.spec, 1.1348, 1.1349

Chuck Ebbert cebbert at fedoraproject.org
Fri Apr 24 19:12:12 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3607

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch 
	linux-2.6-x86-hpet-stop-counter-when-programming.patch 
Log Message:
Fix hang with HPET timer at boot (F11#497351)

linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch:

--- NEW FILE linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch ---
From: Andreas Herrmann <andreas.herrmann3 at amd.com>
Date: Fri, 20 Feb 2009 23:10:44 +0000 (+0100)
Subject: x86: hpet: provide separate functions to stop and start the counter
X-Git-Tag: v2.6.30-rc2~102^4~4^2~1
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8d6f0c8214928f7c5083dd54ecb69c5d615b516e

x86: hpet: provide separate functions to stop and start the counter

By splitting up existing hpet_start_counter function.

Signed-off-by: Andreas Herrmann <andreas.herrmann3 at amd.com>
Cc: Mark Hounschell <markh at compro.net>
Cc: Borislav Petkov <borislav.petkov at amd.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 1d86ca3..7ae1f1e 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -231,27 +231,37 @@ static struct clock_event_device hpet_clockevent = {
 	.rating		= 50,
 };
 
-static void hpet_start_counter(void)
+static void hpet_stop_counter(void)
 {
 	unsigned long cfg = hpet_readl(HPET_CFG);
-
 	cfg &= ~HPET_CFG_ENABLE;
 	hpet_writel(cfg, HPET_CFG);
 	hpet_writel(0, HPET_COUNTER);
 	hpet_writel(0, HPET_COUNTER + 4);
+}
+
+static void hpet_start_counter(void)
+{
+	unsigned long cfg = hpet_readl(HPET_CFG);
 	cfg |= HPET_CFG_ENABLE;
 	hpet_writel(cfg, HPET_CFG);
 }
 
+static void hpet_restart_counter(void)
+{
+	hpet_stop_counter();
+	hpet_start_counter();
+}
+
 static void hpet_resume_device(void)
 {
 	force_hpet_resume();
 }
 
-static void hpet_restart_counter(void)
+static void hpet_resume_counter(void)
 {
 	hpet_resume_device();
-	hpet_start_counter();
+	hpet_restart_counter();
 }
 
 static void hpet_enable_legacy_int(void)
@@ -738,7 +748,7 @@ static struct clocksource clocksource_hpet = {
 	.mask		= HPET_MASK,
 	.shift		= HPET_SHIFT,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-	.resume		= hpet_restart_counter,
+	.resume		= hpet_resume_counter,
 #ifdef CONFIG_X86_64
 	.vread		= vread_hpet,
 #endif
@@ -750,7 +760,7 @@ static int hpet_clocksource_register(void)
 	cycle_t t1;
 
 	/* Start the counter */
-	hpet_start_counter();
+	hpet_restart_counter();
 
 	/* Verify whether hpet counter works */
 	t1 = read_hpet();

linux-2.6-x86-hpet-stop-counter-when-programming.patch:

--- NEW FILE linux-2.6-x86-hpet-stop-counter-when-programming.patch ---
From: Andreas Herrmann <andreas.herrmann3 at amd.com>
Date: Fri, 20 Feb 2009 23:16:35 +0000 (+0100)
Subject: x86: hpet: stop HPET_COUNTER when programming periodic mode
X-Git-Tag: v2.6.30-rc2~102^4~4^2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=c23e253e67c9d8a91a0ffa33c1f571a17f0a2403

x86: hpet: stop HPET_COUNTER when programming periodic mode

Impact: fix system hang on some systems operating with HZ_1000

On a system that stalled with HZ_1000, the first value written to
T0_CMP (when the main counter was not stopped) did not trigger an
interrupt. Instead after the main counter wrapped around (after
several minutes) an interrupt was triggered and afterwards the
periodic interrupt took effect.

This can be fixed by implementing HPET spec recommendation for
programming the periodic mode (i.e. stopping the main counter).

Signed-off-by: Andreas Herrmann <andreas.herrmann3 at amd.com>
Cc: Mark Hounschell <markh at compro.net>
Cc: Borislav Petkov <borislav.petkov at amd.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
[cebbert at redhat.com: backport to 2.6.29]
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 7ae1f1e..648b3a2 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -309,29 +309,22 @@ static int hpet_setup_msi_irq(unsigned int irq);
 static void hpet_set_mode(enum clock_event_mode mode,
 			  struct clock_event_device *evt, int timer)
 {
-	unsigned long cfg, cmp, now;
+	unsigned long cfg;
 	uint64_t delta;
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
+		hpet_stop_counter();
 		delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult;
 		delta >>= evt->shift;
-		now = hpet_readl(HPET_COUNTER);
-		cmp = now + (unsigned long) delta;
 		cfg = hpet_readl(HPET_Tn_CFG(timer));
 		/* Make sure we use edge triggered interrupts */
 		cfg &= ~HPET_TN_LEVEL;
 		cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
 		       HPET_TN_SETVAL | HPET_TN_32BIT;
 		hpet_writel(cfg, HPET_Tn_CFG(timer));
-		/*
-		 * The first write after writing TN_SETVAL to the
-		 * config register sets the counter value, the second
-		 * write sets the period.
-		 */
-		hpet_writel(cmp, HPET_Tn_CMP(timer));
-		udelay(1);
 		hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
+		hpet_start_counter();
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1348
retrieving revision 1.1349
diff -u -r1.1348 -r1.1349
--- kernel.spec	23 Apr 2009 22:32:16 -0000	1.1348
+++ kernel.spec	24 Apr 2009 19:11:42 -0000	1.1349
@@ -715,6 +715,10 @@
 Patch9400: linux-2.6-crypto-aes-padlock-fix-autoload.patch
 Patch9401: linux-2.6-crypto-aes-padlock-fix-autoload-2.patch
 
+# fix hpet hang at boot
+Patch9500: linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch
+Patch9501: linux-2.6-x86-hpet-stop-counter-when-programming.patch
+
 # Backport of upstream memory reduction for ftrace
 Patch10000: linux-2.6-ftrace-memory-reduction.patch
 
@@ -1330,6 +1334,10 @@
 ApplyPatch linux-2.6-crypto-aes-padlock-fix-autoload.patch
 ApplyPatch linux-2.6-crypto-aes-padlock-fix-autoload-2.patch
 
+# fix hpet hang at boot
+ApplyPatch linux-2.6-x86-hpet-provide-separate-start-stop-fns.patch
+ApplyPatch linux-2.6-x86-hpet-stop-counter-when-programming.patch
+
 # Reduce the memory usage of ftrace if you don't use it.
 ApplyPatch linux-2.6-ftrace-memory-reduction.patch
 
@@ -1909,6 +1917,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Fri Apr 24 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.2-49.rc1
+- Fix hang with HPET timer at boot (F11#497351)
+
 * Thu Apr 23 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.2-48.rc1
 - Revert 2.6.29.2-rc1 patch that won't be in the final release.
 




More information about the fedora-extras-commits mailing list