tools/power/x86/intel-speed-select: Fix display of uncore min frequency
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 9 Dec 2022 19:23:02 +0000 (11:23 -0800)
committerHans de Goede <hdegoede@redhat.com>
Fri, 3 Feb 2023 09:00:24 +0000 (10:00 +0100)
Uncore P1 is not uncore minmum frequency. This is uncore base frequency.
Correct display from uncore-frequency-min(MHz)
to uncore-frequency-base(Mhz).

To get uncore min frequency use mailbox command
CONFIG_TDP_GET_RATIO_INFO. Use this mailbox to get uncore frequency
limits when present.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
tools/power/x86/intel-speed-select/isst-core.c
tools/power/x86/intel-speed-select/isst-display.c
tools/power/x86/intel-speed-select/isst.h

index f701b45..2bfc118 100644 (file)
@@ -156,6 +156,29 @@ void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index,
 {
        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);
index b19f57d..7feadac 100644 (file)
@@ -423,10 +423,10 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
                        format_and_print(outf, level + 2, header, value);
                }
 
-               if (ctdp_level->uncore_p1) {
+               if (ctdp_level->uncore_pm) {
                        snprintf(header, sizeof(header), "uncore-frequency-min(MHz)");
                        snprintf(value, sizeof(value), "%d",
-                                ctdp_level->uncore_p1 * DISP_FREQ_MULTIPLIER);
+                                ctdp_level->uncore_pm * DISP_FREQ_MULTIPLIER);
                        format_and_print(outf, level + 2, header, value);
                }
 
@@ -437,6 +437,13 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
                        format_and_print(outf, level + 2, header, value);
                }
 
+               if (ctdp_level->uncore_p1) {
+                       snprintf(header, sizeof(header), "uncore-frequency-base(MHz)");
+                       snprintf(value, sizeof(value), "%d",
+                                ctdp_level->uncore_p1 * DISP_FREQ_MULTIPLIER);
+                       format_and_print(outf, level + 2, header, value);
+               }
+
                if (ctdp_level->mem_freq) {
                        snprintf(header, sizeof(header), "mem-frequency(MHz)");
                        snprintf(value, sizeof(value), "%d",
index 409fcc9..824876e 100644 (file)
@@ -47,6 +47,7 @@
 #define CONFIG_TDP_GET_UNCORE_P0_P1_INFO       0X09
 #define CONFIG_TDP_GET_P1_INFO                 0x0a
 #define CONFIG_TDP_GET_MEM_FREQ                        0x0b
+#define        CONFIG_TDP_GET_RATIO_INFO               0x0c
 
 #define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES    0x10
 #define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS      0x11
@@ -144,6 +145,7 @@ struct isst_pkg_ctdp_level_info {
        int t_proc_hot;
        int uncore_p0;
        int uncore_p1;
+       int uncore_pm;
        int sse_p1;
        int avx2_p1;
        int avx512_p1;
@@ -208,6 +210,8 @@ extern int isst_get_ctdp_control(struct isst_id *id, int config_index,
                                 struct isst_pkg_ctdp_level_info *ctdp_level);
 extern int isst_get_coremask_info(struct isst_id *id, int config_index,
                           struct isst_pkg_ctdp_level_info *ctdp_level);
+extern void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index,
+                                       struct isst_pkg_ctdp_level_info *ctdp_level);
 extern int isst_get_process_ctdp(struct isst_id *id, int tdp_level,
                                 struct isst_pkg_ctdp *pkg_dev);
 extern void isst_get_process_ctdp_complete(struct isst_id *id,