rpms/kernel/F-8 linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch, NONE, 1.1 linux-2.6-x86-hpet-02-read-back-compare-register.patch, NONE, 1.1 linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch, NONE, 1.1 linux-2.6-x86-hpet-04-workaround-sb700-bios.patch, NONE, 1.1 kernel.spec, 1.526, 1.527

Chuck Ebbert cebbert at fedoraproject.org
Tue Sep 9 05:42:31 UTC 2008


Author: cebbert

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

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch 
	linux-2.6-x86-hpet-02-read-back-compare-register.patch 
	linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch 
	linux-2.6-x86-hpet-04-workaround-sb700-bios.patch 
Log Message:
HPET fixes from 2.6.27

linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch:

--- NEW FILE linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch ---
From: Thomas Gleixner <tglx at linutronix.de>
Date: Sat, 6 Sep 2008 01:03:32 +0000 (+0200)
Subject: x86: HPET fix moronic 32/64bit thinko
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f7676254f179eac6b5244a80195ec8ae0e9d4606

x86: HPET fix moronic 32/64bit thinko

We use the HPET only in 32bit mode because:
1) some HPETs are 32bit only
2) on i386 there is no way to read/write the HPET atomic 64bit wide

The HPET code unification done by the "moron of the year" did
not take into account that unsigned long is different on 32 and
64 bit.

This thinko results in a possible endless loop in the clockevents
code, when the return comparison fails due to the 64bit/332bit
unawareness.

unsigned long cnt = (u32) hpet_read() + delta can wrap over 32bit.
but the final compare will fail and return -ETIME causing endless
loops.

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 2256315..801497a 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -270,15 +270,15 @@ static void hpet_legacy_set_mode(enum clock_event_mode mode,
 }
 
 static int hpet_legacy_next_event(unsigned long delta,
-			   struct clock_event_device *evt)
+				  struct clock_event_device *evt)
 {
-	unsigned long cnt;
+	u32 cnt;
 
 	cnt = hpet_readl(HPET_COUNTER);
-	cnt += delta;
+	cnt += (u32) delta;
 	hpet_writel(cnt, HPET_T0_CMP);
 
-	return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0;
+	return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
 }
 
 /*

linux-2.6-x86-hpet-02-read-back-compare-register.patch:

--- NEW FILE linux-2.6-x86-hpet-02-read-back-compare-register.patch ---
From: Thomas Gleixner <tglx at linutronix.de>
Date: Sat, 6 Sep 2008 01:06:08 +0000 (+0200)
Subject: x86: HPET: read back compare register before reading counter
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=72d43d9bc9210d24d09202eaf219eac09e17b339

x86: HPET: read back compare register before reading counter

After fixing the u32 thinko I sill had occasional hickups on ATI chipsets
with small deltas. There seems to be a delay between writing the compare
register and the transffer to the internal register which triggers the
interrupt. Reading back the value makes sure, that it hit the internal
match register befor we compare against the counter value.

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 801497a..73deaff 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -278,6 +278,13 @@ static int hpet_legacy_next_event(unsigned long delta,
 	cnt += (u32) delta;
 	hpet_writel(cnt, HPET_T0_CMP);
 
+	/*
+	 * We need to read back the CMP register to make sure that
+	 * what we wrote hit the chip before we compare it to the
+	 * counter.
+	 */
+	WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt);
+
 	return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
 }
 

linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch:

--- NEW FILE linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch ---
From: Thomas Gleixner <tglx at linutronix.de>
Date: Wed, 3 Sep 2008 21:37:24 +0000 (+0000)
Subject: HPET: make minimum reprogramming delta useful
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=7cfb0435330364f90f274a26ecdc5f47f738498c

HPET: make minimum reprogramming delta useful

The minimum reprogramming delta was hardcoded in HPET ticks,
which is stupid as it does not work with faster running HPETs.
The C1E idle patches made this prominent on AMD/RS690 chipsets,
where the HPET runs with 25MHz. Set it to 5us which seems to be
a reasonable value and fixes the problems on the bug reporters
machines. We have a further sanity check now in the clock events,
which increases the delta when it is not sufficient.

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Tested-by: Luiz Fernando N. Capitulino <lcapitulino at mandriva.com.br>
Tested-by: Dmitry Nezhevenko <dion at inhex.net>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 59fd3b6..2256315 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -210,8 +210,8 @@ static void hpet_legacy_clockevent_register(void)
 	/* Calculate the min / max delta */
 	hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF,
 							   &hpet_clockevent);
