]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/power/x86/intel-speed-select: Fix the condition to check multi die system
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 5 Mar 2025 19:01:56 +0000 (11:01 -0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 7 Mar 2025 16:00:21 +0000 (08:00 -0800)
Even when there is no die exported by CPUID leaf 0x1F, the kernel version
after 6.9 will show non zero die_id in the sysfs. In that case maximum
die_id can still match maximum power domain ID. So the condition to check
if the power domain ID is same a die_id to prevent duplicate display
doesn't hold true.

The better condition is to check if the maximum die_id is more than the
maximum package_id. If the die_id is exposed by CPUID leaf 0x1F, the
maximum die_id will be more than maximum package_id.

With this change tracking of max_punit_id is not used, so remove storing
max_punit_id.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c

index c319bfc3b7cba903f494b3086a815000ae9dc729..545e9e88f9986016e193d095aa20d816dbcb6717 100644 (file)
@@ -46,8 +46,8 @@ static int force_online_offline;
 static int auto_mode;
 static int fact_enable_fail;
 static int cgroupv2;
+static int max_pkg_id;
 static int max_die_id;
-static int max_punit_id;
 static int max_die_id_package_0;
 
 /* clos related */
@@ -567,7 +567,7 @@ 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) {
+               if (max_die_id > max_pkg_id) {
                        for (k = 0; k < MAX_PUNIT_PER_DIE && k < MAX_DIE_PER_PACKAGE; k++) {
                                id.cpu = cpus[i][k][k];
                                id.pkg = i;
@@ -794,6 +794,8 @@ static void create_cpu_map(void)
                cpu_map[i].die_id = die_id;
                cpu_map[i].core_id = core_id;
 
+               if (max_pkg_id < pkg_id)
+                       max_pkg_id = pkg_id;
 
                punit_id = 0;
 
@@ -818,9 +820,6 @@ static void create_cpu_map(void)
                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;
-
                if (!pkg_id && max_die_id_package_0 < die_id)
                        max_die_id_package_0 = die_id;