All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powernow-k7 settling time
@ 2004-01-13 22:39 Jens David
  2004-01-13 23:09 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Jens David @ 2004-01-13 22:39 UTC (permalink / raw)
  To: davej, hpa; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

Hi Dave, Jeff & all,

I do not know exactly where to send this patch to, so please
forward as appropriate.

This patch is needed to get powernow-k7 to work on my el-cheapo
notebook. It seems that the BIOS table that describes the voltage
regulator settling time and possible frequency/clock combinations
is buggy in some cases (such as mine). Specifically if the settling
time is not large enough we switch clock frequencies too soon,
resulting in system instability and possible hardware damage.
This patch analyzes the value suggested by the BIOS and if too
low (I do not believe any general-purpose high current CPU VR
design will settle in under 5ms) it uses a standard value (50ms).
As long as nobody is gonna try delta-sigma modulation of the main
CPU clock the performance loss is probably neglectible. ;-)
I wrote myself a little testbench and with this patch my system works
stable no matter how often I switch and what applications are running
(mplayer proved to be a good test case) provided that clock frequencies
are not adjusted below the 796 MHz (core) step (K7-2000+).

Patch against linux-2.4.24-0pre2.1mdk from current Mandrake Cooker.
Should apply cleanly to powernow-patched vanilla-2.4.x as well. Probably
relevant for Linux-2.6, too.

-- j



-- 
Jens David, DG1KJD
Email: dg1kjd@afthd.tu-darmstadt.de
http://www.afthd.tu-darmstadt.de/~dg1kjd
Work: +49 351 80800 527  ---  Home/Mobile: +49 173 6394993





[-- Attachment #2: Increase settling time if value provided by BIOS is too low. Patch against Linux-2.4.24-0pre2.1mdk --]
[-- Type: text/x-diff, Size: 1005 bytes --]

--- linux-2.4.24-0.pre2.1mdk.orig/arch/i386/kernel/powernow-k7.c	2004-01-13 18:02:27.000000000 +0100
+++ linux-2.4.24-0.pre2.1mdk/arch/i386/kernel/powernow-k7.c	2004-01-13 22:26:09.000000000 +0100
@@ -313,8 +313,16 @@ static int powernow_decode_bios (int max
 			}
 			dprintk (" voltage regulator)\n");
 
-			latency = psb->settlingtime;
-			dprintk (KERN_INFO PFX "Settling Time: %d microseconds.\n", psb->settlingtime);
+			dprintk (KERN_INFO PFX "Settling Time from BIOS: %d microseconds.\n", psb->settlingtime);
+			if (psb->settlingtime >= 5000) {      /* >= 5ms? */
+				dprintk (KERN_INFO PFX "Using BIOS Settling Time.\n");
+				latency = psb->settlingtime;
+			} else {
+			        /* no, table probably wrong, be conservative: set to 50 ms */
+				dprintk (KERN_INFO PFX "Settling Time seems too small, correcting!\n");
+				latency = 50000;
+			}
+			
 			dprintk (KERN_INFO PFX "Has %d PST tables. (Only dumping ones relevant to this CPU).\n", psb->numpst);
 
 			p += sizeof (struct psb_s);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powernow-k7 settling time
  2004-01-13 22:39 [PATCH] powernow-k7 settling time Jens David
@ 2004-01-13 23:09 ` Dave Jones
  2004-01-20 18:50   ` Ducrot Bruno
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2004-01-13 23:09 UTC (permalink / raw)
  To: Jens David; +Cc: hpa, linux-kernel

On Tue, Jan 13, 2004 at 11:39:39PM +0100, Jens David wrote:

 > Patch against linux-2.4.24-0pre2.1mdk from current Mandrake Cooker.
 > Should apply cleanly to powernow-patched vanilla-2.4.x as well. Probably
 > relevant for Linux-2.6, too.

2.6 fixed this a few months back, in a different way.
(The code misinterpreted the spec back then, so we were doing
 all sorts of sillyness).

If Mandrake are still running the old version of the driver in their
update kernel, you might want to bug them about it, as there have been
numerous updates since then fixing lots of bugs.

		Dave


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powernow-k7 settling time
  2004-01-13 23:09 ` Dave Jones
@ 2004-01-20 18:50   ` Ducrot Bruno
  0 siblings, 0 replies; 3+ messages in thread
From: Ducrot Bruno @ 2004-01-20 18:50 UTC (permalink / raw)
  To: Dave Jones, Jens David, hpa, linux-kernel; +Cc: ducrot

On Tue, Jan 13, 2004 at 11:09:04PM +0000, Dave Jones wrote:
> On Tue, Jan 13, 2004 at 11:39:39PM +0100, Jens David wrote:
> 
>  > Patch against linux-2.4.24-0pre2.1mdk from current Mandrake Cooker.
>  > Should apply cleanly to powernow-patched vanilla-2.4.x as well. Probably
>  > relevant for Linux-2.6, too.
> 
> 2.6 fixed this a few months back, in a different way.
> (The code misinterpreted the spec back then, so we were doing
>  all sorts of sillyness).
> 
> If Mandrake are still running the old version of the driver in their
> update kernel, you might want to bug them about it, as there have been
> numerous updates since then fixing lots of bugs.
> 

It's fixed in the CVS repo for linux-2.4 tree at the same time as for 2.6.

-- 
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-20 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13 22:39 [PATCH] powernow-k7 settling time Jens David
2004-01-13 23:09 ` Dave Jones
2004-01-20 18:50   ` Ducrot Bruno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.