tools/power/x86/intel-speed-select: Follow TRL nameing for FACT info
authorZhang Rui <rui.zhang@intel.com>
Sat, 20 Aug 2022 10:33:01 +0000 (18:33 +0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 22 Mar 2023 20:36:48 +0000 (13:36 -0700)
SST-TF high priority core count and ratios and low priority core ratios
are also per TRL level.
Cleanup the code to follow the same nameing convention as TRL.

This removes hardcoded TRL level names and variables.

No functional changes are expected.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.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 aec81b5..8aa2ee4 100644 (file)
@@ -592,7 +592,7 @@ int isst_get_fact_bucket_info(struct isst_id *id, int level,
                        id->cpu, i, level, resp);
 
                for (j = 0; j < 4; ++j) {
-                       bucket_info[j + (i * 4)].high_priority_cores_count =
+                       bucket_info[j + (i * 4)].hp_cores =
                                (resp >> (j * 8)) & 0xff;
                }
        }
@@ -613,22 +613,8 @@ int isst_get_fact_bucket_info(struct isst_id *id, int level,
                                id->cpu, i, level, k, resp);
 
                        for (j = 0; j < 4; ++j) {
-                               switch (k) {
-                               case 0:
-                                       bucket_info[j + (i * 4)].sse_trl =
-                                               (resp >> (j * 8)) & 0xff;
-                                       break;
-                               case 1:
-                                       bucket_info[j + (i * 4)].avx_trl =
-                                               (resp >> (j * 8)) & 0xff;
-                                       break;
-                               case 2:
-                                       bucket_info[j + (i * 4)].avx512_trl =
-                                               (resp >> (j * 8)) & 0xff;
-                                       break;
-                               default:
-                                       break;
-                               }
+                               bucket_info[j + (i * 4)].hp_ratios[k] =
+                                       (resp >> (j * 8)) & 0xff;
                        }
                }
        }
