tools/power/x86/intel-speed-select: Fix the condition to check multi die system

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>
This commit is contained in:
Srinivas Pandruvada 2025-03-05 11:01:56 -08:00
parent d74e6e29d2
commit c49e805db3

View 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;