-	hpet_clockevent.min_delta_ns = clockevent_delta2ns(0x30,
-							   &hpet_clockevent);
+	/* 5 usec minimum reprogramming delta. */
+	hpet_clockevent.min_delta_ns = 5000;
 
 	/*
 	 * Start hpet with the boot cpu mask and make it

linux-2.6-x86-hpet-04-workaround-sb700-bios.patch:

--- NEW FILE linux-2.6-x86-hpet-04-workaround-sb700-bios.patch ---
From: Thomas Gleixner <tglx at linutronix.de>
Date: Thu, 14 Aug 2008 10:17:06 +0000 (+0200)
Subject: x86: hpet: workaround SB700 BIOS
X-Git-Tag: v2.6.27-rc4~52^2~17
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=a6825f1c1fa83b1e92b6715ee5771a4d6524d3b9

x86: hpet: workaround SB700 BIOS

AMD SB700 based systems with spread spectrum enabled use a SMM based
HPET emulation to provide proper frequency setting. The SMM code is
initialized with the first HPET register access and takes some time to
complete. During this time the config register reads 0xffffffff. We
check for max. 1000 loops whether the config register reads a non
0xffffffff value to make sure that HPET is up and running before we go
further. A counting loop is safe, as the HPET access takes thousands
of CPU cycles. On non SB700 based machines this check is only done
once and has no side effects.

Based on a quirk patch from: crane cai <crane.cai at amd.com>

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index ad2b15a..59fd3b6 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -359,6 +359,7 @@ static int hpet_clocksource_register(void)
 int __init hpet_enable(void)
 {
 	unsigned long id;
+	int i;
 
 	if (!is_hpet_capable())
 		return 0;
@@ -369,6 +370,29 @@ int __init hpet_enable(void)
 	 * Read the period and check for a sane value:
 	 */
 	hpet_period = hpet_readl(HPET_PERIOD);
+
+	/*
+	 * AMD SB700 based systems with spread spectrum enabled use a
+	 * SMM based HPET emulation to provide proper frequency
+	 * setting. The SMM code is initialized with the first HPET
+	 * register access and takes some time to complete. During
+	 * this time the config register reads 0xffffffff. We check
+	 * for max. 1000 loops whether the config register reads a non
+	 * 0xffffffff value to make sure that HPET is up and running
+	 * before we go further. A counting loop is safe, as the HPET
+	 * access takes thousands of CPU cycles. On non SB700 based
+	 * machines this check is only done once and has no side
+	 * effects.
+	 */
+	for (i = 0; hpet_readl(HPET_CFG) == 0xFFFFFFFF; i++) {
+		if (i == 1000) {
+			printk(KERN_WARNING
+			       "HPET config register value = 0xFFFFFFFF. "
+			       "Disabling HPET\n");
+			goto out_nohpet;
+		}
+	}
+
 	if (hpet_period < HPET_MIN_PERIOD || hpet_period > HPET_MAX_PERIOD)
 		goto out_nohpet;
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.526
retrieving revision 1.527
diff -u -r1.526 -r1.527
--- kernel.spec	8 Sep 2008 18:52:53 -0000	1.526
+++ kernel.spec	9 Sep 2008 05:42:01 -0000	1.527
@@ -583,6 +583,10 @@
 Patch91: linux-2.6-x86-fix-oprofile-and-hibernation-issues.patch
 Patch92: linux-2.6-x86-32-amd-c1e-force-timer-broadcast-late.patch
 Patch93: linux-2.6-x86-pat-proper-tracking-of-set_memory_uc.patch
+Patch94: linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch
+Patch95: linux-2.6-x86-hpet-02-read-back-compare-register.patch
+Patch96: linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch
+Patch97: linux-2.6-x86-hpet-04-workaround-sb700-bios.patch
 
 #ALSA
 
@@ -1018,6 +1022,11 @@
 ApplyPatch linux-2.6-x86-32-amd-c1e-force-timer-broadcast-late.patch
 #
 ApplyPatch linux-2.6-x86-pat-proper-tracking-of-set_memory_uc.patch
+# hpet fixes from 2.6.27
+ApplyPatch linux-2.6-x86-hpet-01-fix-moronic-32-64-bit-thinko.patch
+ApplyPatch linux-2.6-x86-hpet-02-read-back-compare-register.patch
+ApplyPatch linux-2.6-x86-hpet-03-make-minimum-reprogramming-delta-useful.patch
+ApplyPatch linux-2.6-x86-hpet-04-workaround-sb700-bios.patch
 
 #
 # PowerPC
@@ -1814,6 +1823,9 @@
 
 
 %changelog
+* Mon Sep 08 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-17
+- HPET fixes from 2.6.27
+
 * Mon Sep 08 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-16
 - Linux 2.6.26.5
 




More information about the fedora-extras-commits mailing list