Skip to content

Commit 3d904f0

Browse files
committed
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: Srinivas Pandruvada <[email protected]>
1 parent e78fded commit 3d904f0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,8 @@ static int set_pbf_core_power(int cpu)
16311631
static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
16321632
void *arg4)
16331633
{
1634+
struct isst_pkg_ctdp_level_info ctdp_level;
1635+
struct isst_pkg_ctdp pkg_dev;
16341636
int ret;
16351637
int status = *(int *)arg4;
16361638

@@ -1646,6 +1648,24 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
16461648
goto disp_result;
16471649
}
16481650

1651+
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
1652+
if (ret) {
1653+
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
1654+
goto disp_result;
1655+
}
1656+
1657+
ret = isst_get_ctdp_control(cpu, pkg_dev.current_level, &ctdp_level);
1658+
if (ret) {
1659+
isst_display_error_info_message(1, "Failed to get current level", 0, 0);
1660+
goto disp_result;
1661+
}
1662+
1663+
if (!ctdp_level.pbf_support) {
1664+
isst_display_error_info_message(1, "base-freq feature is not present at this level", 1, pkg_dev.current_level);
1665+
ret = -1;
1666+
goto disp_result;
1667+
}
1668+
16491669
if (auto_mode && status) {
16501670
ret = set_pbf_core_power(cpu);
16511671
if (ret)
@@ -1772,9 +1792,29 @@ static void dump_fact_config(int arg)
17721792
static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
17731793
void *arg4)
17741794
{
1795+
struct isst_pkg_ctdp_level_info ctdp_level;
1796+
struct isst_pkg_ctdp pkg_dev;
17751797
int ret;
17761798
int status = *(int *)arg4;
17771799

1800+
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
1801+
if (ret) {
1802+
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
1803+
goto disp_results;
1804+
}
1805+
1806+
ret = isst_get_ctdp_control(cpu, pkg_dev.current_level, &ctdp_level);
1807+
if (ret) {
1808+
isst_display_error_info_message(1, "Failed to get current level", 0, 0);
1809+
goto disp_results;
1810+
}
1811+
1812+
if (!ctdp_level.fact_support) {
1813+
isst_display_error_info_message(1, "turbo-freq feature is not present at this level", 1, pkg_dev.current_level);
1814+
ret = -1;
1815+
goto disp_results;
1816+
}
1817+
17781818
if (auto_mode && status) {
17791819
ret = isst_pm_qos_config(cpu, 1, 1);
17801820
if (ret)

0 commit comments

Comments
 (0)