summaryrefslogtreecommitdiffstats
path: root/tools/power/x86
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-08-08 20:34:45 +0800
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 13:36:50 -0700
commite107dec9a8ddd97488e579f1d0cf10a849037cdf (patch)
treea441ec2148e13cff910790b8e79e8140a463571d /tools/power/x86
parent645b66054cb588c4aa47920643372dd6879ef3b4 (diff)
downloadlinux-e107dec9a8ddd97488e579f1d0cf10a849037cdf.tar.gz
linux-e107dec9a8ddd97488e579f1d0cf10a849037cdf.tar.bz2
linux-e107dec9a8ddd97488e579f1d0cf10a849037cdf.zip
tools/power/x86/intel-speed-select: Abstract get_pwr_info
Allow platform specific implementation to get min and max power for a given SST-PP level. No functional changes are expected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> [srinivas.pandruvada@linux.intel.com: changelog edits] Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'tools/power/x86')
-rw-r--r--tools/power/x86/intel-speed-select/isst-core-mbox.c24
-rw-r--r--tools/power/x86/intel-speed-select/isst-core.c19
-rw-r--r--tools/power/x86/intel-speed-select/isst.h1
3 files changed, 27 insertions, 17 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-core-mbox.c b/tools/power/x86/intel-speed-select/isst-core-mbox.c
index 33537864a068..40c856f4c708 100644
--- a/tools/power/x86/intel-speed-select/isst-core-mbox.c
+++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c
@@ -125,6 +125,29 @@ static int mbox_get_tdp_info(struct isst_id *id, int config_index,
return 0;
}
+static int mbox_get_pwr_info(struct isst_id *id, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_PWR_INFO,
+ 0, config_index, &resp);
+ if (ret)
+ return ret;
+
+ ctdp_level->pkg_max_power = resp & GENMASK(14, 0);
+ ctdp_level->pkg_min_power = (resp & GENMASK(30, 16)) >> 16;
+
+ debug_printf(
+ "cpu:%d ctdp:%d CONFIG_TDP_GET_PWR_INFO resp:%x pkg_max_power:%d pkg_min_power:%d\n",
+ id->cpu, config_index, resp, ctdp_level->pkg_max_power,
+ ctdp_level->pkg_min_power);
+
+ return 0;
+}
+
+
static struct isst_platform_ops mbox_ops = {
.get_disp_freq_multiplier = mbox_get_disp_freq_multiplier,
.get_trl_max_levels = mbox_get_trl_max_levels,
@@ -133,6 +156,7 @@ static struct isst_platform_ops mbox_ops = {
.get_config_levels = mbox_get_config_levels,
.get_ctdp_control = mbox_get_ctdp_control,
.get_tdp_info = mbox_get_tdp_info,
+ .get_pwr_info = mbox_get_pwr_info,
};
struct isst_platform_ops *mbox_get_platform_ops(void)
diff --git a/tools/power/x86/intel-speed-select/isst-core.c b/tools/power/x86/intel-speed-select/isst-core.c
index b4f285d85be9..def0a6888907 100644
--- a/tools/power/x86/intel-speed-select/isst-core.c
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -308,23 +308,8 @@ int isst_get_tdp_info(struct isst_id *id, int config_index,
int isst_get_pwr_info(struct isst_id *id, int config_index,
struct isst_pkg_ctdp_level_info *ctdp_level)
{
- unsigned int resp;
- int ret;
-
- ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_PWR_INFO,
- 0, config_index, &resp);
- if (ret)
- return ret;
-
- ctdp_level->pkg_max_power = resp & GENMASK(14, 0);
- ctdp_level->pkg_min_power = (resp & GENMASK(30, 16)) >> 16;
-
- debug_printf(
- "cpu:%d ctdp:%d CONFIG_TDP_GET_PWR_INFO resp:%x pkg_max_power:%d pkg_min_power:%d\n",
- id->cpu, config_index, resp, ctdp_level->pkg_max_power,
- ctdp_level->pkg_min_power);
-
- return 0;
+ CHECK_CB(get_pwr_info);
+ return isst_ops->get_pwr_info(id, config_index, ctdp_level);
}
void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index,
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
index ed8bcb2a2837..5dc2613a39ff 100644
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -189,6 +189,7 @@ struct isst_platform_ops {
int (*get_config_levels)(struct isst_id *id, struct isst_pkg_ctdp *pkg_ctdp);
int (*get_ctdp_control)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
int (*get_tdp_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
+ int (*get_pwr_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
};
extern int is_cpu_in_power_domain(int cpu, struct isst_id *id);