diff options
Diffstat (limited to 'tools/power/x86/intel-speed-select/isst-daemon.c')
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-daemon.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-daemon.c b/tools/power/x86/intel-speed-select/isst-daemon.c index d0400c6684ba..0699137c0901 100644 --- a/tools/power/x86/intel-speed-select/isst-daemon.c +++ b/tools/power/x86/intel-speed-select/isst-daemon.c @@ -32,62 +32,60 @@ static void init_levels(void) per_package_levels_info[i][j] = -1; } -void process_level_change(int cpu) +void process_level_change(struct isst_id *id) { struct isst_pkg_ctdp_level_info ctdp_level; - int pkg_id = get_physical_package_id(cpu); - int die_id = get_physical_die_id(cpu); struct isst_pkg_ctdp pkg_dev; time_t tm; int ret; - if (pkg_id >= MAX_PACKAGE_COUNT || die_id >= MAX_DIE_PER_PACKAGE) { - debug_printf("Invalid package/die info for cpu:%d\n", cpu); + if (id->pkg < 0 || id->die < 0) { + debug_printf("Invalid package/die info for cpu:%d\n", id->cpu); return; } tm = time(NULL); - if (tm - per_package_levels_tm[pkg_id][die_id] < 2 ) + if (tm - per_package_levels_tm[id->pkg][id->die] < 2) return; - per_package_levels_tm[pkg_id][die_id] = tm; + per_package_levels_tm[id->pkg][id->die] = tm; - ret = isst_get_ctdp_levels(cpu, &pkg_dev); + ret = isst_get_ctdp_levels(id, &pkg_dev); if (ret) { - debug_printf("Can't get tdp levels for cpu:%d\n", cpu); + debug_printf("Can't get tdp levels for cpu:%d\n", id->cpu); return; } - debug_printf("Get Config level %d pkg:%d die:%d current_level:%d \n", cpu, - pkg_id, die_id, pkg_dev.current_level); + debug_printf("Get Config level %d pkg:%d die:%d current_level:%d\n", id->cpu, + id->pkg, id->die, pkg_dev.current_level); if (pkg_dev.locked) { debug_printf("config TDP s locked \n"); return; } - if (per_package_levels_info[pkg_id][die_id] == pkg_dev.current_level) + if (per_package_levels_info[id->pkg][id->die] == pkg_dev.current_level) return; debug_printf("**Config level change for cpu:%d pkg:%d die:%d from %d to %d\n", - cpu, pkg_id, die_id, per_package_levels_info[pkg_id][die_id], + id->cpu, id->pkg, id->die, per_package_levels_info[id->pkg][id->die], pkg_dev.current_level); - per_package_levels_info[pkg_id][die_id] = pkg_dev.current_level; + per_package_levels_info[id->pkg][id->die] = pkg_dev.current_level; ctdp_level.core_cpumask_size = alloc_cpu_set(&ctdp_level.core_cpumask); - ret = isst_get_coremask_info(cpu, pkg_dev.current_level, &ctdp_level); + ret = isst_get_coremask_info(id, pkg_dev.current_level, &ctdp_level); if (ret) { free_cpu_set(ctdp_level.core_cpumask); - debug_printf("Can't get core_mask:%d\n", cpu); + debug_printf("Can't get core_mask:%d\n", id->cpu); return; } if (ctdp_level.cpu_count) { int i, max_cpus = get_topo_max_cpus(); for (i = 0; i < max_cpus; ++i) { - if (pkg_id != get_physical_package_id(i) || die_id != get_physical_die_id(i)) + if (!is_cpu_in_power_domain(i, id)) continue; if (CPU_ISSET_S(i, ctdp_level.core_cpumask_size, ctdp_level.core_cpumask)) { fprintf(stderr, "online cpu %d\n", i); @@ -102,10 +100,10 @@ void process_level_change(int cpu) free_cpu_set(ctdp_level.core_cpumask); } -static void _poll_for_config_change(int cpu, void *arg1, void *arg2, +static void _poll_for_config_change(struct isst_id *id, void *arg1, void *arg2, void *arg3, void *arg4) { - process_level_change(cpu); + process_level_change(id); } static void poll_for_config_change(void) |