From 57ef2436a1759ae9d9b4d1536aed4701bfb4f737 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 17 Aug 2022 15:33:23 +0800 Subject: [PATCH] tools/power/x86/intel-speed-select: Introduce isst_is_punit_valid() Introduce isst_is_punit_valid() for checking a valid domain. For current platforms, it requires a punit 0 in a valid Package/Die. No functional changes are expected. Signed-off-by: Zhang Rui [srinivas.pandruvada@linux.intel.com: changelog edits] Signed-off-by: Srinivas Pandruvada --- tools/power/x86/intel-speed-select/isst-core.c | 11 +++++++++++ tools/power/x86/intel-speed-select/isst.h | 1 + 2 files changed, 12 insertions(+) diff --git a/tools/power/x86/intel-speed-select/isst-core.c b/tools/power/x86/intel-speed-select/isst-core.c index 8aa2ee4..f712da2 100644 --- a/tools/power/x86/intel-speed-select/isst-core.c +++ b/tools/power/x86/intel-speed-select/isst-core.c @@ -25,6 +25,17 @@ char *isst_get_trl_level_name(int level) } } +int isst_is_punit_valid(struct isst_id *id) +{ + if (id->cpu < 0) + return 0; + + if (id->pkg < 0 || id->die < 0 || id->punit) + return 0; + + return 1; +} + int isst_write_pm_config(struct isst_id *id, int cp_state) { unsigned int req, resp; diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h index 148389c..ef884d8 100644 --- a/tools/power/x86/intel-speed-select/isst.h +++ b/tools/power/x86/intel-speed-select/isst.h @@ -205,6 +205,7 @@ extern int isst_send_msr_command(unsigned int cpu, unsigned int command, extern int isst_get_trl_max_levels(void); extern char *isst_get_trl_level_name(int level); +extern int isst_is_punit_valid(struct isst_id *id); extern int isst_get_ctdp_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev); extern int isst_get_ctdp_control(struct isst_id *id, int config_index, -- 2.7.4