[PATCH 18/19] cpupower: print amd-pstate information on cpupower

Huang Rui
2021-09-08T15:02:17Z

amd-pstate kernel module is using the fine grain frequency instead of
acpi hardware pstate. So the performance and frequency values should be
printed in frequency-info.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
tools/power/cpupower/utils/cpufreq-info.c | 27 ++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index f9895e31ff5a..9eabed209adc 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -183,9 +183,30 @@ static int get_boost_mode_x86(unsigned int cpu)
printf(_(" Supported: %s\n"), support ? _("yes") : _("no"));
printf(_(" Active: %s\n"), active ? _("yes") : _("no"));

- if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
- cpupower_cpu_info.family >= 0x10) ||
- cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
+ if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+ cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) {
+ printf(_(" AMD PSTATE Highest Performance: %u. Maximum Frequency: "),
+ amd_pstate_get_data(cpu, HIGHEST_PERF));
+ print_speed(amd_pstate_get_data(cpu, MAX_FREQ));
+ printf(".\n");
+
+ printf(_(" AMD PSTATE Nominal Performance: %u. Nominal Frequency: "),
+ amd_pstate_get_data(cpu, NOMINAL_PERF));
+ print_speed(amd_pstate_get_data(cpu, NOMINAL_FREQ));
+ printf(".\n");
+
+ printf(_(" AMD PSTATE Lowest Non-linear Performance: %u. Lowest Non-linear Frequency: "),
+ amd_pstate_get_data(cpu, LOWEST_NONLINEAR_PERF));
+ print_speed(amd_pstate_get_data(cpu, LOWEST_NONLINEAR_FREQ));
+ printf(".\n");
+
+ printf(_(" AMD PSTATE Lowest Performance: %u. Lowest Frequency: "),
+ amd_pstate_get_data(cpu, LOWEST_PERF));
+ print_speed(amd_pstate_get_data(cpu, MIN_FREQ));
+ printf(".\n");
+ } else if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+ cpupower_cpu_info.family >= 0x10) ||
+ cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
ret = decode_pstates(cpu, b_states, pstates, &pstate_no);
if (ret)
return ret;
--
2.25.1