summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-11-09 09:38:14 -0800
committerGuenter Roeck <linux@roeck-us.net>2014-01-14 21:36:31 -0800
commit9fb6c9c73b11bef65ba80a362547fd116c1e1c9d (patch)
tree790f952ca7c7b5170f4233e419323d638f9569c4
parent347c16cfdecf9b4cfb94137b47bf6a05b3ff57d5 (diff)
downloadop-kernel-dev-9fb6c9c73b11bef65ba80a362547fd116c1e1c9d.zip
op-kernel-dev-9fb6c9c73b11bef65ba80a362547fd116c1e1c9d.tar.gz
hwmon: (coretemp) Refine TjMax detection
Intel's turbostat code uses only 7 bits from MSR_IA32_TEMPERATURE_TARGET to read TjMax, and also only accepts it if the reported temperature is at least 85 degrees C. Play safe and do the same. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/coretemp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 7eed10e..b2e59b3 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -368,12 +368,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
if (cpu_has_tjmax(c))
dev_warn(dev, "Unable to read TjMax from CPU %u\n", id);
} else {
- val = (eax >> 16) & 0xff;
+ val = (eax >> 16) & 0x7f;
/*
* If the TjMax is not plausible, an assumption
* will be used
*/
- if (val) {
+ if (val >= 85) {
dev_dbg(dev, "TjMax is %d degrees C\n", val);
return val * 1000;
}
OpenPOWER on IntegriCloud