Thread (59 messages) 59 messages, 6 authors, 2021-09-17
STALE1736d
Revisions (5)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH 17/19] cpupower: add amd-pstate get data function to query the info

From: Huang Rui <ray.huang@amd.com>
Date: 2021-09-08 15:02:25
Also in: lkml
Subsystem: cpu power monitoring subsystem, the rest · Maintainers: Thomas Renninger, Shuah Khan, John B. Wyatt IV, John Kacur, Linus Torvalds

Frequency-info needs an interface to query the current amd-pstate data.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 tools/power/cpupower/lib/cpufreq.c |  6 ++++++
 tools/power/cpupower/lib/cpufreq.h | 13 +++++++++++++
 2 files changed, 19 insertions(+)
diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c
index 37da87bdcfb1..1443080868da 100644
--- a/tools/power/cpupower/lib/cpufreq.c
+++ b/tools/power/cpupower/lib/cpufreq.c
@@ -810,3 +810,9 @@ int amd_pstate_boost_enabled(unsigned int cpu)
 
 	return cpuinfo_max == amd_pstate_max ? 1 : 0;
 }
+
+unsigned amd_pstate_get_data(unsigned int cpu, enum amd_pstate_param param)
+{
+	return sysfs_cpufreq_get_one_value(cpu,
+					   param + AMD_PSTATE_HIGHEST_PERF);
+}
diff --git a/tools/power/cpupower/lib/cpufreq.h b/tools/power/cpupower/lib/cpufreq.h
index d54d02a7a4f4..954e72704fc0 100644
--- a/tools/power/cpupower/lib/cpufreq.h
+++ b/tools/power/cpupower/lib/cpufreq.h
@@ -206,6 +206,19 @@ int cpufreq_set_frequency(unsigned int cpu,
 int amd_pstate_boost_support(unsigned int cpu);
 int amd_pstate_boost_enabled(unsigned int cpu);
 
+enum amd_pstate_param {
+	HIGHEST_PERF,
+	NOMINAL_PERF,
+	LOWEST_NONLINEAR_PERF,
+	LOWEST_PERF,
+	MAX_FREQ,
+	NOMINAL_FREQ,
+	LOWEST_NONLINEAR_FREQ,
+	MIN_FREQ,
+};
+
+unsigned amd_pstate_get_data(unsigned int cpu, enum amd_pstate_param param);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help