Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ray.huang@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Huang Rui and committed by
Rafael J. Wysocki
3ad7fde1 ec4e3326

+18
+18
drivers/cpufreq/amd-pstate.c
··· 546 546 return sprintf(&buf[0], "%u\n", freq); 547 547 } 548 548 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 + 549 564 cpufreq_freq_attr_ro(amd_pstate_max_freq); 550 565 cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); 566 + 567 + cpufreq_freq_attr_ro(amd_pstate_highest_perf); 551 568 552 569 static struct freq_attr *amd_pstate_attr[] = { 553 570 &amd_pstate_max_freq, 554 571 &amd_pstate_lowest_nonlinear_freq, 572 + &amd_pstate_highest_perf, 555 573 NULL, 556 574 }; 557 575