summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-08-08 22:55:51 +0800
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 13:36:52 -0700
commitb161bbad6db9a1e8d7cada5bf91b21340af7b163 (patch)
treea59694f857a3881b9dcd8cf68011254816d69394 /tools/power
parent33dbf360db5fbc09ea1d4962a964d57b5f6004f8 (diff)
downloadlwn-b161bbad6db9a1e8d7cada5bf91b21340af7b163.tar.gz
lwn-b161bbad6db9a1e8d7cada5bf91b21340af7b163.zip
tools/power/x86/intel-speed-select: Abstract clos_get_assoc_status
Allow platform specific implementation to get per core CLOS setting. 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.c21
-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, 24 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 3490315034d0..4e86cce92585 100644
--- a/tools/power/x86/intel-speed-select/isst-core-mbox.c
+++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c
@@ -756,6 +756,26 @@ static int mbox_set_clos(struct isst_id *id, int clos, struct isst_clos_config *
return 0;
}
+static int mbox_clos_get_assoc_status(struct isst_id *id, int *clos_id)
+{
+ unsigned int resp;
+ unsigned int param;
+ int core_id, ret;
+
+ core_id = find_phy_core_num(id->cpu);
+ param = core_id;
+
+ ret = isst_send_mbox_command(id->cpu, CONFIG_CLOS, CLOS_PQR_ASSOC, param, 0,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x resp:%x\n", id->cpu, param,
+ resp);
+ *clos_id = (resp >> 16) & 0x03;
+
+ 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,
@@ -778,6 +798,7 @@ static struct isst_platform_ops mbox_ops = {
.pm_qos_config = mbox_pm_qos_config,
.pm_get_clos = mbox_pm_get_clos,
.set_clos = mbox_set_clos,
+ .clos_get_assoc_status = mbox_clos_get_assoc_status,
};
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 a901c63f7355..c00622461c62 100644
--- a/tools/power/x86/intel-speed-select/isst-core.c
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -639,23 +639,8 @@ int isst_set_clos(struct isst_id *id, int clos, struct isst_clos_config *clos_co
int isst_clos_get_assoc_status(struct isst_id *id, int *clos_id)
{
- unsigned int resp;
- unsigned int param;
- int core_id, ret;
-
- core_id = find_phy_core_num(id->cpu);
- param = core_id;
-
- ret = isst_send_mbox_command(id->cpu, CONFIG_CLOS, CLOS_PQR_ASSOC, param, 0,
- &resp);
- if (ret)
- return ret;
-
- debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x resp:%x\n", id->cpu, param,
- resp);
- *clos_id = (resp >> 16) & 0x03;
-
- return 0;
+ CHECK_CB(clos_get_assoc_status);
+ return isst_ops->clos_get_assoc_status(id, clos_id);
}
int isst_clos_associate(struct isst_id *id, int clos_id)
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
index 5db3fc5487a6..5794b31beafc 100644
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -203,6 +203,7 @@ struct isst_platform_ops {
int (*pm_qos_config)(struct isst_id *id, int enable_clos, int priority_type);
int (*pm_get_clos)(struct isst_id *id, int clos, struct isst_clos_config *clos_config);
int (*set_clos)(struct isst_id *id, int clos, struct isst_clos_config *clos_config);
+ int (*clos_get_assoc_status)(struct isst_id *id, int *clos_id);
};
extern int is_cpu_in_power_domain(int cpu, struct isst_id *id);