support family 0xf with 2 low p-states
PATCH 1/1 support family 0xf with 2 low p-states
Provide support for family 0xf processors with 2 P-states below the elevator voltage. Remove the checks that prevent this configuration from being supported and increase the transition voltage to prevent errors during the transition.
--- arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 30 ++++++++++------------------ arch/x86/kernel/cpu/cpufreq/powernow-k8.h | 3 +- 2 files changed, 13 insertions(+), 20 deletions(-)
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +11 -19
@@ -299,7 +299,7 @@ static int transition_pstate(struct powernow_k8_data *data, u32 pstate)static int transition_fid_vid (struct powernow_k8_data *data,u32 reqfid,u32 reqvid) { -if (core_voltage_pre_transition (data, reqvid)) +if (core_voltage_pre_transition (data, reqvid, reqfid))return 1 ;if (core_frequency_transition (data, reqfid))
@@ -327,17 +327,20 @@ static int transition_fid_vid(struct powernow_k8_data *data,/* Phase 1 - core voltage transition ... setup voltage */ static int core_voltage_pre_transition (struct powernow_k8_data *data, -u32 reqvid) +u32 reqvid,u32 reqfid) {u32 rvosteps = data->rvo;u32 savefid = data->currfid; -u32 maxvid, lo; +u32 maxvid, lo, rvomult =1 ;dprintk ("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, " "reqvid 0x%x, rvo 0x%x\n" ,smp_processor_id (), data->currfid, data->currvid, reqvid, data->rvo); +if ((savefid <LO_FID_TABLE_TOP ) && (reqfid <LO_FID_TABLE_TOP )) + rvomult =2 ; + rvosteps *= rvomult;rdmsr (MSR_FIDVID_STATUS , lo, maxvid); maxvid =0x1f & (maxvid >>16 );dprintk ("ph1 maxvid=0x%x\n" , maxvid);
@@ -351,7 +354,8 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data,return 1 ; } -while ((rvosteps >0 ) && ((data->rvo + data->currvid) > reqvid)) { +while ((rvosteps >0 ) && + ((rvomult * data->rvo + data->currvid) > reqvid)) {if (data->currvid == maxvid) { rvosteps =0 ; }else {
@@ -384,13 +388,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)u32 vcoreqfid, vcocurrfid, vcofiddiff;u32 fid_interval, savevid = data->currvid; -if ((reqfid <HI_FID_TABLE_BOTTOM ) && - (data->currfid <HI_FID_TABLE_BOTTOM )) { - printk(KERN_ERR PFX "ph2: illegal lo-lo transition " - "0x%x 0x%x\n", reqfid, data->currfid); -return 1 ; - } -if (data->currfid == reqfid) { printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", data->currfid);
@@ -407,6 +404,9 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) vcofiddiff = vcocurrfid > vcoreqfid ? vcocurrfid - vcoreqfid : vcoreqfid - vcocurrfid; +if ((reqfid <=LO_FID_TABLE_TOP ) && (data->currfid <=LO_FID_TABLE_TOP )) + vcofiddiff =0 ; +while (vcofiddiff >2 ) { (data->currfid &1 ) ? (fid_interval =1 ) : (fid_interval =2 );
@@ -1081,14 +1081,6 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data,return 0 ; } -if ((fid <HI_FID_TABLE_BOTTOM ) && - (data->currfid <HI_FID_TABLE_BOTTOM )) { - printk(KERN_ERR PFX -"ignoring illegal change in lo freq table-%x to 0x%x\n" , - data->currfid, fid); -return 1 ; - } -dprintk ("cpu %d, changing to fid 0x%x, vid 0x%x\n" ,smp_processor_id (), fid, vid); freqs.old =find_khz_freq_from_fid (data->currfid);
arch/x86/kernel/cpu/cpufreq/powernow-k8.h +2 -1
@@ -215,7 +215,8 @@ struct pst_s { #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "powernow-k8", msg) -static int core_voltage_pre_transition (struct powernow_k8_data *data,u32 reqvid); +static int core_voltage_pre_transition (struct powernow_k8_data *data, +u32 reqvid,u32 regfid);static int core_voltage_post_transition (struct powernow_k8_data *data,u32 reqvid);static int core_frequency_transition (struct powernow_k8_data *data,u32 reqfid);
Signature · 1 line
1.6.0.2
Quoted 2 lines · On Sun, 26 Jul 2009 10:55:25 -0500 Mark Langsdorf <[email protected]>…
Subject: [PATCH][cpufreq][Powernow-k8] support family
0xfwith 2 low p-states
Please leave the subsystem identification text outside the []. Documentation/SubmittingPatches section 15 has details.
arch/x86/kernel/cpu/cpufreq/powernow-k8.h struct pst_s { · line 221
Quoted 11 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.h +2
-1@@ -215,7 +215,8 @@ struct pst_s { #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "powernow-k8", msg) -static int core_voltage_pre_transition (struct powernow_k8_data *data,u32 reqvid); +static int core_voltage_pre_transition (struct powernow_k8_data *data, +u32 reqvid,u32 regfid);static int core_voltage_post_transition (struct powernow_k8_data *data,u32 reqvid);static int core_frequency_transition (struct powernow_k8_data *data,u32 reqfid);
It's fairly dopey to have static function declarations in a header file
- no other .c fail can _use_ them, so they may as well be tucked away inside their .c file. And that's only needed if the functions indeed need to be forward-declared.
Quoted 15 lines · Andrew Morton
Quoted 2 lines · On Sun, 26 Jul 2009 10:55:25 -0500 Mark Langsdorf <[email protected]>…
Subject: [PATCH][cpufreq][Powernow-k8] support family
0xfwith 2 low p-statesPlease leave the subsystem identification text outside the [].
Documentation/SubmittingPatchessection 15 has details.Quoted 6 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.h +0
-0@@ -215,7 +215,8 @@ struct pst_s { #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "powernow-k8", msg)
Quoted 8 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.h struct pst_s { · line 221
Quoted 5 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.h +2
-1-static int core_voltage_pre_transition (struct powernow_k8_data *data,u32 reqvid); +static int core_voltage_pre_transition (struct powernow_k8_data *data, +u32 reqvid,u32 regfid);static int core_voltage_post_transition (struct powernow_k8_data *data,u32 reqvid);static int core_frequency_transition (struct powernow_k8_data *data,u32 reqfid);It's fairly dopey to have static function declarations in a header file
- no other .c fail can _use_ them, so they may as well be tucked away
hehe, FAIL, hehe ;-)
Quoted 2 lines
inside their .c file. And that's only needed if the functions indeed need to be forward-declared.