@@ -672,9 +658,9 @@ int isst_get_fact_info(struct isst_id *id, int level, int fact_bucket, struct is
        debug_printf("cpu:%d CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO resp:%x\n",
                     id->cpu, resp);
 
-       fact_info->lp_clipping_ratio_license_sse = resp & 0xff;
-       fact_info->lp_clipping_ratio_license_avx2 = (resp >> 8) & 0xff;
-       fact_info->lp_clipping_ratio_license_avx512 = (resp >> 16) & 0xff;
+       fact_info->lp_ratios[0] = resp & 0xff;
+       fact_info->lp_ratios[1] = (resp >> 8) & 0xff;
+       fact_info->lp_ratios[2] = (resp >> 16) & 0xff;
 
        ret = isst_get_fact_bucket_info(id, level, fact_info->bucket_info);
        if (ret)
@@ -685,7 +671,7 @@ int isst_get_fact_info(struct isst_id *id, int level, int fact_bucket, struct is
                if (fact_bucket != 0xff && fact_bucket != j)
                        continue;
 
-               if (!fact_info->bucket_info[j].high_priority_cores_count)
+               if (!fact_info->bucket_info[j].hp_cores)
                        break;
 
                print = 1;
index b9efbdf..5e57623 100644 (file)
@@ -235,6 +235,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
                                           int base_level)
 {
        struct isst_fact_bucket_info *bucket_info = fact_info->bucket_info;
+       int trl_max_levels = isst_get_trl_max_levels();
        char header[256];
        char value[256];
        int print = 0, j;
@@ -243,7 +244,7 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
                if (fact_bucket != 0xff && fact_bucket != j)
                        continue;
 
-               if (!bucket_info[j].high_priority_cores_count)
+               if (!bucket_info[j].hp_cores)
                        break;
 
                print = 1;
@@ -256,10 +257,12 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
        snprintf(header, sizeof(header), "speed-select-turbo-freq-properties");
        format_and_print(outf, base_level, header, NULL);
        for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
+               int i;
+
                if (fact_bucket != 0xff && fact_bucket != j)
                        continue;
 
-               if (!bucket_info[j].high_priority_cores_count)
+               if (!bucket_info[j].hp_cores)
                        break;
 
                snprintf(header, sizeof(header), "bucket-%d", j);
@@ -267,54 +270,37 @@ static void _isst_fact_display_information(struct isst_id *id, FILE *outf, int l
 
                snprintf(header, sizeof(header), "high-priority-cores-count");
                snprintf(value, sizeof(value), "%d",
-                        bucket_info[j].high_priority_cores_count);
+                        bucket_info[j].hp_cores);
                format_and_print(outf, base_level + 2, header, value);
-
-               if (fact_avx & 0x01) {
-                       snprintf(header, sizeof(header),
-                                "high-priority-max-frequency(MHz)");
-                       snprintf(value, sizeof(value), "%d",
-                                bucket_info[j].sse_trl * DISP_FREQ_MULTIPLIER);
-                       format_and_print(outf, base_level + 2, header, value);
-               }
-
-               if (fact_avx & 0x02) {
-                       snprintf(header, sizeof(header),
-                                "high-priority-max-avx2-frequency(MHz)");
-                       snprintf(value, sizeof(value), "%d",
-                                bucket_info[j].avx_trl * DISP_FREQ_MULTIPLIER);
-                       format_and_print(outf, base_level + 2, header, value);
-               }
-
-               if (fact_avx & 0x04) {
-                       snprintf(header, sizeof(header),
-                                "high-priority-max-avx512-frequency(MHz)");
+               for (i = 0; i < trl_max_levels; i++) {
+                       if (fact_avx != 0xFF && !(fact_avx & (1 << i)))
+                               continue;
+                       if (i == 0)
+                               snprintf(header, sizeof(header),
+                                       "high-priority-max-frequency(MHz)");
+                       else
+                               snprintf(header, sizeof(header),
+                                       "high-priority-max-%s-frequency(MHz)", isst_get_trl_level_name(i));
                        snprintf(value, sizeof(value), "%d",
-                                bucket_info[j].avx512_trl *
-                                        DISP_FREQ_MULTIPLIER);
+                               bucket_info[j].hp_ratios[i] * DISP_FREQ_MULTIPLIER);
                        format_and_print(outf, base_level + 2, header, value);
                }
        }
        snprintf(header, sizeof(header),
                 "speed-select-turbo-freq-clip-frequencies");
        format_and_print(outf, base_level + 1, header, NULL);
-       snprintf(header, sizeof(header), "low-priority-max-frequency(MHz)");
-       snprintf(value, sizeof(value), "%d",
-                fact_info->lp_clipping_ratio_license_sse *
-                        DISP_FREQ_MULTIPLIER);
-       format_and_print(outf, base_level + 2, header, value);
-       snprintf(header, sizeof(header),
-                "low-priority-max-avx2-frequency(MHz)");
-       snprintf(value, sizeof(value), "%d",
-                fact_info->lp_clipping_ratio_license_avx2 *
-                        DISP_FREQ_MULTIPLIER);
-       format_and_print(outf, base_level + 2, header, value);
-       snprintf(header, sizeof(header),
-                "low-priority-max-avx512-frequency(MHz)");
-       snprintf(value, sizeof(value), "%d",
-                fact_info->lp_clipping_ratio_license_avx512 *
-                        DISP_FREQ_MULTIPLIER);
-       format_and_print(outf, base_level + 2, header, value);
+
+       for (j = 0; j < trl_max_levels; j++) {
+               /* No AVX level name for SSE to be consistent with previous formatting */
+               if (j == 0)
+                       snprintf(header, sizeof(header), "low-priority-max-frequency(MHz)");
+               else
+                       snprintf(header, sizeof(header), "low-priority-max-%s-frequency(MHz)",
+                               isst_get_trl_level_name(j));
+               snprintf(value, sizeof(value), "%d",
+                        fact_info->lp_ratios[j] * DISP_FREQ_MULTIPLIER);
+               format_and_print(outf, base_level + 2, header, value);
+       }
 }
 
 void isst_ctdp_display_core_info(struct isst_id *id, FILE *outf, char *prefix,
index 8f563ff..727afc5 100644 (file)
@@ -98,10 +98,8 @@ struct isst_clos_config {
 };
 
 struct isst_fact_bucket_info {
-       int high_priority_cores_count;
-       int sse_trl;
-       int avx_trl;
-       int avx512_trl;
+       int hp_cores;
+       int hp_ratios[TRL_MAX_LEVELS];
 };
 
 struct isst_pbf_info {
@@ -119,9 +117,7 @@ struct isst_pbf_info {
 #define ISST_TRL_MAX_ACTIVE_CORES      8
 #define ISST_FACT_MAX_BUCKETS          8
 struct isst_fact_info {
-       int lp_clipping_ratio_license_sse;
-       int lp_clipping_ratio_license_avx2;
-       int lp_clipping_ratio_license_avx512;
+       int lp_ratios[TRL_MAX_LEVELS];
        struct isst_fact_bucket_info bucket_info[ISST_FACT_MAX_BUCKETS];
 };