tools/power/x86/intel-speed-select: Abstract get_clos_information
authorZhang Rui <rui.zhang@intel.com>
Mon, 8 Aug 2022 14:42:47 +0000 (22:42 +0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 22 Mar 2023 20:36:51 +0000 (13:36 -0700)
Allow platform specific implementation to get CLOS config setting.

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
tools/power/x86/intel-speed-select/isst.h

index 2ea7ef4..a96d6bc 100644 (file)
@@ -600,6 +600,30 @@ static int mbox_get_fact_info(struct isst_id *id, int level, int fact_bucket, st
        return 0;
 }
 
+static int mbox_get_clos_information(struct isst_id *id, int *enable, int *type)
+{
+       unsigned int resp;
+       int ret;
+
+       ret = isst_send_mbox_command(id->cpu, CONFIG_CLOS, CLOS_PM_QOS_CONFIG, 0, 0,
+                                    &resp);
+       if (ret)
+               return ret;
+
+       debug_printf("cpu:%d CLOS_PM_QOS_CONFIG resp:%x\n", id->cpu, resp);
+
+       if (resp & BIT(1))
+               *enable = 1;
+       else
+               *enable = 0;
+
+       if (resp & BIT(2))
+               *type = 1;
+       else
+               *type = 0;
+
+       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,
@@ -618,6 +642,7 @@ static struct isst_platform_ops mbox_ops = {
        .set_pbf_fact_status = mbox_set_pbf_fact_status,
        .get_fact_info = mbox_get_fact_info,
        .get_uncore_p0_p1_info = mbox_get_uncore_p0_p1_info,
+       .get_clos_information = mbox_get_clos_information,
 };
 
 struct isst_platform_ops *mbox_get_platform_ops(void)
index f4e3a91..33ee086 100644 (file)
@@ -635,27 +635,8 @@ int isst_get_process_ctdp(struct isst_id *id, int tdp_level, struct isst_pkg_ctd
 
 int isst_clos_get_clos_information(struct isst_id *id, int *enable, int *type)
 {
-       unsigned int resp;
-       int ret;
-
-       ret = isst_send_mbox_command(id->cpu, CONFIG_CLOS, CLOS_PM_QOS_CONFIG, 0, 0,
-                                    &resp);
-       if (ret)
-               return ret;
-
-       debug_printf("cpu:%d CLOS_PM_QOS_CONFIG resp:%x\n", id->cpu, resp);
-
-       if (resp & BIT(1))
-               *enable = 1;
-       else
-               *enable = 0;
-
-       if (resp & BIT(2))
-               *type = 1;
-       else
-               *type = 0;
-
-       return 0;
+       CHECK_CB(get_clos_information);
+       return isst_ops->get_clos_information(id, enable, type);
 }
 
 int isst_pm_qos_config(struct isst_id *id, int enable_clos, int priority_type)
index b17fcf7..d6cbc0b 100644 (file)
@@ -199,6 +199,7 @@ struct isst_platform_ops {
        int (*set_pbf_fact_status)(struct isst_id *id, int pbf, int enable);
        int (*get_fact_info)(struct isst_id *id, int level, int fact_bucket, struct isst_fact_info *fact_info);
        void (*get_uncore_p0_p1_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
+       int (*get_clos_information)(struct isst_id *id, int *enable, int *type);
 };
 
 extern int is_cpu_in_power_domain(int cpu, struct isst_id *id);