Commit 159f130f authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Hans de Goede

tools/power/x86/intel-speed-select: Fix uncore memory frequency display

The uncore memory frequency value from the mailbox command
CONFIG_TDP_GET_MEM_FREQ needs to be scaled based on the platform for
display. There is no single constant multiplier.

This change introduces CPU model specific memory frequency multiplier.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 24700e1f
...@@ -106,6 +106,22 @@ int is_skx_based_platform(void) ...@@ -106,6 +106,22 @@ int is_skx_based_platform(void)
return 0; return 0;
} }
int is_spr_platform(void)
{
if (cpu_model == 0x8F)
return 1;
return 0;
}
int is_icx_platform(void)
{
if (cpu_model == 0x6A || cpu_model == 0x6C)
return 1;
return 0;
}
static int update_cpu_model(void) static int update_cpu_model(void)
{ {
unsigned int ebx, ecx, edx; unsigned int ebx, ecx, edx;
......
...@@ -201,6 +201,7 @@ void isst_get_uncore_mem_freq(int cpu, int config_index, ...@@ -201,6 +201,7 @@ void isst_get_uncore_mem_freq(int cpu, int config_index,
{ {
unsigned int resp; unsigned int resp;
int ret; int ret;
ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_MEM_FREQ, ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_MEM_FREQ,
0, config_index, &resp); 0, config_index, &resp);
if (ret) { if (ret) {
...@@ -209,6 +210,20 @@ void isst_get_uncore_mem_freq(int cpu, int config_index, ...@@ -209,6 +210,20 @@ void isst_get_uncore_mem_freq(int cpu, int config_index,
} }
ctdp_level->mem_freq = resp & GENMASK(7, 0); ctdp_level->mem_freq = resp & GENMASK(7, 0);
if (is_spr_platform()) {
ctdp_level->mem_freq *= 200;
} else if (is_icx_platform()) {
if (ctdp_level->mem_freq < 7) {
ctdp_level->mem_freq = (12 - ctdp_level->mem_freq) * 133.33 * 2 * 10;
ctdp_level->mem_freq /= 10;
if (ctdp_level->mem_freq % 10 > 5)
ctdp_level->mem_freq++;
} else {
ctdp_level->mem_freq = 0;
}
} else {
ctdp_level->mem_freq = 0;
}
debug_printf( debug_printf(
"cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n", "cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n",
cpu, config_index, resp, ctdp_level->mem_freq); cpu, config_index, resp, ctdp_level->mem_freq);
......
...@@ -446,7 +446,7 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level, ...@@ -446,7 +446,7 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
if (ctdp_level->mem_freq) { if (ctdp_level->mem_freq) {
snprintf(header, sizeof(header), "mem-frequency(MHz)"); snprintf(header, sizeof(header), "mem-frequency(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
ctdp_level->mem_freq * DISP_FREQ_MULTIPLIER); ctdp_level->mem_freq);
format_and_print(outf, level + 2, header, value); format_and_print(outf, level + 2, header, value);
} }
......
...@@ -257,5 +257,7 @@ extern int get_cpufreq_base_freq(int cpu); ...@@ -257,5 +257,7 @@ extern int get_cpufreq_base_freq(int cpu);
extern int isst_read_pm_config(int cpu, int *cp_state, int *cp_cap); extern int isst_read_pm_config(int cpu, int *cp_state, int *cp_cap);
extern void isst_display_error_info_message(int error, char *msg, int arg_valid, int arg); extern void isst_display_error_info_message(int error, char *msg, int arg_valid, int arg);
extern int is_skx_based_platform(void); extern int is_skx_based_platform(void);
extern int is_spr_platform(void);
extern int is_icx_platform(void);
extern void isst_trl_display_information(int cpu, FILE *outf, unsigned long long trl); extern void isst_trl_display_information(int cpu, FILE *outf, unsigned long long trl);
#endif #endif
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