aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/power
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2023-08-31 15:58:10 +0800
committerZhang Rui <rui.zhang@intel.com>2023-09-27 22:14:20 +0800
commit11cd9a09f3e827605cf8fc7c343ddb8c9f4ee95d (patch)
tree0ddb546ed9cf51949ebb272c2e964a2781c2ef1a /tools/power
parenttools/power/turbostat: Relocate cstate probing code (diff)
downloadwireguard-linux-11cd9a09f3e827605cf8fc7c343ddb8c9f4ee95d.tar.xz
wireguard-linux-11cd9a09f3e827605cf8fc7c343ddb8c9f4ee95d.zip
tools/power/turbostat: Relocate pstate probing code
Introduce probe_pstates() and move all pstate probing related code into it. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index e5ca1586961e..1bcaee6d0ead 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3016,6 +3016,9 @@ static void dump_platform_info(void)
unsigned long long msr;
unsigned int ratio;
+ if (!platform->has_nhm_msrs)
+ return;
+
get_msr(base_cpu, MSR_PLATFORM_INFO, &msr);
fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr);
@@ -4313,6 +4316,9 @@ static void dump_turbo_ratio_info(void)
if (!has_turbo)
return;
+ if (!platform->has_nhm_msrs)
+ return;
+
if (platform->trl_msrs & TRL_LIMIT2)
dump_turbo_ratio_limit2();
@@ -4336,15 +4342,6 @@ static void dump_turbo_ratio_info(void)
dump_config_tdp();
}
-static void dump_cstate_pstate_config_info(void)
-{
- if (!platform->has_nhm_msrs)
- return;
-
- dump_platform_info();
- dump_turbo_ratio_info();
-}
-
static int read_sysfs_int(char *path)
{
FILE *input;
@@ -5363,6 +5360,19 @@ void probe_cstates(void)
dump_sysfs_cstate_config();
}
+void probe_pstates(void)
+{
+ probe_bclk();
+
+ if (quiet)
+ return;
+
+ dump_platform_info();
+ dump_turbo_ratio_info();
+ dump_sysfs_pstate_config();
+ decode_misc_pwr_mgmt_msr();
+}
+
void process_cpuid()
{
unsigned int eax, ebx, ecx, edx;
@@ -5542,24 +5552,17 @@ void process_cpuid()
BIC_PRESENT(BIC_IRQ);
BIC_PRESENT(BIC_TSC_MHz);
+ probe_pstates();
+
probe_cstates();
if (platform->has_nhm_msrs)
BIC_PRESENT(BIC_SMI);
- probe_bclk();
-
- if (!quiet)
- decode_misc_pwr_mgmt_msr();
rapl_probe();
- if (!quiet)
- dump_cstate_pstate_config_info();
intel_uncore_frequency_probe();
- if (!quiet)
- dump_sysfs_pstate_config();
-
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
BIC_PRESENT(BIC_GFX_rc6);