diff options
author | Zhang Rui <rui.zhang@intel.com> | 2022-08-17 18:28:41 +0200 |
---|---|---|
committer | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2023-03-22 21:36:51 +0100 |
commit | 00c26c1f7e3dfc0ec2e39deb1cffc2acad1d2ae4 (patch) | |
tree | 5bd32b3ca017a7534206a78d015959321ade8a93 /tools/power | |
parent | tools/power/x86/intel-speed-select: Abstract get_fact_info (diff) | |
download | linux-00c26c1f7e3dfc0ec2e39deb1cffc2acad1d2ae4.tar.xz linux-00c26c1f7e3dfc0ec2e39deb1cffc2acad1d2ae4.zip |
tools/power/x86/intel-speed-select: Abstract get_uncore_p0_p1_info
Allow platform specific implementation to get uncore frequency info.
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.c | 47 | ||||
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-core.c | 44 | ||||
-rw-r--r-- | tools/power/x86/intel-speed-select/isst.h | 1 |
3 files changed, 50 insertions, 42 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 bf873dfe72e6..466ed0934b42 100644 --- a/tools/power/x86/intel-speed-select/isst-core-mbox.c +++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c @@ -102,6 +102,52 @@ static int mbox_get_ctdp_control(struct isst_id *id, int config_index, return 0; } +static void mbox_get_uncore_p0_p1_info(struct isst_id *id, int config_index, + struct isst_pkg_ctdp_level_info *ctdp_level) +{ + unsigned int resp; + int ret; + + ctdp_level->uncore_pm = 0; + ctdp_level->uncore_p0 = 0; + ctdp_level->uncore_p1 = 0; + + ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, + CONFIG_TDP_GET_RATIO_INFO, 0, + (BIT(16) | config_index) , &resp); + if (ret) { + goto try_uncore_mbox; + } + + ctdp_level->uncore_p0 = resp & GENMASK(7, 0); + ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8; + ctdp_level->uncore_pm = (resp & GENMASK(31, 24)) >> 24; + + debug_printf( + "cpu:%d ctdp:%d CONFIG_TDP_GET_RATIO_INFO resp:%x uncore p0:%d uncore p1:%d uncore pm:%d\n", + id->cpu, config_index, resp, ctdp_level->uncore_p0, ctdp_level->uncore_p1, + ctdp_level->uncore_pm); + + return; + +try_uncore_mbox: + ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, + CONFIG_TDP_GET_UNCORE_P0_P1_INFO, 0, + config_index, &resp); + if (ret) { + ctdp_level->uncore_p0 = 0; + ctdp_level->uncore_p1 = 0; + return; + } + + ctdp_level->uncore_p0 = resp & GENMASK(7, 0); + ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8; + debug_printf( + "cpu:%d ctdp:%d CONFIG_TDP_GET_UNCORE_P0_P1_INFO resp:%x uncore p0:%d uncore p1:%d\n", + id->cpu, config_index, resp, ctdp_level->uncore_p0, + ctdp_level->uncore_p1); +} + static int mbox_get_tdp_info(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level) { @@ -497,6 +543,7 @@ static struct isst_platform_ops mbox_ops = { .get_pbf_info = mbox_get_pbf_info, .set_pbf_fact_status = mbox_set_pbf_fact_status, .get_fact_info = mbox_get_fact_info, + .get_uncore_p0_p1_info = mbox_get_uncore_p0_p1_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 e42469363803..5d0db8424361 100644 --- a/tools/power/x86/intel-speed-select/isst-core.c +++ b/tools/power/x86/intel-speed-select/isst-core.c @@ -521,47 +521,8 @@ void isst_get_process_ctdp_complete(struct isst_id *id, struct isst_pkg_ctdp *pk void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level) { - unsigned int resp; - int ret; - - ctdp_level->uncore_pm = 0; - ctdp_level->uncore_p0 = 0; - ctdp_level->uncore_p1 = 0; - - ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, - CONFIG_TDP_GET_RATIO_INFO, 0, - (BIT(16) | config_index) , &resp); - if (ret) { - goto try_uncore_mbox; - } - - ctdp_level->uncore_p0 = resp & GENMASK(7, 0); - ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8; - ctdp_level->uncore_pm = (resp & GENMASK(31, 24)) >> 24; - - debug_printf( - "cpu:%d ctdp:%d CONFIG_TDP_GET_RATIO_INFO resp:%x uncore p0:%d uncore p1:%d uncore pm:%d\n", - id->cpu, config_index, resp, ctdp_level->uncore_p0, ctdp_level->uncore_p1, - ctdp_level->uncore_pm); - - return; - -try_uncore_mbox: - ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, - CONFIG_TDP_GET_UNCORE_P0_P1_INFO, 0, - config_index, &resp); - if (ret) { - ctdp_level->uncore_p0 = 0; - ctdp_level->uncore_p1 = 0; - return; - } - - ctdp_level->uncore_p0 = resp & GENMASK(7, 0); - ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8; - debug_printf( - "cpu:%d ctdp:%d CONFIG_TDP_GET_UNCORE_P0_P1_INFO resp:%x uncore p0:%d uncore p1:%d\n", - id->cpu, config_index, resp, ctdp_level->uncore_p0, - ctdp_level->uncore_p1); + CHECK_CB(get_uncore_p0_p1_info); + return isst_ops->get_uncore_p0_p1_info(id, config_index, ctdp_level); } void isst_get_p1_info(struct isst_id *id, int config_index, @@ -719,7 +680,6 @@ int isst_get_process_ctdp(struct isst_id *id, int tdp_level, struct isst_pkg_ctd if (ret) return ret; } - isst_get_uncore_p0_p1_info(id, i, ctdp_level); isst_get_p1_info(id, i, ctdp_level); isst_get_uncore_mem_freq(id, i, ctdp_level); diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h index 4fd901ef2437..e113a2bef404 100644 --- a/tools/power/x86/intel-speed-select/isst.h +++ b/tools/power/x86/intel-speed-select/isst.h @@ -197,6 +197,7 @@ struct isst_platform_ops { int (*get_pbf_info)(struct isst_id *id, int level, struct isst_pbf_info *pbf_info); int (*set_pbf_fact_status)(struct isst_id *id, int pbf, int enable); int (*get_fact_info)(struct isst_id *id, int level, int fact_bucket, struct isst_fact_info *fact_info); + void (*get_uncore_p0_p1_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); |