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>
This commit is contained in:
Zhang Rui 2022-08-18 00:28:41 +08:00 committed by Srinivas Pandruvada
parent 7b5f586dcf
commit 00c26c1f7e
3 changed files with 50 additions and 42 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);