summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-08-09 01:49:48 +0800
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 13:36:51 -0700
commitf88c3c4bd431a81e50e126342f8daa6ee9171b82 (patch)
tree71952bcac35a2d83a9a96cf8f8508d10dbb0cd74 /tools/power
parent1e37f1b21c7022f1d9dd641a6f2d4ffd2950202c (diff)
tools/power/x86/intel-speed-select: Abstract set_tdp_level
Allow platform specific implementation to set a 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')
-rw-r--r--tools/power/x86/intel-speed-select/isst-core-mbox.c23
-rw-r--r--tools/power/x86/intel-speed-select/isst-core.c20
-rw-r--r--tools/power/x86/intel-speed-select/isst.h1
3 files changed, 26 insertions, 18 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 0cc08dbb0cc4..f6f1632e35b9 100644
--- a/tools/power/x86/intel-speed-select/isst-core-mbox.c
+++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c
@@ -250,6 +250,28 @@ static int mbox_get_trl_bucket_info(struct isst_id *id, int level, unsigned long
return 0;
}
+static int mbox_set_tdp_level(struct isst_id *id, int tdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+
+ if (isst_get_config_tdp_lock_status(id)) {
+ isst_display_error_info_message(1, "TDP is locked", 0, 0);
+ return -1;
+
+ }
+
+ ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_SET_LEVEL, 0,
+ tdp_level, &resp);
+ if (ret) {
+ isst_display_error_info_message(1, "Set TDP level failed for level", 1, tdp_level);
+ return ret;
+ }
+
+ 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,
@@ -262,6 +284,7 @@ static struct isst_platform_ops mbox_ops = {
.get_coremask_info = mbox_get_coremask_info,
.get_get_trl = mbox_get_get_trl,
.get_trl_bucket_info = mbox_get_trl_bucket_info,
+ .set_tdp_level = mbox_set_tdp_level,
};
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 bd4facdf746e..53bfc5d47f52 100644
--- a/tools/power/x86/intel-speed-select/isst-core.c
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -354,24 +354,8 @@ int isst_get_trl_bucket_info(struct isst_id *id, int level, unsigned long long *
int isst_set_tdp_level(struct isst_id *id, int tdp_level)
{
- unsigned int resp;
- int ret;
-
-
- if (isst_get_config_tdp_lock_status(id)) {
- isst_display_error_info_message(1, "TDP is locked", 0, 0);
- return -1;
-
- }
-
- ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_SET_LEVEL, 0,
- tdp_level, &resp);
- if (ret) {
- isst_display_error_info_message(1, "Set TDP level failed for level", 1, tdp_level);
- return ret;
- }
-
- return 0;
+ CHECK_CB(set_tdp_level);
+ return isst_ops->set_tdp_level(id, tdp_level);
}
int isst_get_pbf_info(struct isst_id *id, int level, struct isst_pbf_info *pbf_info)
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
index 465e07960ccb..cc1487c7b9b7 100644
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -193,6 +193,7 @@ struct isst_platform_ops {
int (*get_coremask_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
int (*get_get_trl)(struct isst_id *id, int level, int avx_level, int *trl);
int (*get_trl_bucket_info)(struct isst_id *id, int level, unsigned long long *buckets_info);
+ int (*set_tdp_level)(struct isst_id *id, int tdp_level);
};
extern int is_cpu_in_power_domain(int cpu, struct isst_id *id);