summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-09-13 15:23:19 +0300
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 23:36:55 +0300
commitd0e12c46f518620551d719b19b93777dafd0b5e6 (patch)
tree8ae783943ba17b3599ddd7513462f3b8febe0412 /tools/power
parent14f0cf6cfa53a3a4f2f713b1d54eb71e96ff34cb (diff)
downloadlinux-d0e12c46f518620551d719b19b93777dafd0b5e6.tar.xz
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 <rui.zhang@intel.com> 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.c16
-rw-r--r--tools/power/x86/intel-speed-select/isst-core.c3
2 files changed, 17 insertions, 2 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index b10c6ecd9777..a04005622b32 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -800,6 +800,9 @@ void set_cpu_mask_from_punit_coremask(struct isst_id *id, unsigned long long cor
{
int i, cnt = 0;
+ if (id->cpu < 0)
+ return;
+
*cpu_cnt = 0;
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
display_result:
isst_display_result(id, outf, "perf-profile", "set_tdp_level", ret);
- if (force_online_offline) {
+ if (force_online_offline && id->cpu >= 0) {
struct isst_pkg_ctdp_level_info ctdp_level;
/* Wait for updated base frequencies */
@@ -1547,6 +1550,9 @@ static void set_scaling_min_to_cpuinfo_max(struct isst_id *id)
{
int i;
+ if (id->cpu < 0)
+ return;
+
for (i = 0; i < get_topo_max_cpus(); ++i) {
if (!is_cpu_in_power_domain(i, id))
continue;
@@ -1564,6 +1570,9 @@ static void set_scaling_min_to_cpuinfo_min(struct isst_id *id)
{
int i;
+ if (id->cpu < 0)
+ return;
+
for (i = 0; i < get_topo_max_cpus(); ++i) {
if (!is_cpu_in_power_domain(i, id))
continue;
@@ -1643,6 +1652,9 @@ static int set_pbf_core_power(struct isst_id *id)
struct isst_pkg_ctdp pkg_dev;
int ret;
+ if (id->cpu < 0)
+ return 0;
+
ret = isst_get_ctdp_levels(id, &pkg_dev);
if (ret) {
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
struct isst_pkg_ctdp pkg_dev;
ret = isst_get_ctdp_levels(id, &pkg_dev);
- if (!ret)
+ if (!ret && id->cpu >= 0)
ret = isst_set_trl(id, fact_trl);
if (ret && auto_mode)
isst_pm_qos_config(id, 0, 0);
diff --git a/tools/power/x86/intel-speed-select/isst-core.c b/tools/power/x86/intel-speed-select/isst-core.c
index f0b96d7078d3..f55fef4c13a7 100644
--- a/tools/power/x86/intel-speed-select/isst-core.c
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -287,6 +287,9 @@ int isst_set_trl_from_current_tdp(struct isst_id *id, unsigned long long trl)
unsigned long long msr_trl;
int ret;
+ if (id->cpu < 0)
+ return 0;
+
if (trl) {
msr_trl = trl;
} else {