diff options
author | Yuxuan Shui <yshuiv7@gmail.com> | 2013-11-18 02:06:35 -0500 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2014-01-03 09:49:50 -0500 |
commit | 7734e3ac89b27caf87d43d264bbbc26240413227 (patch) | |
tree | 2893113507191526c2554ff557a5dd7157bd83d5 /drivers/thermal/intel_powerclamp.c | |
parent | a116776f7b6052599df0c67db29c30ea9d69d7ee (diff) |
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/intel_powerclamp.c')
-rw-r--r-- | drivers/thermal/intel_powerclamp.c | 11 |
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) | |||
206 | 206 | ||
207 | } | 207 | } |
208 | 208 | ||
209 | static bool has_pkg_state_counter(void) | ||
210 | { | ||
211 | u64 tmp; | ||
212 | return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) || | ||
213 | !rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) || | ||
214 | !rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) || | ||
215 | !rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp); | ||
216 | } | ||
217 | |||
209 | static u64 pkg_state_counter(void) | 218 | static u64 pkg_state_counter(void) |
210 | { | 219 | { |
211 | u64 val; | 220 | u64 val; |
@@ -500,7 +509,7 @@ static int start_power_clamp(void) | |||
500 | struct task_struct *thread; | 509 | struct task_struct *thread; |
501 | 510 | ||
502 | /* check if pkg cstate counter is completely 0, abort in this case */ | 511 | /* check if pkg cstate counter is completely 0, abort in this case */ |
503 | if (!pkg_state_counter()) { | 512 | if (!has_pkg_state_counter()) { |
504 | pr_err("pkg cstate counter not functional, abort\n"); | 513 | pr_err("pkg cstate counter not functional, abort\n"); |
505 | return -EINVAL; | 514 | return -EINVAL; |
506 | } | 515 | } |