tools/power/x86/intel-speed-select: Abstract get_tjmax_info
authorZhang Rui <rui.zhang@intel.com>
Mon, 8 Aug 2022 12:52:23 +0000 (20:52 +0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 22 Mar 2023 20:36:50 +0000 (13:36 -0700)
Allow platform specific implementation to get the Tjmax info for a
given SST-PP level.

No functional changes are expected.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[srinivas.pandruvada@linux.intel.com: changelog edits]
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
tools/power/x86/intel-speed-select/isst-core-mbox.c
tools/power/x86/intel-speed-select/isst-core.c

index 40c856f..2ae46aa 100644 (file)
@@ -122,6 +122,18 @@ static int mbox_get_tdp_info(struct isst_id *id, int config_index,
                "cpu:%d ctdp:%d CONFIG_TDP_GET_TDP_INFO resp:%x tdp_ratio:%d pkg_tdp:%d\n",
                id->cpu, config_index, resp, ctdp_level->tdp_ratio,
                ctdp_level->pkg_tdp);
+
+       ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_TJMAX_INFO,
+                                    0, config_index, &resp);
+       if (ret)
+               return ret;
+
+       ctdp_level->t_proc_hot = resp & GENMASK(7, 0);
+
+       debug_printf(
+               "cpu:%d ctdp:%d CONFIG_TDP_GET_TJMAX_INFO resp:%x t_proc_hot:%d\n",
+               id->cpu, config_index, resp, ctdp_level->t_proc_hot);
+
        return 0;
 }
 
@@ -147,7 +159,6 @@ static int mbox_get_pwr_info(struct isst_id *id, int config_index,
        return 0;
 }
 
-
 static struct isst_platform_ops mbox_ops = {
        .get_disp_freq_multiplier = mbox_get_disp_freq_multiplier,
        .get_trl_max_levels = mbox_get_trl_max_levels,
index 9b993b0..d93735f 100644 (file)
@@ -312,26 +312,6 @@ int isst_get_pwr_info(struct isst_id *id, int config_index,
        return isst_ops->get_pwr_info(id, config_index, ctdp_level);
 }
 
-int isst_get_tjmax_info(struct isst_id *id, int config_index,
-                       struct isst_pkg_ctdp_level_info *ctdp_level)
-{
-       unsigned int resp;
-       int ret;
-
-       ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_TJMAX_INFO,
-                                    0, config_index, &resp);
-       if (ret)
-               return ret;
-
-       ctdp_level->t_proc_hot = resp & GENMASK(7, 0);
-
-       debug_printf(
-               "cpu:%d ctdp:%d CONFIG_TDP_GET_TJMAX_INFO resp:%x t_proc_hot:%d\n",
-               id->cpu, config_index, resp, ctdp_level->t_proc_hot);
-
-       return 0;
-}
-
 int isst_get_coremask_info(struct isst_id *id, int config_index,
                           struct isst_pkg_ctdp_level_info *ctdp_level)
 {
@@ -1001,10 +981,6 @@ int isst_get_process_ctdp(struct isst_id *id, int tdp_level, struct isst_pkg_ctd
                if (ret)
                        return ret;
 
-               ret = isst_get_tjmax_info(id, i, ctdp_level);
-               if (ret)
-                       return ret;
-
                ctdp_level->core_cpumask_size =
                        alloc_cpu_set(&ctdp_level->core_cpumask);
                ret = isst_get_coremask_info(id, i, ctdp_level);