Skip to content

Commit 1ae0882

Browse files
committed
Merge tag 'linux-cpupower-6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux into pm-tools
Merge cpupower utility fix for 6.10-rc2 from Shuah Khan: "This cpupower fixes update for Linux 6.10-rc2 consists of one single fix to cpupower's P-State frequency calculation and reporting with AMD Family 1Ah+ processors, when using the acpi-cpufreq driver." * tag 'linux-cpupower-6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux: tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs
2 parents 1613e60 + 43cad52 commit 1ae0882

File tree

1 file changed

+23
-3
lines changed
  • tools/power/cpupower/utils/helpers

1 file changed

+23
-3
lines changed

tools/power/cpupower/utils/helpers/amd.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,27 @@ union core_pstate {
4141
unsigned res1:31;
4242
unsigned en:1;
4343
} pstatedef;
44+
/* since fam 1Ah: */
45+
struct {
46+
unsigned fid:12;
47+
unsigned res1:2;
48+
unsigned vid:8;
49+
unsigned iddval:8;
50+
unsigned idddiv:2;
51+
unsigned res2:31;
52+
unsigned en:1;
53+
} pstatedef2;
4454
unsigned long long val;
4555
};
4656

4757
static int get_did(union core_pstate pstate)
4858
{
4959
int t;
5060

61+
/* Fam 1Ah onward do not use did */
62+
if (cpupower_cpu_info.family >= 0x1A)
63+
return 0;
64+
5165
if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF)
5266
t = pstate.pstatedef.did;
5367
else if (cpupower_cpu_info.family == 0x12)
@@ -61,12 +75,18 @@ static int get_did(union core_pstate pstate)
6175
static int get_cof(union core_pstate pstate)
6276
{
6377
int t;
64-
int fid, did, cof;
78+
int fid, did, cof = 0;
6579

6680
did = get_did(pstate);
6781
if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) {
68-
fid = pstate.pstatedef.fid;
69-
cof = 200 * fid / did;
82+
if (cpupower_cpu_info.family >= 0x1A) {
83+
fid = pstate.pstatedef2.fid;
84+
if (fid > 0x0f)
85+
cof = (fid * 5);
86+
} else {
87+
fid = pstate.pstatedef.fid;
88+
cof = 200 * fid / did;
89+
}
7090
} else {
7191
t = 0x10;
7292
fid = pstate.pstate.fid;

0 commit comments

Comments
 (0)