linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	srinivas.pandruvada@linux.intel.com,
	Prarit Bhargava <prarit@redhat.com>
Subject: [PATCH v2 7/7] intel-speed-select: Implement base-freq commands on CascadeLake-N
Date: Thu,  3 Oct 2019 08:11:12 -0400	[thread overview]
Message-ID: <20191003121112.25870-8-prarit@redhat.com> (raw)
In-Reply-To: <20191003121112.25870-1-prarit@redhat.com>

Add functionality for base-freq info|enable|disable info on CascadeLake-N.

The enable command always returns success, and the disable command always
returns failed because SST-BF cannot be enabled or disabled from the OS on
CascadeLake-N.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 .../x86/intel-speed-select/isst-config.c      | 68 +++++++++++++------
 1 file changed, 48 insertions(+), 20 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index d9b580139a07..7c7f0551eda1 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -836,7 +836,7 @@ static void clx_n_config(void)
 	ctdp_level->fact_enabled = 0;
 }
 
-static void dump_cn_config_for_cpu(int cpu, void *arg1, void *arg2,
+static void dump_clx_n_config_for_cpu(int cpu, void *arg1, void *arg2,
 				   void *arg3, void *arg4)
 {
 	isst_ctdp_display_information(cpu, outf, tdp_level, &clx_n_pkg_dev);
@@ -876,7 +876,7 @@ static void dump_isst_config(int arg)
 	if (!is_clx_n_platform())
 		fn = dump_isst_config_for_cpu;
 	else
-		fn = dump_cn_config_for_cpu;
+		fn = dump_clx_n_config_for_cpu;
 
 	isst_ctdp_display_information_start(outf);
 
@@ -951,6 +951,18 @@ static void set_tdp_level(int arg)
 	isst_ctdp_display_information_end(outf);
 }
 
+static void clx_n_dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2,
+				       void *arg3, void *arg4)
+{
+	struct isst_pbf_info *pbf_info;
+	struct isst_pkg_ctdp_level_info *ctdp_level;
+
+	ctdp_level = &clx_n_pkg_dev.ctdp_level[0];
+	pbf_info = &ctdp_level->pbf_info;
+
+	isst_pbf_display_information(cpu, outf, tdp_level, pbf_info);
+}
+
 static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
 				    void *arg4)
 {
@@ -968,6 +980,8 @@ static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
 
 static void dump_pbf_config(int arg)
 {
+	void *fn;
+
 	if (cmd_help) {
 		fprintf(stderr,
 			"Print Intel(R) Speed Select Technology base frequency configuration for a TDP level\n");
@@ -981,13 +995,18 @@ static void dump_pbf_config(int arg)
 		exit(1);
 	}
 
+	if (!is_clx_n_platform())
+		fn = dump_pbf_config_for_cpu;
+	else
+		fn = clx_n_dump_pbf_config_for_cpu;
+
 	isst_ctdp_display_information_start(outf);
+
 	if (max_target_cpus)
-		for_each_online_target_cpu_in_set(dump_pbf_config_for_cpu, NULL,
-						  NULL, NULL, NULL);
+		for_each_online_target_cpu_in_set(fn, NULL, NULL, NULL, NULL);
 	else
-		for_each_online_package_in_set(dump_pbf_config_for_cpu, NULL,
-					       NULL, NULL, NULL);
+		for_each_online_package_in_set(fn, NULL, NULL, NULL, NULL);
+
 	isst_ctdp_display_information_end(outf);
 }
 
@@ -1165,21 +1184,27 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
 	int ret;
 	int status = *(int *)arg4;
 
-	ret = isst_set_pbf_fact_status(cpu, 1, status);
-	if (ret) {
-		perror("isst_set_pbf");
-	} else {
-		if (status) {
-			if (auto_mode)
-				ret = set_pbf_core_power(cpu);
-			isst_display_result(cpu, outf, "base-freq", "enable",
-					    ret);
-		} else {
-			if (auto_mode)
-				isst_pm_qos_config(cpu, 0, 0);
-			isst_display_result(cpu, outf, "base-freq", "disable",
-					    ret);
+	if (!is_clx_n_platform()) {
+		ret = isst_set_pbf_fact_status(cpu, 1, status);
+		if (ret) {
+			perror("isst_set_pbf");
+			return;
 		}
+	} else {
+		if (status == 0)
+			ret = -1;
+		else
+			ret = 0;
+	}
+
+	if (status) {
+		if (auto_mode)
+			ret = set_pbf_core_power(cpu);
+		isst_display_result(cpu, outf, "base-freq", "enable", ret);
+	} else {
+		if (auto_mode)
+			isst_pm_qos_config(cpu, 0, 0);
+		isst_display_result(cpu, outf, "base-freq", "disable", ret);
 	}
 }
 
@@ -1645,6 +1670,9 @@ static void get_clos_assoc(int arg)
 
 static struct process_cmd_struct clx_n_cmds[] = {
 	{ "perf-profile", "info", dump_isst_config, 0 },
+	{ "base-freq", "info", dump_pbf_config, 0 },
+	{ "base-freq", "enable", set_pbf_enable, 1 },
+	{ "base-freq", "disable", set_pbf_enable, 0 },
 	{ NULL, NULL, NULL, 0 }
 };
 
-- 
2.18.1


      parent reply	other threads:[~2019-10-03 12:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 12:11 [PATCH v2 0/7] Add CascadeLake-N Support Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 1/7] intel-speed-select: Add int argument to command functions Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 2/7] intel-speed-select: Make process_command generic Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 3/7] intel-speed-select: Add check for CascadeLake-N models Prarit Bhargava
2019-10-04 17:15   ` Srinivas Pandruvada
2019-10-04 17:18     ` Prarit Bhargava
2019-10-07 10:03     ` Andy Shevchenko
2019-10-07 19:18       ` Srinivas Pandruvada
2019-10-03 12:11 ` [PATCH v2 4/7] intel-speed-select: Add configuration for CascadeLake-N Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 5/7] intel-speed-select: Implement CascadeLake-N help and command functions structures Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 6/7] intel-speed-select: Implement 'perf-profile info' on CascadeLake-N Prarit Bhargava
2019-10-04 17:23   ` Srinivas Pandruvada
2019-10-04 17:32     ` Srinivas Pandruvada
2019-10-04 20:14   ` Srinivas Pandruvada
2019-10-03 12:11 ` Prarit Bhargava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191003121112.25870-8-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).