diff options
author | Mario Limonciello <mario.limonciello@amd.com> | 2024-12-18 13:09:53 -0600 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-12-20 09:12:07 -0700 |
commit | 26e16174f54d40a3774614c4d43966572ed79dc1 (patch) | |
tree | 56b3396bfd1c0363069a46eb955e16404062e9ed /tools/power/cpupower | |
parent | 6d4a2987f96b9f281b07286eeb1d4022054e1ecd (diff) |
cpupower: Don't try to read frequency from hardware when kernel uses aperfmperf
When the amd-pstate is in use frequency is set by the hardware and
measured by the kernel through using the aperf and mperf registers.
There is no direct call to the hardware to indicate current frequency.
Detect that this feature is in use and skip the check.
Link: https://lore.kernel.org/r/20241218191144.3440854-5-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power/cpupower')
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-info.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index 5f092f3c729e..3df28e45be42 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c @@ -254,7 +254,12 @@ static int get_freq_kernel(unsigned int cpu, unsigned int human) static int get_freq_hardware(unsigned int cpu, unsigned int human) { - unsigned long freq = cpufreq_get_freq_hardware(cpu); + unsigned long freq; + + if (cpupower_cpu_info.caps & CPUPOWER_CAP_APERF) + return -EINVAL; + + freq = cpufreq_get_freq_hardware(cpu); printf(_(" current CPU frequency: ")); if (!freq) { printf("Unable to call hardware\n"); |