Commit 13b868f8 authored by Zhang Rui's avatar Zhang Rui Committed by Srinivas Pandruvada

tools/power/x86/intel-speed-select: Introduce isst_get_disp_freq_multiplier

Remove hardcoded DISP_FREQ_MULTIPLIER in the code and use
isst_get_disp_freq_multiplier() instead.

No functional changes are expected.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
parent 2042c0ab
...@@ -2556,7 +2556,7 @@ static void parse_cmd_args(int argc, int start, char **argv) ...@@ -2556,7 +2556,7 @@ static void parse_cmd_args(int argc, int start, char **argv)
break; break;
case 'd': case 'd':
clos_desired = atoi(optarg); clos_desired = atoi(optarg);
clos_desired /= DISP_FREQ_MULTIPLIER; clos_desired /= isst_get_disp_freq_multiplier();
break; break;
case 'e': case 'e':
clos_epp = atoi(optarg); clos_epp = atoi(optarg);
...@@ -2567,11 +2567,11 @@ static void parse_cmd_args(int argc, int start, char **argv) ...@@ -2567,11 +2567,11 @@ static void parse_cmd_args(int argc, int start, char **argv)
break; break;
case 'n': case 'n':
clos_min = atoi(optarg); clos_min = atoi(optarg);
clos_min /= DISP_FREQ_MULTIPLIER; clos_min /= isst_get_disp_freq_multiplier();
break; break;
case 'm': case 'm':
clos_max = atoi(optarg); clos_max = atoi(optarg);
clos_max /= DISP_FREQ_MULTIPLIER; clos_max /= isst_get_disp_freq_multiplier();
break; break;
case 'p': case 'p':
clos_priority_type = atoi(optarg); clos_priority_type = atoi(optarg);
......
...@@ -23,6 +23,11 @@ void isst_update_platform_param(enum isst_platform_param param, int value) ...@@ -23,6 +23,11 @@ void isst_update_platform_param(enum isst_platform_param param, int value)
} }
} }
int isst_get_disp_freq_multiplier(void)
{
return DISP_FREQ_MULTIPLIER;
}
int isst_get_trl_max_levels(void) int isst_get_trl_max_levels(void)
{ {
return 3; return 3;
......
...@@ -198,7 +198,7 @@ static void _isst_pbf_display_information(struct isst_id *id, FILE *outf, int le ...@@ -198,7 +198,7 @@ static void _isst_pbf_display_information(struct isst_id *id, FILE *outf, int le
snprintf(header, sizeof(header), "high-priority-base-frequency(MHz)"); snprintf(header, sizeof(header), "high-priority-base-frequency(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
pbf_info->p1_high * DISP_FREQ_MULTIPLIER); pbf_info->p1_high * isst_get_disp_freq_multiplier());
format_and_print(outf, disp_level + 1, header, value); format_and_print(outf, disp_level + 1, header, value);
snprintf(header, sizeof(header), "high-priority-cpu-mask"); snprintf(header, sizeof(header), "high-priority-cpu-mask");
...@@ -214,7 +214,7 @@ static void _isst_pbf_display_information(struct isst_id *id, FILE *outf, int le ...@@ -214,7 +214,7 @@ static void _isst_pbf_display_information(struct isst_id *id, FILE *outf, int le
snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)"); snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
pbf_info->p1_low * DISP_FREQ_MULTIPLIER); pbf_info->p1_low * isst_get_disp_freq_multiplier());
format_and_print(outf, disp_level + 1, header, value); format_and_print(outf, disp_level + 1, header, value);
if (is_clx_n_platform()) if (is_clx_n_platform())
...@@ -282,7 +282,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l ...@@ -282,7 +282,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
snprintf(header, sizeof(header), snprintf(header, sizeof(header),
"high-priority-max-%s-frequency(MHz)", isst_get_trl_level_name(i)); "high-priority-max-%s-frequency(MHz)", isst_get_trl_level_name(i));
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
bucket_info[j].hp_ratios[i] * DISP_FREQ_MULTIPLIER); bucket_info[j].hp_ratios[i] * isst_get_disp_freq_multiplier());
format_and_print(outf, base_level + 2, header, value); format_and_print(outf, base_level + 2, header, value);
} }
} }
...@@ -298,7 +298,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l ...@@ -298,7 +298,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
snprintf(header, sizeof(header), "low-priority-max-%s-frequency(MHz)", snprintf(header, sizeof(header), "low-priority-max-%s-frequency(MHz)",
isst_get_trl_level_name(j)); isst_get_trl_level_name(j));
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
fact_info->lp_ratios[j] * DISP_FREQ_MULTIPLIER); fact_info->lp_ratios[j] * isst_get_disp_freq_multiplier());
format_and_print(outf, base_level + 2, header, value); format_and_print(outf, base_level + 2, header, value);
} }
} }
...@@ -393,41 +393,41 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level ...@@ -393,41 +393,41 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
if (!ctdp_level->sse_p1) if (!ctdp_level->sse_p1)
ctdp_level->sse_p1 = ctdp_level->tdp_ratio; ctdp_level->sse_p1 = ctdp_level->tdp_ratio;
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->sse_p1 * DISP_FREQ_MULTIPLIER); ctdp_level->sse_p1 * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
if (ctdp_level->avx2_p1) { if (ctdp_level->avx2_p1) {
snprintf(header, sizeof(header), "base-frequency-avx2(MHz)"); snprintf(header, sizeof(header), "base-frequency-avx2(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->avx2_p1 * DISP_FREQ_MULTIPLIER); ctdp_level->avx2_p1 * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
if (ctdp_level->avx512_p1) { if (ctdp_level->avx512_p1) {
snprintf(header, sizeof(header), "base-frequency-avx512(MHz)"); snprintf(header, sizeof(header), "base-frequency-avx512(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->avx512_p1 * DISP_FREQ_MULTIPLIER); ctdp_level->avx512_p1 * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
if (ctdp_level->uncore_pm) { if (ctdp_level->uncore_pm) {
snprintf(header, sizeof(header), "uncore-frequency-min(MHz)"); snprintf(header, sizeof(header), "uncore-frequency-min(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->uncore_pm * DISP_FREQ_MULTIPLIER); ctdp_level->uncore_pm * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
if (ctdp_level->uncore_p0) { if (ctdp_level->uncore_p0) {
snprintf(header, sizeof(header), "uncore-frequency-max(MHz)"); snprintf(header, sizeof(header), "uncore-frequency-max(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->uncore_p0 * DISP_FREQ_MULTIPLIER); ctdp_level->uncore_p0 * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
if (ctdp_level->uncore_p1) { if (ctdp_level->uncore_p1) {
snprintf(header, sizeof(header), "uncore-frequency-base(MHz)"); snprintf(header, sizeof(header), "uncore-frequency-base(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->uncore_p1 * DISP_FREQ_MULTIPLIER); ctdp_level->uncore_p1 * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
...@@ -506,7 +506,7 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level ...@@ -506,7 +506,7 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
format_and_print(outf, level + 4, header, value); format_and_print(outf, level + 4, header, value);
snprintf(header, sizeof(header), "max-turbo-frequency(MHz)"); snprintf(header, sizeof(header), "max-turbo-frequency(MHz)");
snprintf(value, sizeof(value), "%d", ctdp_level->trl_ratios[k][j] * DISP_FREQ_MULTIPLIER); snprintf(value, sizeof(value), "%d", ctdp_level->trl_ratios[k][j] * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 4, header, value); format_and_print(outf, level + 4, header, value);
} }
} }
...@@ -585,18 +585,18 @@ void isst_clos_display_information(struct isst_id *id, FILE *outf, int clos, ...@@ -585,18 +585,18 @@ void isst_clos_display_information(struct isst_id *id, FILE *outf, int clos,
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
snprintf(header, sizeof(header), "clos-min"); snprintf(header, sizeof(header), "clos-min");
snprintf(value, sizeof(value), "%d MHz", clos_config->clos_min * DISP_FREQ_MULTIPLIER); snprintf(value, sizeof(value), "%d MHz", clos_config->clos_min * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
snprintf(header, sizeof(header), "clos-max"); snprintf(header, sizeof(header), "clos-max");
if (clos_config->clos_max == 0xff) if (clos_config->clos_max == 0xff)
snprintf(value, sizeof(value), "Max Turbo frequency"); snprintf(value, sizeof(value), "Max Turbo frequency");
else else
snprintf(value, sizeof(value), "%d MHz", clos_config->clos_max * DISP_FREQ_MULTIPLIER); snprintf(value, sizeof(value), "%d MHz", clos_config->clos_max * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
snprintf(header, sizeof(header), "clos-desired"); snprintf(header, sizeof(header), "clos-desired");
snprintf(value, sizeof(value), "%d MHz", clos_config->clos_desired * DISP_FREQ_MULTIPLIER); snprintf(value, sizeof(value), "%d MHz", clos_config->clos_desired * isst_get_disp_freq_multiplier());
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
format_and_print(outf, level, NULL, NULL); format_and_print(outf, level, NULL, NULL);
......
...@@ -208,6 +208,7 @@ extern int isst_send_msr_command(unsigned int cpu, unsigned int command, ...@@ -208,6 +208,7 @@ extern int isst_send_msr_command(unsigned int cpu, unsigned int command,
int write, unsigned long long *req_resp); int write, unsigned long long *req_resp);
extern void isst_update_platform_param(enum isst_platform_param, int vale); extern void isst_update_platform_param(enum isst_platform_param, int vale);
extern int isst_get_disp_freq_multiplier(void);
extern int isst_get_trl_max_levels(void); extern int isst_get_trl_max_levels(void);
extern char *isst_get_trl_level_name(int level); extern char *isst_get_trl_level_name(int level);
extern int isst_is_punit_valid(struct isst_id *id); extern int isst_is_punit_valid(struct isst_id *id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment