summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorYuxuan Shui <yshuiv7@gmail.com>2013-11-18 08:06:35 +0100
committerZhang Rui <rui.zhang@intel.com>2014-01-03 15:49:50 +0100
commit7734e3ac89b27caf87d43d264bbbc26240413227 (patch)
tree2893113507191526c2554ff557a5dd7157bd83d5 /drivers/thermal
parentThermal cpu cooling: return error if no valid cpu frequency entry (diff)
downloadlinux-7734e3ac89b27caf87d43d264bbbc26240413227.tar.xz
linux-7734e3ac89b27caf87d43d264bbbc26240413227.zip
intel_powerclamp: Fix cstate counter detection.
Having all zero cstate count doesn't necesserily mean the cstate counter is no functional. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/intel_powerclamp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
index 8f181b3f842b..67b608ef2cb2 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -206,6 +206,15 @@ static void find_target_mwait(void)
}
+static bool has_pkg_state_counter(void)
+{
+ u64 tmp;
+ return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) ||
+ !rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) ||
+ !rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) ||
+ !rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp);
+}
+
static u64 pkg_state_counter(void)
{
u64 val;
@@ -500,7 +509,7 @@ static int start_power_clamp(void)
struct task_struct *thread;
/* check if pkg cstate counter is completely 0, abort in this case */
- if (!pkg_state_counter()) {
+ if (!has_pkg_state_counter()) {
pr_err("pkg cstate counter not functional, abort\n");
return -EINVAL;
}