Commit ad7e17fc authored by Zhang Rui's avatar Zhang Rui Committed by Srinivas Pandruvada

tools/power/x86/intel-speed-select: Improve isst_print_extended_platform_info

The main thing done in isst_print_extended_platform_info is to get the
isst feature status by checking one of the power domains of the
platform.

This can be done using the for_each_online_power_domain_in_set()
function, which makes the code clean and easier to read.

No functional changes are expected.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
[srinivas.pandruvada@linux.intel.com: changelog edits]
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
parent c77a8d4a
...@@ -1002,74 +1002,87 @@ static int isst_fill_platform_info(void) ...@@ -1002,74 +1002,87 @@ static int isst_fill_platform_info(void)
return 0; return 0;
} }
static void isst_print_extended_platform_info(void) void get_isst_status(struct isst_id *id, void *arg1, void *arg2, void *arg3, void *arg4)
{ {
int cp_state, cp_cap, fact_support = 0, pbf_support = 0;
struct isst_pkg_ctdp_level_info ctdp_level;
struct isst_pkg_ctdp pkg_dev; struct isst_pkg_ctdp pkg_dev;
int ret, i, j; struct isst_id *tid = (struct isst_id *)arg2;
FILE *filep; int *mask = (int *)arg3;
struct isst_id id; int *max_level = (int *)arg4;
int j, ret;
for (i = 0; i < 256; ++i) {
char path[256];
snprintf(path, sizeof(path), /* Only check the first cpu power domain */
"/sys/devices/system/cpu/cpu%d/topology/thread_siblings", i); if (id->cpu < 0 || tid->cpu >= 0)
filep = fopen(path, "r");
if (filep)
break;
}
if (!filep)
return; return;
fclose(filep); ret = isst_get_ctdp_levels(id, &pkg_dev);
set_isst_id(&id, i);
ret = isst_get_ctdp_levels(&id, &pkg_dev);
if (ret) if (ret)
return; return;
if (pkg_dev.enabled) { if (pkg_dev.enabled)
fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is supported\n"); *mask |= BIT(0);
} else {
fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is not supported\n");
fprintf(outf, "Only performance level 0 (base level) is present\n");
}
if (pkg_dev.locked) if (pkg_dev.locked)
fprintf(outf, "TDP level change control is locked\n"); *mask |= BIT(1);
else
fprintf(outf, "TDP level change control is unlocked, max level: %d \n", pkg_dev.levels); if (*max_level < pkg_dev.levels)
*max_level = pkg_dev.levels;
for (j = 0; j <= pkg_dev.levels; ++j) { for (j = 0; j <= pkg_dev.levels; ++j) {
ret = isst_get_ctdp_control(&id, j, &ctdp_level); struct isst_pkg_ctdp_level_info ctdp_level;
ret = isst_get_ctdp_control(id, j, &ctdp_level);
if (ret) if (ret)
continue; continue;
if (!fact_support && ctdp_level.fact_support) if (ctdp_level.fact_support)
fact_support = 1; *mask |= BIT(2);
if (ctdp_level.pbf_support)
*mask |= BIT(3);
}
tid->cpu = id->cpu;
tid->pkg = id->pkg;
tid->die = id->die;
tid->punit = id->punit;
}
static void isst_print_extended_platform_info(void)
{
int cp_state, cp_cap;
struct isst_id id;
int mask = 0, max_level = 0;
id.cpu = -1;
for_each_online_power_domain_in_set(get_isst_status, NULL, &id, &mask, &max_level);
if (!pbf_support && ctdp_level.pbf_support) if (mask & BIT(0)) {
pbf_support = 1; fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is supported\n");
} else {
fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is not supported\n");
fprintf(outf, "Only performance level 0 (base level) is present\n");
} }
if (fact_support) if (mask & BIT(1))
fprintf(outf, "TDP level change control is locked\n");
else
fprintf(outf, "TDP level change control is unlocked, max level: %d\n", max_level);
if (mask & BIT(2))
fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is supported\n"); fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is supported\n");
else else
fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is not supported\n"); fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is not supported\n");
if (pbf_support) if (mask & BIT(3))
fprintf(outf, "Intel(R) SST-BF (feature base-freq) is supported\n"); fprintf(outf, "Intel(R) SST-BF (feature base-freq) is supported\n");
else else
fprintf(outf, "Intel(R) SST-BF (feature base-freq) is not supported\n"); fprintf(outf, "Intel(R) SST-BF (feature base-freq) is not supported\n");
ret = isst_read_pm_config(&id, &cp_state, &cp_cap); if (isst_read_pm_config(&id, &cp_state, &cp_cap)) {
if (ret) {
fprintf(outf, "Intel(R) SST-CP (feature core-power) status is unknown\n"); fprintf(outf, "Intel(R) SST-CP (feature core-power) status is unknown\n");
return; return;
} }
if (cp_cap) if (cp_cap)
fprintf(outf, "Intel(R) SST-CP (feature core-power) is supported\n"); fprintf(outf, "Intel(R) SST-CP (feature core-power) is supported\n");
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment