rpms/kernel/F-10 linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch, NONE, 1.1 kernel.spec, 1.1350, 1.1351

Chuck Ebbert cebbert at fedoraproject.org
Mon Apr 27 19:25:12 UTC 2009


Author: cebbert

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

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch 
Log Message:
Fix HPET hang at boot on AMD 81xx, caused by backported 2.6.30 HPET fixes.

linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch:

--- NEW FILE linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch ---
From: Andreas Herrmann <andreas.herrmann3 at amd.com>
Date: Tue, 21 Apr 2009 18:00:37 +0000 (+0200)
Subject: x86: hpet: fix periodic mode programming on AMD 81xx
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=7a6f9cbb37120c745fc187083fb5c3de4dca4f97

x86: hpet: fix periodic mode programming on AMD 81xx

(See http://bugzilla.kernel.org/show_bug.cgi?id=12961)

It partially reverts commit c23e253e67c9d8a91a0ffa33c1f571a17f0a2403
(x86: hpet: stop HPET_COUNTER when programming periodic mode)

HPET on AMD 81xx chipset needs a second write (with HPET_TN_SETVAL
cleared) to T0_CMP register to set the period in periodic mode.

With this patch HPET_COUNTER is still stopped but not reset when HPET
is programmed in periodic mode. This should help to avoid races when
HPET is programmed in periodic mode and fixes a boot time hang that
I've observed on a machine when using 1000HZ.

[ Impact: fix boot time hang on machines with AMD 81xx chipset ]

Reported-by: Jeff Mahoney <jeffm at suse.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3 at amd.com>
Tested-by: Jeff Mahoney <jeffm at suse.com>
LKML-Reference: <20090421180037.GA2763 at alberich.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 3f0019e..81408b9 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -236,6 +236,10 @@ static void hpet_stop_counter(void)
 	unsigned long cfg = hpet_readl(HPET_CFG);
 	cfg &= ~HPET_CFG_ENABLE;
 	hpet_writel(cfg, HPET_CFG);
+}
+
+static void hpet_reset_counter(void)
+{
 	hpet_writel(0, HPET_COUNTER);
 	hpet_writel(0, HPET_COUNTER + 4);
 }
@@ -250,6 +254,7 @@ static void hpet_start_counter(void)
 static void hpet_restart_counter(void)
 {
 	hpet_stop_counter();
+	hpet_reset_counter();
 	hpet_start_counter();
 }
 
@@ -309,7 +314,7 @@ 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;
+	unsigned long cfg, cmp, now;
 	uint64_t delta;
 
 	switch (mode) {
@@ -317,12 +322,23 @@ static void hpet_set_mode(enum clock_event_mode mode,
 		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));
+		hpet_writel(cmp, HPET_Tn_CMP(timer));
+		udelay(1);
+		/*
+		 * HPET on AMD 81xx needs a second write (with HPET_TN_SETVAL
+		 * cleared) to T0_CMP to set the period. The HPET_TN_SETVAL
+		 * bit is automatically cleared after the first write.
+		 * (See AMD-8111 HyperTransport I/O Hub Data Sheet,
+		 * Publication # 24674)
+		 */
 		hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
 		hpet_start_counter();
 		hpet_print_config();


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1350
retrieving revision 1.1351
diff -u -r1.1350 -r1.1351
--- kernel.spec	27 Apr 2009 18:59:24 -0000	1.1350
+++ kernel.spec	27 Apr 2009 19:24:42 -0000	1.1351
@@ -718,6 +718,7 @@
 # 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
+Patch9502: linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch
 
 # Backport of upstream memory reduction for ftrace
 Patch10000: linux-2.6-ftrace-memory-reduction.patch
@@ -1337,6 +1338,7 @@
 # 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
+ApplyPatch linux-2.6-x86-hpet-fix-periodic-mode-on-amd-81xx.patch
 
 # Reduce the memory usage of ftrace if you don't use it.
 ApplyPatch linux-2.6-ftrace-memory-reduction.patch
@@ -1917,6 +1919,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Mon Apr 27 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.2-51
+- Fix HPET hang at boot on AMD 81xx, caused by backported 2.6.30 HPET fixes.
+
 * Mon Apr 27 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.2-50
 - Linux 2.6.29.2
 




More information about the scm-commits mailing list