summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/utils/helpers/amd.c
diff options
context:
space:
mode:
authorNathan Fontenot <nathan.fontenot@amd.com>2021-01-25 20:34:49 +0300
committerShuah Khan <skhan@linuxfoundation.org>2021-01-26 19:40:15 +0300
commita0255a76bf3a78d322adfe4eb4e73eb83998f61a (patch)
treeb721317391188d6476567bb9f8b7dc85e7fe1afb /tools/power/cpupower/utils/helpers/amd.c
parent7a136a8fcd7ef14c63d07667e81c4dcac77e0a13 (diff)
downloadlinux-a0255a76bf3a78d322adfe4eb4e73eb83998f61a.tar.xz
cpupower: Add CPUPOWER_CAP_AMD_HW_PSTATE cpuid caps flag
Add a check in get_cpu_info() for the ability to read frequencies from hardware and set the CPUPOWER_CAP_AMD_HW_PSTATE cpuid flag. The cpuid flag is set when CPUID_80000007_EDX[7] is set, which is all families >= 10h. The check excludes family 14h because HW pstate reporting was not implemented on family 14h. This is intended to reduce family checks in the main code paths. Signed-off-by: Nathan Fontenot <nathan.fontenot@amd.com> Reviewed-by: Robert Richter <rrichter@amd.com> Reviewed-by: skhan@linuxfoundation.org Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power/cpupower/utils/helpers/amd.c')
-rw-r--r--tools/power/cpupower/utils/helpers/amd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c
index 34368436bbd6..8b69c7ff639a 100644
--- a/tools/power/cpupower/utils/helpers/amd.c
+++ b/tools/power/cpupower/utils/helpers/amd.c
@@ -94,11 +94,10 @@ int decode_pstates(unsigned int cpu, unsigned int cpu_family,
union core_pstate pstate;
unsigned long long val;
- /* Only read out frequencies from HW when CPU might be boostable
- to keep the code as short and clean as possible.
- Otherwise frequencies are exported via ACPI tables.
- */
- if (cpu_family < 0x10 || cpu_family == 0x14)
+ /* Only read out frequencies from HW if HW Pstate is supported,
+ * otherwise frequencies are exported via ACPI tables.
+ */
+ if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_HW_PSTATE))
return -1;
if (read_msr(cpu, MSR_AMD_PSTATE_LIMIT, &val))