aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-09-16 15:24:02 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-09-21 20:25:18 -0400
commita45a8c8571c0be6a6bd72ae5a14255c26b14b504 (patch)
tree47593c6b73c9a68dce03b57e7a387f94f441b8bb
parent6bf9e9b09c3abb5447bbbf16c2d0cbe721e44f3f (diff)
hwmon: (coretemp) Let the user force TjMax
On old CPUs (and even some recent Atom CPUs) TjMax can't be read from the CPU registers, so it is guessed by the driver using a complex heuristic which isn't reliable. So let users who know their CPU's TjMax pass it as a module parameter. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "R, Durgadoss" <durgadoss.r@intel.com> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Alexander Stein <alexander.stein@systec-electronic.com> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
-rw-r--r--Documentation/hwmon/coretemp7
-rw-r--r--drivers/hwmon/coretemp.c15
2 files changed, 19 insertions, 3 deletions
diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index fa8776ab9b18..49c0d42dde86 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -49,9 +49,10 @@ tempX_label - Contains string "Core X", where X is processor
49 number. For Package temp, this will be "Physical id Y", 49 number. For Package temp, this will be "Physical id Y",
50 where Y is the package number. 50 where Y is the package number.
51 51
52The TjMax temperature is set to 85 degrees C if undocumented model specific 52On CPU models which support it, TjMax is read from a model-specific register.
53register (UMSR) 0xee has bit 30 set. If not the TjMax is 100 degrees C as 53On other models, it is set to an arbitrary value based on weak heuristics.
54(sometimes) documented in processor datasheet. 54If these heuristics don't work for you, you can pass the correct TjMax value
55as a module parameter (tjmax).
55 56
56Appendix A. Known TjMax lists (TBD): 57Appendix A. Known TjMax lists (TBD):
57Some information comes from ark.intel.com 58Some information comes from ark.intel.com
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 256f70803eb3..5a41e9dda909 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -36,11 +36,20 @@
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/smp.h> 38#include <linux/smp.h>
39#include <linux/moduleparam.h>
39#include <asm/msr.h> 40#include <asm/msr.h>
40#include <asm/processor.h> 41#include <asm/processor.h>
41 42
42#define DRVNAME "coretemp" 43#define DRVNAME "coretemp"
43 44
45/*
46 * force_tjmax only matters when TjMax can't be read from the CPU itself.
47 * When set, it replaces the driver's suboptimal heuristic.
48 */
49static int force_tjmax;
50module_param_named(tjmax, force_tjmax, int, 0444);
51MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
52
44#define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ 53#define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */
45#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ 54#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */
46#define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ 55#define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */
@@ -398,6 +407,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
398 } 407 }
399 } 408 }
400 409
410 if (force_tjmax) {
411 dev_notice(dev, "TjMax forced to %d degrees C by user\n",
412 force_tjmax);
413 return force_tjmax * 1000;
414 }
415
401 /* 416 /*
402 * An assumption is made for early CPUs and unreadable MSR. 417 * An assumption is made for early CPUs and unreadable MSR.
403 * NOTE: the calculated value may not be correct. 418 * NOTE: the calculated value may not be correct.