Commit 39bae0fc authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Andy Shevchenko

tools/power/x86/intel-speed-select: Improve error display for base-freq feature

This change adds improved error display and handling for commands related
to base-freq feature. The changes include:
- Replace perror/fprintf with helpful error message
- Error for not specifying TDP level when required
- For CLX show help which shows limitation
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 3d1a8579
...@@ -1276,7 +1276,7 @@ static void clx_n_dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, ...@@ -1276,7 +1276,7 @@ static void clx_n_dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2,
ret = clx_n_config(cpu); ret = clx_n_config(cpu);
if (ret) { if (ret) {
perror("isst_get_process_ctdp"); isst_display_error_info_message(1, "clx_n_config failed", 0, 0);
} else { } else {
struct isst_pkg_ctdp_level_info *ctdp_level; struct isst_pkg_ctdp_level_info *ctdp_level;
struct isst_pbf_info *pbf_info; struct isst_pbf_info *pbf_info;
...@@ -1297,7 +1297,9 @@ static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, ...@@ -1297,7 +1297,9 @@ static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
ret = isst_get_pbf_info(cpu, tdp_level, &pbf_info); ret = isst_get_pbf_info(cpu, tdp_level, &pbf_info);
if (ret) { if (ret) {
perror("isst_get_pbf_info"); isst_display_error_info_message(1, "Failed to get base-freq info at this level", 1, tdp_level);
isst_ctdp_display_information_end(outf);
exit(1);
} else { } else {
isst_pbf_display_information(cpu, outf, tdp_level, &pbf_info); isst_pbf_display_information(cpu, outf, tdp_level, &pbf_info);
isst_get_pbf_info_complete(&pbf_info); isst_get_pbf_info_complete(&pbf_info);
...@@ -1317,7 +1319,7 @@ static void dump_pbf_config(int arg) ...@@ -1317,7 +1319,7 @@ static void dump_pbf_config(int arg)
} }
if (tdp_level == 0xff) { if (tdp_level == 0xff) {
fprintf(outf, "Invalid command: specify tdp_level\n"); isst_display_error_info_message(1, "Invalid command: specify tdp_level", 0, 0);
exit(1); exit(1);
} }
...@@ -1635,7 +1637,7 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, ...@@ -1635,7 +1637,7 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
ret = isst_set_pbf_fact_status(cpu, 1, status); ret = isst_set_pbf_fact_status(cpu, 1, status);
if (ret) { if (ret) {
perror("isst_set_pbf"); debug_printf("isst_set_pbf_fact_status failed");
if (auto_mode) if (auto_mode)
isst_pm_qos_config(cpu, 0, 0); isst_pm_qos_config(cpu, 0, 0);
} else { } else {
...@@ -1667,10 +1669,25 @@ static void set_pbf_enable(int arg) ...@@ -1667,10 +1669,25 @@ static void set_pbf_enable(int arg)
if (enable) { if (enable) {
fprintf(stderr, fprintf(stderr,
"Enable Intel Speed Select Technology base frequency feature\n"); "Enable Intel Speed Select Technology base frequency feature\n");
if (is_clx_n_platform()) {
fprintf(stderr,
"\tOn this platform this command doesn't enable feature in the hardware.\n");
fprintf(stderr,
"\tIt updates the cpufreq scaling_min_freq to match cpufreq base_frequency.\n");
exit(0);
}
fprintf(stderr, fprintf(stderr,
"\tOptional Arguments: -a|--auto : Use priority of cores to set core-power associations\n"); "\tOptional Arguments: -a|--auto : Use priority of cores to set core-power associations\n");
} else { } else {
if (is_clx_n_platform()) {
fprintf(stderr,
"\tOn this platform this command doesn't disable feature in the hardware.\n");
fprintf(stderr,
"\tIt updates the cpufreq scaling_min_freq to match cpuinfo_min_freq\n");
exit(0);
}
fprintf(stderr, fprintf(stderr,
"Disable Intel Speed Select Technology base frequency feature\n"); "Disable Intel Speed Select Technology base frequency feature\n");
fprintf(stderr, fprintf(stderr,
......
...@@ -395,15 +395,27 @@ int isst_set_tdp_level(int cpu, int tdp_level) ...@@ -395,15 +395,27 @@ int isst_set_tdp_level(int cpu, int tdp_level)
int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info) int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
{ {
struct isst_pkg_ctdp_level_info ctdp_level; struct isst_pkg_ctdp_level_info ctdp_level;
struct isst_pkg_ctdp pkg_dev;
int i, ret, core_cnt, max; int i, ret, core_cnt, max;
unsigned int req, resp; unsigned int req, resp;
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
if (ret) {
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
return ret;
}
if (level > pkg_dev.levels) {
isst_display_error_info_message(1, "Invalid level", 1, level);
return -1;
}
ret = isst_get_ctdp_control(cpu, level, &ctdp_level); ret = isst_get_ctdp_control(cpu, level, &ctdp_level);
if (ret) if (ret)
return ret; return ret;
if (!ctdp_level.pbf_support) { if (!ctdp_level.pbf_support) {
fprintf(stderr, "base-freq feature is not present at this level:%d\n", level); isst_display_error_info_message(1, "base-freq feature is not present at this level", 1, level);
return -1; return -1;
} }
......
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