All of lore.kernel.org
 help / color / mirror / Atom feed
From: David E. Box <david.e.box at linux.intel.com>
To: powertop@lists.01.org
Subject: [Powertop] [PATCH V2] Fix Powertop support for Intel Braswell SOC
Date: Thu, 02 Apr 2015 21:24:29 -0700	[thread overview]
Message-ID: <1428035069-310-1-git-send-email-david.e.box@linux.intel.com> (raw)
In-Reply-To: 55034617.5040507@linux.intel.com

[-- Attachment #1: Type: text/plain, Size: 2263 bytes --]

Correct Braswell MSR used to determine PC6 residency.

Signed-off-by: David E. Box <david.e.box(a)linux.intel.com>
---

V2: Add missing whitespace between '=' in assignment statement

 src/cpu/intel_cpus.cpp | 21 +++++++++++++++++++--
 src/cpu/intel_cpus.h   |  1 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
index 72ecd50..02b420e 100644
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -289,6 +289,7 @@ nhm_package::nhm_package(int model)
 	has_c8c9c10_res = 0;
 	has_c2c6_res = 0;
 	has_c7_res = 0;
+	has_c6c_res = 0;
 
 	switch(model) {
 		case 0x2A:	/* SNB */
@@ -314,6 +315,9 @@ nhm_package::nhm_package(int model)
 		else
 			has_c7_res = 0;
 	}
+	/* BSW only exposes package C6 */
+	else if (model == 0x4C)
+		has_c6c_res = 1;
 	else
 		has_c3_res = 1;
 
@@ -360,7 +364,15 @@ void nhm_package::measurement_start(void)
 
 	if (this->has_c3_res)
 		c3_before    = get_msr(number, MSR_PKG_C3_RESIDENCY);
-	c6_before    = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
+	/*
+	 * Hack for Braswell where C7 MSR is actually BSW C6
+	 */
+	if (this->has_c6c_res)
+		c6_before    = get_msr(number, MSR_PKG_C7_RESIDENCY);
+	else
+		c6_before    = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
 	if (this->has_c7_res)
 		c7_before    = get_msr(number, MSR_PKG_C7_RESIDENCY);
 	if (this->has_c8c9c10_res) {
@@ -401,7 +413,12 @@ void nhm_package::measurement_end(void)
 
 	if (this->has_c3_res)
 		c3_after    = get_msr(number, MSR_PKG_C3_RESIDENCY);
-	c6_after    = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
+	if (this->has_c6c_res)
+		c6_after    = get_msr(number, MSR_PKG_C7_RESIDENCY);
+	else
+		c6_after    = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
 	if (this->has_c7_res)
 		c7_after    = get_msr(number, MSR_PKG_C7_RESIDENCY);
 	if (has_c8c9c10_res) {
diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
index 810a243..0331069 100644
--- a/src/cpu/intel_cpus.h
+++ b/src/cpu/intel_cpus.h
@@ -77,6 +77,7 @@ public:
 	int		has_c7_res;
 	int		has_c2c6_res;
 	int		has_c3_res;
+	int		has_c6c_res;		/* BSW */
 	int		has_c8c9c10_res;
 	nhm_package(int model);
 	virtual void	measurement_start(void);
-- 
1.9.1


                 reply	other threads:[~2015-04-03  4:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1428035069-310-1-git-send-email-david.e.box@linux.intel.com \
    --to=powertop@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.