summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-06 20:26:28 +0300
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 23:36:53 +0300
commita0ca5a097342f78d41e104d8d6bb0742ff0e7330 (patch)
treed4bdc604f23dd381734ea4c41151f87e0ef5b600 /tools/power
parent887e5be91dd253ff73c0b2644442c0cae5d6dca0 (diff)
downloadlinux-a0ca5a097342f78d41e104d8d6bb0742ff0e7330.tar.xz
tools/power/x86/intel-speed-select: Get punit core mapping information
Get punit core mapping information using format of MSR 0x54. Based on the API version, decode is done using new format. The new format also include a power domain ID. TPMI SST information is for each power domain. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/intel-speed-select/isst-config.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index 891693ac1234..136da390b4b2 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -669,6 +669,46 @@ int get_cpu_count(struct isst_id *id)
return cpu_cnt[id->pkg][id->die][id->punit];
}
+static void update_punit_cpu_info(__u32 physical_cpu, struct _cpu_map *cpu_map)
+{
+ if (api_version() > 1) {
+ /*
+ * MSR 0x54 format
+ * [15:11] PM_DOMAIN_ID
+ * [10:3] MODULE_ID (aka IDI_AGENT_ID)
+ * [2:0] LP_ID (We don't care about these bits we only
+ * care die and core id
+ * For Atom:
+ * [2] Always 0
+ * [1:0] core ID within module
+ * For Core
+ * [2:1] Always 0
+ * [0] thread ID
+ */
+ cpu_map->punit_id = (physical_cpu >> 11) & 0x1f;
+ cpu_map->punit_cpu_core = (physical_cpu >> 3) & 0xff;
+ cpu_map->punit_cpu = physical_cpu & 0x7ff;
+ } else {
+ int punit_id;
+
+ /*
+ * MSR 0x53 format
+ * Format
+ * Bit 0 – thread ID
+ * Bit 8:1 – core ID
+ * Bit 13:9 – punit ID
+ */
+ cpu_map->punit_cpu = physical_cpu & 0x1ff;
+ cpu_map->punit_cpu_core = (cpu_map->punit_cpu >> 1); // shift to get core id
+ punit_id = (physical_cpu >> 9) & 0x1f;
+
+ if (punit_id >= MAX_PUNIT_PER_DIE)
+ punit_id = 0;
+
+ cpu_map->punit_id = punit_id;
+ }
+}
+
static void create_cpu_map(void)
{
const char *pathname = "/dev/isst_interface";
@@ -727,24 +767,9 @@ static void create_cpu_map(void)
fprintf(outf, "Error: map logical_cpu:%d\n",
map.cpu_map[0].logical_cpu);
} else {
- /*
- * Format
- * Bit 0 – thread ID
- * Bit 8:1 – core ID
- * Bit 13:9 – punit ID
- */
- cpu_map[i].punit_cpu = map.cpu_map[0].physical_cpu & 0x1ff;
- cpu_map[i].punit_cpu_core = (cpu_map[i].punit_cpu >>
- 1); // shift to get core id
- punit_id = (map.cpu_map[0].physical_cpu >> 9) & 0x1f;
-
- if (punit_id >= MAX_PUNIT_PER_DIE)
- punit_id = 0;
-
- cpu_map[i].punit_id = punit_id;
+ update_punit_cpu_info(map.cpu_map[0].physical_cpu, &cpu_map[i]);
}
}
-
cpu_map[i].initialized = 1;
cpu_cnt[pkg_id][die_id][punit_id]++;