tools/power/x86/intel-speed-select: Support multiple dies
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 7 Mar 2024 23:47:11 +0000 (15:47 -0800)
committerHans de Goede <hdegoede@redhat.com>
Mon, 29 Apr 2024 11:31:49 +0000 (13:31 +0200)
When the die id is same as punit compute die ID, treat them same. In this
case, when for_each_online_power_domain_in_set() is called, then don't
loop for each punit in a die. Just loop for all punits in a package.

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-config.c

index d865dc1f89ee12891c2a2e6694e5235015f65e4c..54c50124303e1386d76aade1a558bfa63a58081b 100644 (file)
@@ -46,6 +46,8 @@ static int force_online_offline;
 static int auto_mode;
 static int fact_enable_fail;
 static int cgroupv2;
+static int max_die_id;
+static int max_punit_id;
 
 /* clos related */
 static int current_clos = -1;
@@ -562,6 +564,18 @@ void for_each_online_power_domain_in_set(void (*callback)(struct isst_id *, void
        }
 
        for (i = 0; i < MAX_PACKAGE_COUNT; i++) {
+               if (max_die_id == max_punit_id) {
+                       for (k = 0; k < MAX_PUNIT_PER_DIE && k < MAX_DIE_PER_PACKAGE; k++) {
+                               id.cpu = cpus[i][k][k];
+                               id.pkg = i;
+                               id.die = k;
+                               id.punit = k;
+                               if (isst_is_punit_valid(&id))
+                                       callback(&id, arg1, arg2, arg3, arg4);
+                       }
+                       continue;
+               }
+
                for (j = 0; j < MAX_DIE_PER_PACKAGE; j++) {
                        /*
                         * Fix me:
@@ -795,6 +809,12 @@ static void create_cpu_map(void)
 
                cpu_cnt[pkg_id][die_id][punit_id]++;
 
+               if (max_die_id < die_id)
+                       max_die_id = die_id;
+
+               if (max_punit_id < cpu_map[i].punit_id)
+                       max_punit_id = cpu_map[i].punit_id;
+
                debug_printf(
                        "map logical_cpu:%d core: %d die:%d pkg:%d punit:%d punit_cpu:%d punit_core:%d\n",
                        i, cpu_map[i].core_id, cpu_map[i].die_id,