Commit 3d904f06 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada

tools/power/x86/intel-speed-select: Check support status before enable

When turbo-freq or base-freq feature is not supported, the enable will
fail. So first check support status and print error.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
parent e78fded4
...@@ -1631,6 +1631,8 @@ static int set_pbf_core_power(int cpu) ...@@ -1631,6 +1631,8 @@ static int set_pbf_core_power(int cpu)
static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
void *arg4) void *arg4)
{ {
struct isst_pkg_ctdp_level_info ctdp_level;
struct isst_pkg_ctdp pkg_dev;
int ret; int ret;
int status = *(int *)arg4; int status = *(int *)arg4;
...@@ -1646,6 +1648,24 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, ...@@ -1646,6 +1648,24 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
goto disp_result; goto disp_result;
} }
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
if (ret) {
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
goto disp_result;
}
ret = isst_get_ctdp_control(cpu, pkg_dev.current_level, &ctdp_level);
if (ret) {
isst_display_error_info_message(1, "Failed to get current level", 0, 0);
goto disp_result;
}
if (!ctdp_level.pbf_support) {
isst_display_error_info_message(1, "base-freq feature is not present at this level", 1, pkg_dev.current_level);
ret = -1;
goto disp_result;
}
if (auto_mode && status) { if (auto_mode && status) {
ret = set_pbf_core_power(cpu); ret = set_pbf_core_power(cpu);
if (ret) if (ret)
...@@ -1772,9 +1792,29 @@ static void dump_fact_config(int arg) ...@@ -1772,9 +1792,29 @@ static void dump_fact_config(int arg)
static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
void *arg4) void *arg4)
{ {
struct isst_pkg_ctdp_level_info ctdp_level;
struct isst_pkg_ctdp pkg_dev;
int ret; int ret;
int status = *(int *)arg4; int status = *(int *)arg4;
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
if (ret) {
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
goto disp_results;
}
ret = isst_get_ctdp_control(cpu, pkg_dev.current_level, &ctdp_level);
if (ret) {
isst_display_error_info_message(1, "Failed to get current level", 0, 0);
goto disp_results;
}
if (!ctdp_level.fact_support) {
isst_display_error_info_message(1, "turbo-freq feature is not present at this level", 1, pkg_dev.current_level);
ret = -1;
goto disp_results;
}
if (auto_mode && status) { if (auto_mode && status) {
ret = isst_pm_qos_config(cpu, 1, 1); ret = isst_pm_qos_config(cpu, 1, 1);
if (ret) if (ret)
......
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