rpms/kernel/F-7 linux-2.6-i386-hpet-check-if-the-counter-works.patch, NONE, 1.1 kernel-2.6.spec, 1.3279, 1.3280

Dave Jones (davej) fedora-extras-commits at redhat.com
Thu Jul 12 22:40:56 UTC 2007


Author: davej

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12904

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-i386-hpet-check-if-the-counter-works.patch 
Log Message:
* Thu Jul 12 2007 Dave Jones <davej at redhat.com>
- Some systems have a HPET which is not incrementing, which leads
  to a complete hang.  Detect it during HPET setup.


linux-2.6-i386-hpet-check-if-the-counter-works.patch:

--- NEW FILE linux-2.6-i386-hpet-check-if-the-counter-works.patch ---
From: Thomas Gleixner <tglx at linutronix.de>

Some systems have a HPET which is not incrementing, which leads to a
complete hang.  Detect it during HPET setup.

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Cc: Andi Kleen <ak at suse.de>
Cc: john stultz <johnstul at us.ibm.com>
Cc: <stable at kernel.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 arch/i386/kernel/hpet.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff -puN arch/i386/kernel/hpet.c~i386-hpet-check-if-the-counter-works arch/i386/kernel/hpet.c
--- a/arch/i386/kernel/hpet.c~i386-hpet-check-if-the-counter-works
+++ a/arch/i386/kernel/hpet.c
@@ -226,7 +226,8 @@ int __init hpet_enable(void)
 {
 	unsigned long id;
 	uint64_t hpet_freq;
-	u64 tmp;
+	u64 tmp, start, now;
+	cycle_t t1;
 
 	if (!is_hpet_capable())
 		return 0;
@@ -273,6 +274,27 @@ int __init hpet_enable(void)
 	/* Start the counter */
 	hpet_start_counter();
 
+	/* Verify whether hpet counter works */
+	t1 = read_hpet();
+	rdtscll(start);
+
+	/*
+	 * We don't know the TSC frequency yet, but waiting for
+	 * 200000 TSC cycles is safe:
+	 * 4 GHz == 50us
+	 * 1 GHz == 200us
+	 */
+	do {
+		rep_nop();
+		rdtscll(now);
+	} while ((now - start) < 200000UL);
+
+	if (t1 == read_hpet()) {
+		printk(KERN_WARNING
+		       "HPET counter not counting. HPET disabled\n");
+		goto out_nohpet;
+	}
+
 	/* Initialize and register HPET clocksource
 	 *
 	 * hpet period is in femto seconds per cycle
_


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3279
retrieving revision 1.3280
diff -u -r1.3279 -r1.3280
--- kernel-2.6.spec	12 Jul 2007 22:38:44 -0000	1.3279
+++ kernel-2.6.spec	12 Jul 2007 22:40:24 -0000	1.3280
@@ -510,7 +510,9 @@
 #Patch20: nouveau-drm.patch
 Patch30: linux-2.6-sysrq-c.patch
 Patch40: linux-2.6-x86-tune-generic.patch
-Patch50: linux-2.6-x86-vga-vidfail.patch
+Patch41: linux-2.6-x86-vga-vidfail.patch
+Patch42: linux-2.6-i386-hpet-check-if-the-counter-works.patch
+
 Patch90: linux-2.6-kvm-suspend.patch
 Patch91: linux-2.6-amd-disabled-svm-detect.patch
 Patch92: linux-2.6-amd-disabled-svm-detect-msr-1.patch
@@ -1068,6 +1070,9 @@
 # for the installer cd that wants to automatically fall back to textmode
 # in that case
 ApplyPatch linux-2.6-x86-vga-vidfail.patch
+# Check the hpet is counting.
+ApplyPatch linux-2.6-i386-hpet-check-if-the-counter-works.patch
+
 # patch to fix suspend with kvm loaded and guests running
 ApplyPatch linux-2.6-kvm-suspend.patch
 # detect svm disabled by bios, prevent oops on load
@@ -2167,6 +2172,10 @@
 
 %changelog
 * Thu Jul 12 2007 Dave Jones <davej at redhat.com>
+- Some systems have a HPET which is not incrementing, which leads
+  to a complete hang.  Detect it during HPET setup.
+
+* Thu Jul 12 2007 Dave Jones <davej at redhat.com>
 - Replace the pcspkr private PIT lock by the global PIT lock to
   serialize the PIT access all over the place.
 




More information about the scm-commits mailing list