View previous topic :: View next topic |
Author |
Message |
AlterEgo Veteran
Joined: 25 Apr 2002 Posts: 1619
|
Posted: Wed Jun 09, 2004 12:03 pm Post subject: CPU scaling; Mobile AthlonXP on desktop board ? |
|
|
I like silence. Less power = less heat = less fans = more silence
Therefore, I've modified a desktop AthlonXP2000+ (Palomino) into a mobile Athlon. It runs on a MSI KT3Ultra2, and it is recognised as a mobile processor by the BIOS. It is also properly recognised by diagnostic tools, in both Win (Sandra/AIDA) and linux (x86info).
In Windows, I can easily throttle the CPU using CPUMSR or other tools ( link in Dutch, for who's interested ).
In linux, after having applied the proper kernel 2.6.6 config, dmesg tells me:
Code: |
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: FSB: 133.366 MHz
powernow: Trying ACPI perflib
powernow: ACPI perflib can not be used in this platform
powernow: ACPI and legacy methods failed
powernow: See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.shtml
|
I guess this means that the BIOS does not contain the proper tables with CPU-modes.
Also, /sys/devices/system/cpu/cpu0/cpufreq/ is missing.
Is there anything I can do to make CPU throttling work in linux without ACPI perflib, like can be done in Windows?
No is not an answer
I did try ACPI throttling, and this "works" i.e., I can make the computer slow like a snail, but the temps will not go down. |
|
Back to top |
|
|
HardenCoonor n00b
Joined: 19 Feb 2004 Posts: 54
|
Posted: Wed Jun 09, 2004 1:39 pm Post subject: |
|
|
Hi there,
I am also looking for a solution.
It is true, the powernow-k7 driver does not work, if you do not have a pst table in your bios that matches you cpuid and other prerequisites(fsb, voltage and stuff).
I have a ECS K7S5A Pro, which works perfectly under the evil empire OS, with that CPUMSR-software, though my MB does not support voltage adjustment, but 1.467 GHz(11x133) @1.5Volt is quit good, before it was 1.4GHz(10.5x133)@1.75Volt, which is quite hot(>55°C onDie).
Nevermind, i tried to modify the powernow-k7.c file, so it does not use PST-tables provided by the bios, instead makes up a cpufreq table itself, depending on maxfid, with no voltage adjustment.
But since i am no programmer, my driver failed, the kernel gave an error message and my pc hang.
One major error was that the fsb was miscalculated, something with the fid codes i got wrong.
I did not look into the governors' code, so i do not know if such a simple cpufreq table is enough(i mean only fid and speed). Kernel hacking is something only for kernel-developers.
@AlterEgo: Maybe you are a bit into programming (I guess the powernow-k7 is written C), maybe i can post the code i have, well, not written, but adapted(taken out ACPI-related, added mobile-vid-table, dektop-vid-table etc.).
Before the summer is getting real hot(and the PC too), i think there should be a result, or i will throttle it via fsb. |
|
Back to top |
|
|
vyral_surfer n00b
Joined: 18 Jul 2004 Posts: 3
|
Posted: Sun Jul 18, 2004 7:37 am Post subject: |
|
|
I'm in the same boat as you over here. I recently modded my Athlon XP 2400+ to be mobile, and am looking to scale the processor down when I'm not using it. I tried various methods. and always got this:
Code: |
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: FSB: 133.366 MHz
powernow: Trying ACPI perflib
powernow: ACPI perflib can not be used in this platform
powernow: ACPI and legacy methods failed
powernow: See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.shtml
|
Today, i noticed this post. I tried brodo's advice, and with powernow_k7.acpi_force=1 on the kernel command line, I get this:
Code: |
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: PSB/PST known to be broken. Trying ACPI instead
powernow: ACPI perflib can not be used in this platform
|
I wonder what is meant by "this platform"... |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Mon Jul 19, 2004 9:44 am Post subject: |
|
|
For throttling check out Code: | /proc/acpi/processor/*/throttling | . powernow-k7 is for frequency (and voltage) scaling. |
|
Back to top |
|
|
HardenCoonor n00b
Joined: 19 Feb 2004 Posts: 54
|
Posted: Mon Jul 19, 2004 11:22 am Post subject: |
|
|
Quote: | powernow-k7 is for frequency (and voltage) scaling. |
I guess we mean the same thing here with throttling/scaling, that is to alter the frequency the cpu is working at, from 3 GHz to 400 MHz and back. Voltage scaling is just a by-product, which is not that important for me since it does not work on my Mainboard.
I searched the Internet (or at least the googled part of it) for ACPI perflib, but to no avail.
From my point of view, there should be written a new driver for those cpu-modders among us, especially for the mobile athlons/durons. This driver should provide us with a working cpufreq-table the governors can use, with or without voltage. Maybe someone comes across this thread, who is capable of rewriting either powernow-k7.c or writing a new kernel module.
Maybe anyone interested in this should take a look at powernow-k7.c and/or the governors, maybe you get an idea how it could be done. |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Mon Jul 19, 2004 11:53 am Post subject: |
|
|
HardenCoonor wrote: | Quote: | powernow-k7 is for frequency (and voltage) scaling. |
I guess we mean the same thing here with throttling/scaling, that is to alter the frequency the cpu is working at, from 3 GHz to 400 MHz and back. |
Throttling is _very_ different to scaling: throttling means possibly large latency and less energy saving than frequency scaling alone.
HardenCoonor wrote: | I searched the Internet (or at least the googled part of it) for ACPI perflib, but to no avail. |
This does not surprise me. The ACPI perflib can only provide frequency/voltage pairs to the powernow-k7 or any other cpufreq driver if the BIOS exports these pairs inside the ACPI tables. As it's a pre-k8 desktop BIOS it doesn't know about "ACPI P-States" as it's technically called, so it can't export such information in the ACPI tables. Neither will the "direct"/"legacy" BIOS method called PSB work -- again, the BIOS is a pre-k8 desktop BIOS and doesn't know anything about frequency scaling because of that.
HardenCoonor wrote: | From my point of view, there should be written a new driver for those cpu-modders among us, especially for the mobile athlons/durons. This driver should provide us with a working cpufreq-table the governors can use, with or without voltage. Maybe someone comes across this thread, who is capable of rewriting either powernow-k7.c or writing a new kernel module.
Maybe anyone interested in this should take a look at powernow-k7.c and/or the governors, maybe you get an idea how it could be done. |
There are different approaches on how to provide such functionality in the powernow-k7 driver, but as it requires hardwiring frequency/voltage pairs, or even only valid frequencies, incorrect settings might cause permanent hardware damage, it will[*] only be available to "expert users" who know how to patch their kernels, how to modify some lines of code etc. See, for example, this thread on the cpufreq mailing list for details:
http://www.linux.org.uk/mailman/private/cpufreq/2004-June/003812.html
[note: subscription required, but you can disable message delivery]
[*] e.g. see Dave's opinion on this matter at http://www.linux.org.uk/mailman/private/cpufreq/2004-June/003815.html, which illustrates the current and former cpufreq maintainer are of the same opinion. |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Mon Jul 19, 2004 11:55 am Post subject: |
|
|
brodo wrote: | HardenCoonor wrote: | Quote: | powernow-k7 is for frequency (and voltage) scaling. |
I guess we mean the same thing here with throttling/scaling, that is to alter the frequency the cpu is working at, from 3 GHz to 400 MHz and back. |
Throttling is _very_ different to scaling: throttling means possibly large latency and less energy saving than frequency scaling alone. |
Addendum: throttling is also easier to implement, and desktop chipsets and/or BIOSes usally are aware of this thermal management method. |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Mon Jul 19, 2004 11:58 am Post subject: Re: CPU scaling; Mobile AthlonXP on desktop board ? |
|
|
AlterEgo wrote: | I did try ACPI throttling, and this "works" i.e., I can make the computer slow like a snail, but the temps will not go down. |
The "idling" of a CPU if there's no work to do is quite the same as is done when throttling is done. That means the temperature should not go as high on high loads if throttling is enabled, as the CPU is "forced" to sit idle for short periods of time.
As a sidenote: because of the technical equivalence of "idling" and "throttling" there's no sense in doing dynamic throttling: if the CPU is idle, it doesn't matter what throttling state it is in. |
|
Back to top |
|
|
HardenCoonor n00b
Joined: 19 Feb 2004 Posts: 54
|
Posted: Wed Sep 01, 2004 10:01 am Post subject: |
|
|
Quote: | There are different approaches on how to provide such functionality in the powernow-k7 driver, but as it requires hardwiring frequency/voltage pairs, or even only valid frequencies, incorrect settings might cause permanent hardware damage, it will[*] only be available to "expert users" who know how to patch their kernels, how to modify some lines of code etc. |
On these forums here there are only expert users, or persons who want to become experts . But i have to agree on that. The only way to find out which pairs of FID/VID work is to test it under Windows with cpumsr, and of course to think about what you do before you do it.
For users of mobile processors on desktop mainboards it is probably good to know that i guess most of them cannot change voltage, but only frequency, at least my K7S5A Pro is one of them.
Finally, now the hot summer days are gone, i was able to successfully edit the powernow-k7.c. I have modified the file with a hardcoded pst table. I have a Duron with 11x max multiplier, with the multipliers from 3x to 11x all working, at least in Windows(using cpumsr). Using powernowd, my pc scales from 1467 to 401 MHz, with the temperature being as low as 32°C.
##############################################
Before using the patch, please adjust NUM_GENERIC_PST, max multiplier, and/or VID to suit your configuration. For valid vid or fid codes please look at the powernow-k7.c, into the vid_tables and fid_tables.
Suggestions for improving the code are welcome.
Here is the patch:
Code: |
--- /usr/src/linux-2.6.8.1-nitro6/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-08-31 20:03:12.000000000 +0200
+++ powernow-k7.c 2004-08-31 20:18:07.998253336 +0200
@@ -36,6 +36,8 @@
#include "powernow-k7.h"
+#define NUM_GENERIC_PSTS 30
+
#define DEBUG
#ifdef DEBUG
@@ -176,6 +178,36 @@
unsigned int speed;
u8 fid, vid;
+ /************************************************
+ * HardenCoonor: generic voltages / frequencies for
+ * Mobile Athlons with buggy BIOS
+ ************************************************/
+
+ pst = kmalloc ( NUM_GENERIC_PSTS *sizeof(unsigned char), GFP_KERNEL);
+ if (!pst) return -ENOMEM;
+
+ /* FID */ /* VID */
+ *pst++ = 0x10; /* 3.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x12; /* 4.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x04; /* 5.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x05; /* 5.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x06; /* 6.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x07; /* 6.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x08; /* 7.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x09; /* 7.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0A; /* 8.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0B; /* 8.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0C; /* 9.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0D; /* 9.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0E; /* 10.0x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x0F; /* 10.5x */ *pst++ = 0x0A; /* 1.50V */
+ *pst++ = 0x00; /* 11.0x */ *pst++ = 0x0A; /* 1.50V */
+
+ /* Set PST ptr back to base addr of table */
+ pst -= NUM_GENERIC_PSTS;
+ /************************************************/
+
+
powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table) * (number_scales + 1)), GFP_KERNEL);
if (!powernow_table)
return -ENOMEM;
@@ -424,6 +456,11 @@
unsigned int ret;
etuple = cpuid_eax(0x80000001);
+
+ /* HardenCoonor: fix for broken PSB in Compaq Presario 2100 series */
+ dprintk (KERN_INFO PFX "Our CPU maxfid 0x%x\n", maxfid);
+ dprintk (KERN_INFO PFX "Our CPU startvid 0x%x\n", startvid);
+ dprintk (KERN_INFO PFX "WARNING: This driver has been modified with a generic PST table\n");
for (i=0xC0000; i < 0xffff0 ; i+=16) {
@@ -461,25 +498,30 @@
for (i = 0 ; i <psb->numpst; i++) {
pst = (struct pst_s *) p;
- number_scales = pst->numpstates;
-
if ((etuple == pst->cpuid) && check_fsb(pst->fsbspeed) &&
(maxfid==pst->maxfid) && (startvid==pst->startvid))
{
+ number_scales = pst->numpstates;
dprintk (KERN_INFO PFX "PST:%d (@%p)\n", i, pst);
dprintk (KERN_INFO PFX " cpuid: 0x%x\t", pst->cpuid);
dprintk ("fsb: %d\t", pst->fsbspeed);
dprintk ("maxFID: 0x%x\t", pst->maxfid);
dprintk ("startvid: 0x%x\n", pst->startvid);
-
ret = get_ranges ((char *) pst + sizeof (struct pst_s));
return ret;
-
} else {
p = (char *) pst + sizeof (struct pst_s);
- for (j=0 ; j < number_scales; j++)
- p+=2;
+ for (j=0 ; j < number_scales; j++)
+ p+=2;
}
+ /* HardenCoonor: modified for generic method */
+ number_scales = NUM_GENERIC_PSTS / 2;
+ dprintk (KERN_INFO PFX " cpuid: 0x%x ", pst->cpuid);
+ dprintk ("fsb: %d\t", fsb);
+ dprintk ("maxFID: 0x%x\t", maxfid);
+ dprintk ("startvid: 0x%x\n", startvid);
+ ret = get_ranges ((char *) pst + sizeof (struct pst_s));
+ return ret;
}
printk (KERN_INFO PFX "No PST tables match this cpuid (0x%x)\n", etuple);
printk (KERN_INFO PFX "This is indicative of a broken BIOS.\n");
|
#################
This work is based on the patch of a person named baitisj, which can be found on the Internet. |
|
Back to top |
|
|
new_nOOb Apprentice
Joined: 05 Mar 2004 Posts: 280
|
Posted: Sun Oct 10, 2004 8:20 pm Post subject: |
|
|
hello. can you post the completely powernow k7.c file because i can´t patch it
thank´s |
|
Back to top |
|
|
doom4 Tux's lil' helper
Joined: 23 Sep 2004 Posts: 119 Location: South Africa
|
Posted: Sun Oct 10, 2004 8:48 pm Post subject: |
|
|
i dont know if i am right here but how can you make from a normal athlon an ahtlon m i was wondering about. perhaps you can help me to know how. thx |
|
Back to top |
|
|
new_nOOb Apprentice
Joined: 05 Mar 2004 Posts: 280
|
Posted: Wed Oct 13, 2004 8:57 pm Post subject: |
|
|
have nobody a working powernow-k7.c for a mobile cpu on a desktop board |
|
Back to top |
|
|
new_nOOb Apprentice
Joined: 05 Mar 2004 Posts: 280
|
Posted: Sat Nov 13, 2004 12:09 am Post subject: |
|
|
any news?? |
|
Back to top |
|
|
f1n4rf1n n00b
Joined: 30 May 2004 Posts: 46 Location: Osnabrueck [ger]
|
Posted: Mon Jan 10, 2005 8:29 pm Post subject: |
|
|
I'd also be very interested..
MSI KT880 with Athlon XP-M |
|
Back to top |
|
|
luisfeser Guru
Joined: 22 May 2004 Posts: 543 Location: /España/Toledo
|
Posted: Mon Jan 10, 2005 10:49 pm Post subject: |
|
|
I have a barton mobile in a nforce2 (desktop computer), and cpu scaling worked in a 2.6.7 kernel (when i used it), but with 2.6.10 it hangs the computer, i don't know why (using cpufreq).
But i think this is not very usefull in a desktop computer, because (at least when i tried) only changed the fsb, and the temperature was the same and the noise too.
If the voltage really change, then it will be usefull, but if not..... _________________ AMD Athlon XP-M 2500+ @2200MhHz|1GB DDR @400MHz Dual-Chanel|NVIDIA GeForce4 MX 420|SB Live 5.1|ADSL 512/128 Arsys
gentoo ~x86 |
|
Back to top |
|
|
YANOUSHek Apprentice
Joined: 10 May 2004 Posts: 282 Location: Poznan, Poland;
|
Posted: Tue Jan 11, 2005 1:31 am Post subject: |
|
|
Sorry if I'm makeing something wrong, but I didn't read the whole topic carefully.
I own a Mobile Athlon XP notebook and I didn't have any problems with the CPU throtling. I just use the drivers (powernow) from the kernel (2.6.9-gentoo-r9) and the throttling is rather easy:
Code: | ___ root # cd /sys/devices/system/cpu/cpu0/cpufreq/ |
and then you have all the needed options:
1. listing available frequencies:
Code: | ___ cpufreq # cat scaling_available_frequencies
1788736 1457489 1059992 794994 662495 529996 |
2. changing the frequency:
Code: | ___ cpufreq # cat cpuinfo_min_freq >scaling_max_freq |
It works without a problem. The temperature of my laptop goes down instantly and the vent goes off - great for watching movies ;) _________________ Janusz Bossy
http://digigal.art.pl |
|
Back to top |
|
|
weingbz n00b
Joined: 29 Jan 2005 Posts: 46
|
Posted: Tue Feb 08, 2005 11:30 pm Post subject: Re: CPU scaling; Mobile AthlonXP on desktop board ? |
|
|
In case this still interests anyone I have found part of the solution.
AlterEgo wrote: | I like silence. Less power = less heat = less fans = more silence
Therefore, I've modified a desktop AthlonXP2000+ (Palomino) into a mobile Athlon. It runs on a MSI KT3Ultra2, and it is recognised as a mobile processor by the BIOS. It is also properly recognised by diagnostic tools, in both Win (Sandra/AIDA) and linux (x86info).
|
I too have the KT3 Ultra 2
AlterEgo wrote: |
dmesg tells me:
Code: |
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: FSB: 133.366 MHz
powernow: Trying ACPI perflib
powernow: ACPI perflib can not be used in this platform
powernow: ACPI and legacy methods failed
powernow: See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.shtml
|
I guess this means that the BIOS does not contain the proper tables with CPU-modes.
Also, /sys/devices/system/cpu/cpu0/cpufreq/ is missing.
|
Oh here's what I got:
Apply these two patches against kernel 2.6.11-rc2 or rc3:
Code: |
--- linux/arch/i386/kernel/cpu/cpufreq/Kconfig.orig 2005-01-25 19:54:17.000000000 +0100
+++ linux/arch/i386/kernel/cpu/cpufreq/Kconfig 2005-01-25 20:07:52.000000000 +0100
@@ -71,6 +71,17 @@
depends on ((X86_POWERNOW_K7 = "m" && ACPI_PROCESSOR) || (X86_POWERNOW_K7 = "y" && ACPI_PROCESSOR = "y"))
default y
+config X86_POWERNOW_K7_MANUAL
+ bool "Manual setting of PowerNow! table for AMD Mobile Athlon/Duron."
+ depends on X86_POWERNOW_K7
+ default n
+ help
+ This adds the possibility to manual change the PST table.
+
+ For details, take a look at <file:Documentation/cpu-freq/>.
+
+ If in doubt, say N.
+
config X86_POWERNOW_K8
tristate "AMD Opteron/Athlon64 PowerNow!"
depends on CPU_FREQ_TABLE && EXPERIMENTAL
|
and
Code: |
--- linux/arch/i386/kernel/cpu/cpufreq/powernow-k7.c.orig 2005-01-25 19:54:10.000000000 +0100
+++ linux/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2005-01-25 20:06:12.000000000 +0100
@@ -66,7 +66,7 @@
};
#endif
-#ifdef CONFIG_CPU_FREQ_DEBUG
+#if defined CONFIG_CPU_FREQ_DEBUG || defined CONFIG_X86_POWERNOW_K7_MANUAL
/* divide by 1000 to get VCore voltage in V. */
static int mobile_vid_table[32] = {
2000, 1950, 1900, 1850, 1800, 1750, 1700, 1650,
@@ -76,7 +76,7 @@
};
#endif
-/* divide by 10 to get FID. */
+/* divide by 10 to get multiplier. */
static int fid_codes[32] = {
110, 115, 120, 125, 50, 55, 60, 65,
70, 75, 80, 85, 90, 95, 100, 105,
@@ -84,6 +84,31 @@
150, 225, 160, 165, 170, 180, -1, -1,
};
+#ifdef CONFIG_X86_POWERNOW_K7_MANUAL
+/* translation table for even multiplier to fid */
+static int even_multiplier[20] = {
+ 16, 18, 4, 6, 8, 10, 12, 14, // 3, 4, 5, 6, 7 ,8 , 9, 10
+ 0, 2, 20, 22, 24, 26, 28, 29, // 11, 12, 13, 14, 15, 16, 17, 18
+ 17, 19, 23, 25, // 19, 20, 21, 22
+};
+
+/* translation table for odd multiplier to fid*/
+static int odd_multiplier[9] = {
+ 5, 7, 9, 11, 13, 15, 1, 3, // 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5
+ 21, // 13.5
+};
+
+/* This parameters can be used to manually overwrite the tables */
+static int overwrite_table = 0;
+#define MAX_PST 10
+static int multiplier_arr_size = MAX_PST;
+static int voltage_arr_size = MAX_PST;
+static int multiplier[MAX_PST] = {[0 ... (MAX_PST - 1)] = 0 };
+static int voltage[MAX_PST] = {[0 ... (MAX_PST - 1)] = 0 };
+static int switch_latency = 0;
+#endif /* CONFIG_X86_POWERNOW_K7_MANUAL */
+
+
/* This parameter is used in order to force ACPI instead of legacy method for
* configuration purpose.
*/
@@ -97,7 +122,7 @@
static unsigned int minimum_speed=-1;
static unsigned int maximum_speed;
static unsigned int number_scales;
-static unsigned int fsb;
+static unsigned int fsb=0;
static unsigned int latency;
static char have_a0;
@@ -413,6 +438,143 @@
}
#endif
+#ifdef CONFIG_X86_POWERNOW_K7_MANUAL
+static int powernow_manual_settings(union msr_fidvidstatus *fidvidstatus)
+{
+ int i, k, validentry;
+ unsigned int max_multiplier, max_voltage;
+ unsigned int speed, cm;
+ u8 vid, fid;
+ static struct cpufreq_frequency_table *powernow_table_tmp;
+
+ if (switch_latency > 0) {
+ if (switch_latency < 100) {
+ printk(KERN_INFO PFX
+ "Settling time passed as %d microseconds."
+ "Should be at least 100. Correcting.\n",
+ switch_latency);
+ switch_latency = 100;
+ }
+ latency = switch_latency;
+ } else {
+ latency = 200;
+ }
+ dprintk("Settling Time: %d microseconds.\n", latency);
+
+ /* get number of specified multipliers */
+ number_scales = multiplier_arr_size;
+ for (i = 0; i < multiplier_arr_size; i++) {
+ if (multiplier[i] == 0) {
+ number_scales = i;
+ break;
+ }
+ }
+
+ /* get maximum values */
+ max_multiplier = fid_codes[fidvidstatus->bits.MFID];
+ max_voltage = mobile_vid_table[fidvidstatus->bits.MVID];
+
+ /* allocate memory */
+ powernow_table =
+ kmalloc((sizeof(struct cpufreq_frequency_table) *
+ (number_scales + 1)), GFP_KERNEL);
+ if (!powernow_table)
+ return -ENOMEM;
+ memset(powernow_table, 0,
+ (sizeof(struct cpufreq_frequency_table) * (number_scales + 1)));
+
+ k = 0;
+ for (i = 0; i < number_scales; i++) {
+ validentry = 0;
+ if (multiplier[i] != 0) {
+ /* fix multiplier */
+ if (multiplier[i] < 30)
+ multiplier[i] = multiplier[i] * 10;
+ if (multiplier[i] < max_multiplier) {
+ cm = (multiplier[i] / 10);
+
+ /* check if odd or even muliplier */
+ if (multiplier[i] % 10) {
+ /* odd multiplier */
+ if (cm == 16) {
+ /* hardcoded because 14.5 and 15.5 fids not possible */
+ fid = 27;
+ validentry = 1;
+ } else if ((cm > 4) && (cm < 14)) {
+ fid = odd_multiplier[cm - 5];
+ validentry = 1;
+ }
+ } else {
+ /* even_multiplier */
+ if ((cm < 23) && (cm > 2)) {
+ fid = even_multiplier[cm - 3];
+ validentry = 1;
+ }
+ }
+ }
+ }
+
+ if (validentry) {
+ /* if no voltage specified use CPU default */
+ if (voltage[i] == 0)
+ voltage[i] = max_voltage;
+ /* we do not allow higher voltages than the CPU's maximum 925 mV is the minimum */
+ if ((voltage[i] <= max_voltage) && (voltage[i] >= 925)) {
+ if (voltage[i] >= 1300) {
+ vid = 40 - (voltage[i] / 50);
+ } else {
+ vid = 67 - (voltage[i] / 25);
+ }
+ /* calculate speed */
+ speed = fsb * fid_codes[fid] / 10;
+ powernow_table[k].frequency = speed;
+ powernow_table[k].index = fid; /*lower 8 bits */
+ powernow_table[k].index |= (vid << 8); /*upper 8 bits */
+
+ if (speed < minimum_speed)
+ minimum_speed = speed;
+ if (speed > maximum_speed)
+ maximum_speed = speed;
+
+ dprintk(" FID: 0x%x (%d.%dx [%dMHz])\t", fid,
+ fid_codes[fid] / 10,
+ fid_codes[fid] % 10, speed / 1000);
+ dprintk("VID: 0x%x (%d.%03dV)\n", vid,
+ mobile_vid_table[vid] / 1000,
+ mobile_vid_table[vid] % 1000);
+ k++;
+ }
+ } else {
+ // invalid entry
+ dprintk("Entry %d is invalid\n", i + 1);
+ }
+ }
+ if (k < number_scales) {
+ /* some entrys were invalid need to realloc table */
+ number_scales = k;
+ powernow_table_tmp =
+ kmalloc((sizeof(struct cpufreq_frequency_table) *
+ (number_scales + 1)), GFP_KERNEL);
+ if (!powernow_table_tmp) {
+ kfree(powernow_table);
+ return -ENOMEM;
+ }
+ memcpy(powernow_table_tmp, powernow_table,
+ (sizeof(struct cpufreq_frequency_table) *
+ (number_scales + 1)));
+ kfree(powernow_table);
+ powernow_table = powernow_table_tmp;
+ }
+
+ /* Terminate frequency list */
+ powernow_table[number_scales].frequency = CPUFREQ_TABLE_END;
+ powernow_table[number_scales].index = 0;
+
+ return 0;
+}
+#endif /* CONFIG_X86_POWERNOW_K7_MANUAL */
+
+
static int powernow_decode_bios (int maxfid, int startvid)
{
struct psb_s *psb;
@@ -585,6 +747,18 @@
return -ENODEV;
rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
+#ifdef CONFIG_X86_POWERNOW_K7_MANUAL
+ if (fsb) {
+ if (fsb < 1000)
+ fsb *= 1000;
+
+ if (fsb < 1000 || fsb > 1000000) {
+ printk(KERN_WARNING PFX "FSB %ukhz out of range\n",
+ fsb);
+ return -EINVAL;
+ }
+ } else
+#endif
/* A K7 with powernow technology is set to max frequency by BIOS */
fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.MFID];
@@ -597,6 +771,12 @@
if (dmi_check_system(powernow_dmi_table) || acpi_force) {
printk (KERN_INFO PFX "PSB/PST known to be broken. Trying ACPI instead\n");
result = powernow_acpi_init();
+#ifdef CONFIG_X86_POWERNOW_K7_MANUAL
+ } else if (overwrite_table) {
+ printk(KERN_INFO PFX
+ "Overwriting PST table with manual settings\n");
+ result = powernow_manual_settings(&fidvidstatus);
+#endif
} else {
result = powernow_decode_bios(fidvidstatus.bits.MFID, fidvidstatus.bits.SVID);
if (result) {
@@ -681,6 +861,22 @@
module_param(acpi_force, int, 0444);
MODULE_PARM_DESC(acpi_force, "Force ACPI to be used.");
+#ifdef CONFIG_X86_POWERNOW_K7_MANUAL
+module_param(overwrite_table, int, 0444);
+MODULE_PARM_DESC(overwrite_table, "overwrite table with manually settings");
+module_param(fsb, uint, 0444);
+MODULE_PARM_DESC(fsb, "(MHz) overrides the calculated FSB");
+module_param_array(multiplier, int, &multiplier_arr_size, 0444);
+MODULE_PARM_DESC(multiplier,
+ "Specifiy up to 10 multipliers, multiply them by 10: 5->50, 5.5->55");
+module_param_array(voltage, int, &voltage_arr_size, 0444);
+MODULE_PARM_DESC(voltage,
+ "Specify voltages in respect to the given multipliers, specify them in mV: 1.275V -> 1275");
+module_param(switch_latency, int, 0444);
+MODULE_PARM_DESC(switch_latency,
+ "Set state transition latency in microseconds (default 200us)");
+#endif
+
MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
MODULE_DESCRIPTION ("Powernow driver for AMD K7 processors.");
MODULE_LICENSE ("GPL");
|
Check the linewraps on the patches, the forum software mangled them a bit.
Activate it as a module and activate the manual override (or do make oldconfig, that should present you with the new features)
Code: |
CONFIG_X86_POWERNOW_K7=m
CONFIG_X86_POWERNOW_K7_ACPI=y
CONFIG_X86_POWERNOW_K7_MANUAL=y
|
Build your kernel and boot it.
Now start the module with something like this command
Code: |
modprobe powernow-k7 overwrite_table=1 multiplier=6,7,8,9,10,11,12 fsb=167
|
If you want odd multipliers you have to multiply them by 10, so 6.5 becomes 65.
The module has the following options:
overwrite_table:
activates the manually settings, set it to >=1
multiplier:
specifies an array of multipliers
voltage:
specifies an array of VCore voltages (default BIOS settings)
switch_latency:
sets the state transition latency in microseconds (default 200us)
fsb:
sets the frontsidebus (default calculated from BIOS settings)
(I have all of this from http://lists.linux.org.uk/mailman/private/cpufreq/2005-January/004847.html
you need to register to be able to read the mailinglist) They talk about putting this into the vanilla 2.6.12 kernel.
Now you should have a choice of frequencies in
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies.
Be careful, because my system freezes if I make too big a change at once, I have the following frequencies:
1169000 1336000 1503000 1670000 1837000 2004000
I don't know if this is a bug or a feature but if I ommit the fsb option I can go to very low frequencies (something like 470 Mhz)
I can't change from the last to the first or vice versa I have to first change to some values in between. This also means that my system hangs if I use the ondemand as governor (because it switches from max to min frequency), you should use userspace until that problem is solved. Also I can't change my voltage which is pretty annoying. The KT3Ultra2 always boots with a multiplier of 15 with my Athlon XP Mobile 2600+ processor. To get that working with a FSB of 166 I have to put in 1.675V (which is enough to boot but not stable for work). I know that I can work with 1.55V at 2Ghz but I can't reduce Vcore.If I try
Code: |
modprobe powernow-k7 overwrite_table=1 multiplier=6,7,8,9,10,11,12 fsb=167 voltage=1550,1550,1550,1550,1550,1550,1550
|
I get
FATAL: Error inserting powernow_k7 (/lib/modules/2.6.11-rc3/kernel/arch/i386/kernel/cpu/cpufreq/powernow-k7.ko): No such device
Does anyone know why? |
|
Back to top |
|
|
weingbz n00b
Joined: 29 Jan 2005 Posts: 46
|
Posted: Fri Feb 11, 2005 6:31 pm Post subject: |
|
|
f1n4rf1n wrote: | I'd also be very interested..
MSI KT880 with Athlon XP-M |
I don't know if you checked my last post but I would be interested if the patches I described work with your board because I'm considering buying a new motherboard but I haven't decided between nforce 2 and Kt880. |
|
Back to top |
|
|
Alan Turing n00b
Joined: 10 Sep 2003 Posts: 53 Location: Freiburg, Baden (Germany)
|
Posted: Thu Mar 03, 2005 4:39 pm Post subject: |
|
|
Hi
First some facts:
Changing the multiplier of K7-mobile CPUs on desktop-boards works on most (maybe all, I don't know) VIA-chipset based mainboards, but not on nForce2 based Mainboards.
Changing the CPU-voltage does not work on most (I don't know any) VIA-based (desktop) mainbords.
nForce2 mainbords support voltage and FSB changing and so you can save power like explained here
_____
I have also a desktop mainbord (Asus A7V600 with VIA KT600 chipset) and a mobile K7.
A few days after HardenCoonor posted his patch, I used it and it worked great.
After a few month (and maybe a few kernel updates) I recognized that it doesn't work alwas correct. Often throttling works correct, but sometimes the multiplier does not change. (I use powernowd). Until today I used the 2.6.9-ck3 kernel.
After 2.6.9 kernel the powernow-k7 module in the kernel had changed and so I needed new patches.
Today I tried development-sources-2.6.11 with the patches posted by weingbz.
First it seems to work correct. I could load the module without failures. powernowd throttled the CPU down, but when I start an application and powernowd should increase CPU speed my system hangs.
Any ideas what I can do or how I can analyze what's gone wrong. |
|
Back to top |
|
|
weingbz n00b
Joined: 29 Jan 2005 Posts: 46
|
Posted: Wed Mar 09, 2005 9:42 pm Post subject: |
|
|
DeBIGBOSS wrote: | Hi
First some facts:
Changing the multiplier of K7-mobile CPUs on desktop-boards works on most (maybe all, I don't know) VIA-chipset based mainboards, but not on nForce2 based Mainboards.
Changing the CPU-voltage does not work on most (I don't know any) VIA-based (desktop) mainbords.
|
That sucks, do you have any links for that?
DeBIGBOSS wrote: |
After 2.6.9 kernel the powernow-k7 module in the kernel had changed and so I needed new patches.
Today I tried development-sources-2.6.11 with the patches posted by weingbz.
First it seems to work correct. I could load the module without failures. powernowd throttled the CPU down, but when I start an application and powernowd should increase CPU speed my system hangs.
Any ideas what I can do or how I can analyze what's gone wrong.
|
As I said I have problems if I make too big a change at once. Try starting just the module without powernowd. Increase/decrease the frequency by one multiplier.
That should work. Now go up/down from min frequency to max frequency. If that hangs your system then you have the same problem I have. You can still use powernowd but you have to use a different mode (mode 0 "sine" instead of mode 1 or 2). E.g. start it with
Code: |
powernowd -vvv -m 0 -s 166000
|
If you have a frontside bus of 166 Mhz.
Hope that helps |
|
Back to top |
|
|
Alan Turing n00b
Joined: 10 Sep 2003 Posts: 53 Location: Freiburg, Baden (Germany)
|
Posted: Thu Mar 17, 2005 10:21 pm Post subject: |
|
|
Thanks.
I can only increase/decrease by 400Mhz. Higher increases/decreases cause system hangs.
Now I have added to my /etc/modules.autoload.d/kernel-2.6
Code: |
powernow-k7 overwrite_table=1 multiplier=3,5,7,9,11,115 fsb=200
|
and start powernowd with options
-m 0 (sine)
-s 400000 (for increasing/decreasing in 400Mhz steps)
-p 100 (for 0,1s polling intervall)
600Mhz are enough for internet-surfing music or xvid movies and if more power is needed, cpu speed increases to 2300Mhz in less than 1 second. |
|
Back to top |
|
|
skakz Guru
Joined: 03 Jul 2004 Posts: 380 Location: Ischia/Napoli/Italia/Terra
|
Posted: Sun May 29, 2005 10:59 am Post subject: |
|
|
hi all,
this is my situation:
I have an AMD Athlon(TM) XP (Barton mobile) on an Asus a7v600 MB
by bios i can scale cpu frequency with 10x max multiplier (3x to 10x all working!!!!)
this is my kernel (2.6.11-gentoo-r9) config:
Code: |
#
# Power management options (ACPI, APM)
#
CONFIG_PM=y
# CONFIG_PM_DEBUG is not set
# CONFIG_SOFTWARE_SUSPEND is not set
#
# ACPI (Advanced Configuration and Power Interface) Support
#
CONFIG_ACPI=y
CONFIG_ACPI_BOOT=y
CONFIG_ACPI_INTERPRETER=y
# CONFIG_ACPI_SLEEP is not set
CONFIG_ACPI_AC=m
CONFIG_ACPI_BATTERY=m
CONFIG_ACPI_BUTTON=m
CONFIG_ACPI_VIDEO=m
CONFIG_ACPI_FAN=m
CONFIG_ACPI_PROCESSOR=m
CONFIG_ACPI_THERMAL=m
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_IBM is not set
# CONFIG_ACPI_TOSHIBA is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
CONFIG_ACPI_BUS=y
CONFIG_ACPI_EC=y
CONFIG_ACPI_POWER=y
CONFIG_ACPI_PCI=y
CONFIG_ACPI_SYSTEM=y
# CONFIG_X86_PM_TIMER is not set
CONFIG_ACPI_CONTAINER=m
#
# APM (Advanced Power Management) BIOS Support
#
CONFIG_APM=y
# CONFIG_APM_IGNORE_USER_SUSPEND is not set
# CONFIG_APM_DO_ENABLE is not set
# CONFIG_APM_CPU_IDLE is not set
# CONFIG_APM_DISPLAY_BLANK is not set
# CONFIG_APM_RTC_IS_GMT is not set
# CONFIG_APM_ALLOW_INTS is not set
CONFIG_APM_REAL_MODE_POWER_OFF=y
#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_TABLE=y
#
# CPUFreq processor drivers
#
CONFIG_X86_ACPI_CPUFREQ=m
CONFIG_X86_POWERNOW_K6=m
CONFIG_X86_POWERNOW_K7=m
CONFIG_X86_POWERNOW_K7_ACPI=y
CONFIG_X86_POWERNOW_K8=m
CONFIG_X86_POWERNOW_K8_ACPI=y
CONFIG_X86_GX_SUSPMOD=m
CONFIG_X86_SPEEDSTEP_CENTRINO=m
# CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI is not set
CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
CONFIG_X86_SPEEDSTEP_ICH=m
CONFIG_X86_SPEEDSTEP_SMI=m
CONFIG_X86_P4_CLOCKMOD=m
CONFIG_X86_CPUFREQ_NFORCE2=m
CONFIG_X86_LONGRUN=m
CONFIG_X86_LONGHAUL=m
#
# shared options
#
CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y
CONFIG_X86_SPEEDSTEP_LIB=m
# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
|
when i try modprobe powernow-k7 it says
Code: |
FATAL: Error inserting powernow_k7 (/lib/modules/2.6.11-gentoo-r9/kernel/arch/i386/kernel/cpu/cpufreq/powernow-k7.ko): No such device
|
Code: |
dmesg
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: No PST tables match this cpuid (0x7a0)
powernow: This is indicative of a broken BIOS.
powernow: Trying ACPI perflib
powernow: ACPI perflib can not be used in this platform
powernow: ACPI and legacy methods failed
powernow: See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.shtml
|
also tryed to pass "acpi_force=1" when modprobe but still same output
Code: |
dmesg
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: PSB/PST known to be broken. Trying ACPI instead
powernow: ACPI perflib can not be used in this platform
|
patching with your patch fails saying: ( maybe because it is fow r2 or r3 version )
Code: |
patching file linux/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
Hunk #5 succeeded at 438 with fuzz 1.
Hunk #6 FAILED at 747.
Hunk #7 FAILED at 771.
Hunk #8 succeeded at 861 with fuzz 1.
2 out of 8 hunks FAILED -- saving rejects to file linux/arch/i386/kernel/cpu/cpufreq/powernow-k7.c.rej
|
Also, /sys/devices/system/cpu/cpu0/cpufreq/ is missing.
cat /proc/acpi/processor/CPU0/throttling says <not supported>
that's all folks
Someone please help me, or I'll be forced to call the Psychic Friends Network
EDIT: -------------------------------------------------------------------
a doubt is risen me
my /proc/cpuinfo says:
Code: |
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 10
model name : AMD Athlon(TM) XP
stepping : 0
cpu MHz : 1800.926
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse pni syscall mp mmxext 3dnowext 3dnow
bogomips : 3547.13
|
but it would not have to be
Code: |
model name : mobile AMD Athlon(TM)
|
perhaps bios doesn't recognize it as "mobile" ???
Please help me or I'll throw the pc through the window and I'll get outside to step on it to make sure it's broken
I'll get crazy......... _________________ Linux Registered User n.340423
Linux User Group Ischia
www.tush.it |
|
Back to top |
|
|
tnt Veteran
Joined: 27 Feb 2004 Posts: 1227
|
Posted: Sun May 29, 2005 2:47 pm Post subject: |
|
|
BIOS does recognise it as Mobile, but your BIOS can't provide PST table to your kernel and so, kernel does not now wich multiplier-voltage combinations to use (although voltage can't be changed on desktop mobos).
So, you'll need a patch wich enables you to manualy specify multiplier-voltage combinations and NOT to ask BIOS for PST.
Last time I've tried that, kernel was 2.6.8 and I don't know where to find patch for newer kernel.
Alternative is to try to patch powernow-k7.c manualy by looking at code and trying to realize where to insert those lines and what to comment out.
And, try to subscribe to the
cpufreq@lists.linux.org.uk
_________________ gentoo user |
|
Back to top |
|
|
skakz Guru
Joined: 03 Jul 2004 Posts: 380 Location: Ischia/Napoli/Italia/Terra
|
Posted: Sun May 29, 2005 4:12 pm Post subject: |
|
|
tnt wrote: |
Alternative is to try to patch powernow-k7.c manualy by looking at code and trying to realize where to insert those lines and what to comment out.
|
thanks for the quickly answer
i manually patched powernow-k7.c but i cant pass any option to modprobe
Code: |
omega linux # modprobe powernow-k7 overwrite_table=1 multiplier=6,7,8,9,10 fsb=200
FATAL: Error inserting powernow_k7 (/lib/modules/2.6.11-gentoo-r9/kernel/arch/i386/kernel/cpu/cpufreq/powernow-k7.ko): Unknown symbol in module, or unknown parameter (see dmesg)
omega linux # dmesg
...
powernow_k7: Unknown parameter `overwrite_table'
powernow_k7: Unknown parameter `multiplier'
powernow_k7: Unknown parameter `fsb'
|
and if i only do modprobe powernow-k7
Code: |
omega linux # modprobe powernow-k7
omega linux # dmesg
....
kobject_register failed for powernow_k7 (-17)
[<c026ce47>] kobject_register+0x57/0x60
[<c012ed70>] mod_sysfs_setup+0x50/0xb0
[<c012fe86>] load_module+0x796/0xa80
[<c01301d0>] sys_init_module+0x60/0x250
[<c0102785>] sysenter_past_esp+0x52/0x75
|
i dont know what to do...
EDIT: -------------------
solved:
Code: |
omega root # modprobe powernow-k7 overwrite_table=1 multiplier=6,7,8,9,10 fsb=200
omega root # dmesg
....
powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
powernow: Overwriting PST table with manual settings
powernow: Minimum speed 1200 MHz. Maximum speed 2000 MHz.
omega root # powernowd
powernowd: PowerNow Daemon v0.90hun6, (c) 2003-2004 John Clemens
powernowd: Found 1 physical cpu and 1 virtual cpu:
powernowd: cpu0: 1200000 kHz - 2000000 kHz
|
thanks tnt
yeappyyyyyyyyyyyyyyyyyyyyy _________________ Linux Registered User n.340423
Linux User Group Ischia
www.tush.it |
|
Back to top |
|
|
tnt Veteran
Joined: 27 Feb 2004 Posts: 1227
|
Posted: Sun May 29, 2005 6:27 pm Post subject: |
|
|
you're welcome! _________________ gentoo user |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|