Skip to content

Commit 159f130

Browse files
spandruvadajwrdegoede
authored andcommitted
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: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 24700e1 commit 159f130

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

tools/power/x86/intel-speed-select/isst-config.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ int is_skx_based_platform(void)
106106
return 0;
107107
}
108108

109+
int is_spr_platform(void)
110+
{
111+
if (cpu_model == 0x8F)
112+
return 1;
113+
114+
return 0;
115+
}
116+
117+
int is_icx_platform(void)
118+
{
119+
if (cpu_model == 0x6A || cpu_model == 0x6C)
120+
return 1;
121+
122+
return 0;
123+
}
124+
109125
static int update_cpu_model(void)
110126
{
111127
unsigned int ebx, ecx, edx;

tools/power/x86/intel-speed-select/isst-core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ void isst_get_uncore_mem_freq(int cpu, int config_index,
201201
{
202202
unsigned int resp;
203203
int ret;
204+
204205
ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_MEM_FREQ,
205206
0, config_index, &resp);
206207
if (ret) {
@@ -209,6 +210,20 @@ void isst_get_uncore_mem_freq(int cpu, int config_index,
209210
}
210211

211212
ctdp_level->mem_freq = resp & GENMASK(7, 0);
213+
if (is_spr_platform()) {
214+
ctdp_level->mem_freq *= 200;
215+
} else if (is_icx_platform()) {
216+
if (ctdp_level->mem_freq < 7) {
217+
ctdp_level->mem_freq = (12 - ctdp_level->mem_freq) * 133.33 * 2 * 10;
218+
ctdp_level->mem_freq /= 10;
219+
if (ctdp_level->mem_freq % 10 > 5)
220+
ctdp_level->mem_freq++;
221+
} else {
222+
ctdp_level->mem_freq = 0;
223+
}
224+
} else {
225+
ctdp_level->mem_freq = 0;
226+
}
212227
debug_printf(
213228
"cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n",
214229
cpu, config_index, resp, ctdp_level->mem_freq);

tools/power/x86/intel-speed-select/isst-display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
446446
if (ctdp_level->mem_freq) {
447447
snprintf(header, sizeof(header), "mem-frequency(MHz)");
448448
snprintf(value, sizeof(value), "%d",
449-
ctdp_level->mem_freq * DISP_FREQ_MULTIPLIER);
449+
ctdp_level->mem_freq);
450450
format_and_print(outf, level + 2, header, value);
451451
}
452452

tools/power/x86/intel-speed-select/isst.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,5 +257,7 @@ extern int get_cpufreq_base_freq(int cpu);
257257
extern int isst_read_pm_config(int cpu, int *cp_state, int *cp_cap);
258258
extern void isst_display_error_info_message(int error, char *msg, int arg_valid, int arg);
259259
extern int is_skx_based_platform(void);
260+
extern int is_spr_platform(void);
261+
extern int is_icx_platform(void);
260262
extern void isst_trl_display_information(int cpu, FILE *outf, unsigned long long trl);
261263
#endif

0 commit comments

Comments
 (0)