Commit a07bdb81 authored by Zhang Rui's avatar Zhang Rui Committed by Srinivas Pandruvada
Browse files

tools/power/x86/intel-speed-select: Abstract get_clos_information



Allow platform specific implementation to get CLOS config setting.

No functional changes are expected.

Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
[srinivas.pandruvada@linux.intel.com: changelog edits]
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
parent 4a17b291
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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)
+2 −21
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
@@ -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);