Skip to content

Commit a485cec

Browse files
committed
Provides the new driver startup parameter: Ratio_PPC
1 parent 9255c10 commit a485cec

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ parm: Turbo_Activation_Ratio:Turbo Activation Ratio (short)
477477
parm: PState_FID:P-State Frequency Id (int)
478478
parm: PState_VID:P-State Voltage Id (int)
479479
parm: Ratio_Boost:Turbo Boost Frequency ratios (array of int)
480+
parm: Ratio_PPC:Target Performance ratio (int)
480481
parm: HWP_Enable:Hardware-Controlled Performance States (short)
481482
parm: HWP_EPP:Energy Performance Preference (short)
482483
parm: Ratio_HWP:Hardware-Controlled Performance ratios (array of int)

corefreqk.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ module_param_array(Ratio_Boost, int, &Ratio_Boost_Count, \
286286
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
287287
MODULE_PARM_DESC(Ratio_Boost, "Turbo Boost Frequency ratios");
288288

289+
static signed int Ratio_PPC = -1;
290+
module_param(Ratio_PPC, int, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
291+
MODULE_PARM_DESC(Ratio_PPC, "Target Performance ratio");
292+
289293
static signed short HWP_Enable = -1;
290294
module_param(HWP_Enable, short, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
291295
MODULE_PARM_DESC(HWP_Enable, "Hardware-Controlled Performance States");
@@ -21704,6 +21708,9 @@ static int CoreFreqK_User_Ops_Level_Up(INIT_ARG *pArg)
2170421708
}
2170521709
}
2170621710
Controller_Start(1);
21711+
21712+
RESET_ARRAY(Ratio_HWP, Ratio_HWP_Count, -1);
21713+
Ratio_HWP_Count = 0;
2170721714
}
2170821715
if (Ratio_Boost_Count > 0)
2170921716
{
@@ -21741,6 +21748,9 @@ static int CoreFreqK_User_Ops_Level_Up(INIT_ARG *pArg)
2174121748
TurboBoost_Enable[0] = TurboBoost_Enable[1];
2174221749
}
2174321750
Controller_Start(1);
21751+
21752+
RESET_ARRAY(Ratio_Boost, Ratio_Boost_Count, -1);
21753+
Ratio_Boost_Count = 0;
2174421754
}
2174521755
if (PUBLIC(RO(Proc))->ArchID != AMD_Family_0Fh)
2174621756
{
@@ -21764,7 +21774,7 @@ static int CoreFreqK_User_Ops_Level_Up(INIT_ARG *pArg)
2176421774

2176521775
Controller_Stop(1);
2176621776
rc = Arch[PUBLIC(RO(Proc))->ArchID].ClockMod(&clockMod);
21767-
Controller_Start(0);
21777+
Controller_Start(1);
2176821778

2176921779
if (rc < RC_SUCCESS) {
2177021780
pr_warn("CoreFreq: " \
@@ -21782,7 +21792,24 @@ static int CoreFreqK_User_Ops_Level_Up(INIT_ARG *pArg)
2178221792
PState_FID = -1;
2178321793
}
2178421794
} /* else handled by function PerCore_AMD_Family_0Fh_PStates() */
21795+
if (Ratio_PPC >= 0)
21796+
{
21797+
long rc = RC_SUCCESS;
21798+
21799+
if (Arch[PUBLIC(RO(Proc))->ArchID].ClockMod) {
21800+
CLOCK_ARG clockMod={.Ratio = Ratio_PPC, .cpu = -1, .NC = CLOCK_MOD_TGT};
2178521801

21802+
Controller_Stop(1);
21803+
rc = Arch[PUBLIC(RO(Proc))->ArchID].ClockMod(&clockMod);
21804+
Controller_Start(0);
21805+
} else {
21806+
rc = -RC_UNIMPLEMENTED;
21807+
}
21808+
if (rc < RC_SUCCESS) {
21809+
pr_warn("CoreFreq: 'Ratio_PPC' Execution failure code %ld\n", rc);
21810+
}
21811+
Ratio_PPC = -1;
21812+
}
2178621813
return 0;
2178721814
}
2178821815

0 commit comments

Comments
 (0)