Skip to content

Commit 3ad7fde

Browse files
huangruirafaeljw
authored andcommitted
cpufreq: amd-pstate: Add AMD P-State performance attributes
Introduce sysfs attributes to get the different level AMD P-State performances. Signed-off-by: Huang Rui <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ec4e332 commit 3ad7fde

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,30 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
546546
return sprintf(&buf[0], "%u\n", freq);
547547
}
548548

549+
/*
550+
* In some of ASICs, the highest_perf is not the one in the _CPC table, so we
551+
* need to expose it to sysfs.
552+
*/
553+
static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
554+
char *buf)
555+
{
556+
u32 perf;
557+
struct amd_cpudata *cpudata = policy->driver_data;
558+
559+
perf = READ_ONCE(cpudata->highest_perf);
560+
561+
return sprintf(&buf[0], "%u\n", perf);
562+
}
563+
549564
cpufreq_freq_attr_ro(amd_pstate_max_freq);
550565
cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq);
551566

567+
cpufreq_freq_attr_ro(amd_pstate_highest_perf);
568+
552569
static struct freq_attr *amd_pstate_attr[] = {
553570
&amd_pstate_max_freq,
554571
&amd_pstate_lowest_nonlinear_freq,
572+
&amd_pstate_highest_perf,
555573
NULL,
556574
};
557575

0 commit comments

Comments
 (0)