Skip to content

Commit d0e12c4

Browse files
zhang-ruispandruvada
authored andcommitted
tools/power/x86/intel-speed-select: Add cpu id check
Some operations applies to cpu-power-domain only. Add check for cpu id for these functions. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Srinivas Pandruvada <[email protected]>
1 parent 14f0cf6 commit d0e12c4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

tools/power/x86/intel-speed-select/isst-config.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,9 @@ void set_cpu_mask_from_punit_coremask(struct isst_id *id, unsigned long long cor
800800
{
801801
int i, cnt = 0;
802802

803+
if (id->cpu < 0)
804+
return;
805+
803806
*cpu_cnt = 0;
804807

805808
for (i = 0; i < 64; ++i) {
@@ -1253,7 +1256,7 @@ static void set_tdp_level_for_cpu(struct isst_id *id, void *arg1, void *arg2, vo
12531256

12541257
display_result:
12551258
isst_display_result(id, outf, "perf-profile", "set_tdp_level", ret);
1256-
if (force_online_offline) {
1259+
if (force_online_offline && id->cpu >= 0) {
12571260
struct isst_pkg_ctdp_level_info ctdp_level;
12581261

12591262
/* Wait for updated base frequencies */
@@ -1547,6 +1550,9 @@ static void set_scaling_min_to_cpuinfo_max(struct isst_id *id)
15471550
{
15481551
int i;
15491552

1553+
if (id->cpu < 0)
1554+
return;
1555+
15501556
for (i = 0; i < get_topo_max_cpus(); ++i) {
15511557
if (!is_cpu_in_power_domain(i, id))
15521558
continue;
@@ -1564,6 +1570,9 @@ static void set_scaling_min_to_cpuinfo_min(struct isst_id *id)
15641570
{
15651571
int i;
15661572

1573+
if (id->cpu < 0)
1574+
return;
1575+
15671576
for (i = 0; i < get_topo_max_cpus(); ++i) {
15681577
if (!is_cpu_in_power_domain(i, id))
15691578
continue;
@@ -1643,6 +1652,9 @@ static int set_pbf_core_power(struct isst_id *id)
16431652
struct isst_pkg_ctdp pkg_dev;
16441653
int ret;
16451654

1655+
if (id->cpu < 0)
1656+
return 0;
1657+
16461658
ret = isst_get_ctdp_levels(id, &pkg_dev);
16471659
if (ret) {
16481660
debug_printf("isst_get_ctdp_levels failed");
@@ -1888,7 +1900,7 @@ static void set_fact_for_cpu(struct isst_id *id, void *arg1, void *arg2, void *a
18881900
struct isst_pkg_ctdp pkg_dev;
18891901

18901902
ret = isst_get_ctdp_levels(id, &pkg_dev);
1891-
if (!ret)
1903+
if (!ret && id->cpu >= 0)
18921904
ret = isst_set_trl(id, fact_trl);
18931905
if (ret && auto_mode)
18941906
isst_pm_qos_config(id, 0, 0);

tools/power/x86/intel-speed-select/isst-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ int isst_set_trl_from_current_tdp(struct isst_id *id, unsigned long long trl)
287287
unsigned long long msr_trl;
288288
int ret;
289289

290+
if (id->cpu < 0)
291+
return 0;
292+
290293
if (trl) {
291294
msr_trl = trl;
292295
} else {

0 commit comments

Comments
 (0)