CPU core ID is used to index the core_data[] array. The core ID is, however, not
sequential; 10-core CPUS can have a core ID as high as 25. Increase the limit to
32 to be able to deal with current CPUs.
Signed-off-by: Guenter Roeck <[email protected]>
Cc: [email protected] # 3.0+
Acked-by: Jean Delvare <[email protected]>
Acked-by: Durgadoss R <[email protected]>
Pull hwmon changes for v3.4 from Guenter Roeck:
"Mostly cleanup. No new drivers this time around, but support for
several chips added to existing drivers: TPS40400, TPS40422, MTD040,
MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support
for SCH56xx, and additional attributes for a couple of drivers."
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits)
hwmon: (sch56xx) Add support for the integrated watchdog (v2)
hwmon: (w83627ehf) Add support for temperature offset registers
hwmon: (jc42) Remove unnecessary device IDs
hwmon: (zl6100) Add support for ZL9101M and ZL9117M
hwmon: (adm1275) Add support for ADM1075
hwmon: (max34440) Add support for MAX34446
hwmon: (pmbus) Add more virtual registers
hwmon: (pmbus) Add support for Lineage Power MDT040
hwmon: (pmbus) Add support for TI TPS40400 and TPS40422
hwmon: (max34440) Add support for 'lowest' output voltage attribute
hwmon: (jc42) Convert to use devm_kzalloc
hwmon: (max16065) Convert to use devm_kzalloc
hwmon: (smm665) Convert to use devm_kzalloc
hwmon: (ltc4261) Convert to use devm_kzalloc
hwmon: (pmbus) Simplify remove functions
hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc
hwmon: (lineage-pem) Convert to use devm_kzalloc
hwmon: (hwmon-vid) Fix checkpatch issues
hwmon: (hwmon-vid) Add new entries to VRM model table
hwmon: (lm80) Add detection of NatSemi/TI LM96080
...
Many functions in the coretemp driver lack a proper section
annotation. Add them to let the kernel free the memory after
initialization when possible.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Durgadoss R <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Several fields in struct cpuinfo_x86 were not defined for the
!SMP case, likely to save space. However, those fields still
have some meaning for UP, and keeping them allows some #ifdef
removal from other files. The additional size of the UP kernel
from this change is not significant enough to worry about
keeping up the distinction:
text data bss dec hex filename
4737168 506459 972040 6215667 5ed7f3 vmlinux.o.before
4737444 506459 972040 6215943 5ed907 vmlinux.o.after
for a difference of 276 bytes for an example UP config.
If someone wants those 276 bytes back badly then it should
be implemented in a cleaner way.
Signed-off-by: Kevin Winchester <[email protected]>
Cc: Steffen Persvold <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP
definition resolves to the correct value, just use this for both
cases.
Without this fix the temperature attributes are named temp0_* instead
of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.
Signed-off-by: Jean Delvare <[email protected]>
Tested-by: Phil Sutter <[email protected]>
Cc: [email protected]
Acked-by: Durgadoss R <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Storing the struct temp_data pointer allocated from create_core_data()
when returning an error has the potential of leaving around a pointer
to freed memory. Reset it to NULL for error returns.
Reported-by: Jan Beulich <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Acked-by: Jean Delvare <[email protected]>
With recent change "hwmon: (coretemp) don't use kernel assigned CPU
number as platform device ID", the microcode check is now running on
random CPU. Fix that by checking the microcode before creating the
platform device rather than at probe time.
Also avoid calling TO_PHYS_ID(cpu) twice in the same function, it's
expensive.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Guenter Roeck <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
The only caller of the function obtained the pointer solely for the
purpose of passing it to this function, while it can be easily
determined from the struct platform_device * parameter also passed.
Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
These arrays won't ever be written to, so protect them from
unintentional modification.
Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
... as that has the potential to conflict with (particularly soft) CPU
hot removal and re-adding.
Signed-off-by: Jan Beulich <[email protected]>
[[email protected]: use platform device ID as physical CPU id]
Signed-off-by: Guenter Roeck <[email protected]>
With commit c814a4c7c4, the meaning of tempX_max
was changed. It no longer returns the value of bits 8:15 of
MSR_IA32_TEMPERATURE_TARGET, but instead returns the value of CPU threshold
register T1. tempX_max_hyst was added to reflect the value of temperature
threshold register T0.
As it turns out, T0 and T1 are used on some systems, presumably by the BIOS.
Also, T0 and T1 don't have a well defined meaning. The thresholds may be used
as upper or lower limits, and it is not guaranteed that T0 <= T1. Thus, the new
attribute mapping does not reflect the actual usage of the threshold registers.
Also, register contents are changed during runtime by an entity other than the
hwmon driver, meaning the values cached by the driver do not reflect actual
register contents.
Revert most of c814a4c7c4 to address the problem.
Support for T0 and T1 will be added back in with a separate commit, using new
attribute names.
Signed-off-by: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Durgadoss R <[email protected]>
Acked-by: Jean Delvare <[email protected]>
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 <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: "R, Durgadoss" <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Alexander Stein <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Function get_pkg_tjmax is a simplified copy of get_tjmax. Drop it and
always use get_tjmax, result is the same and this avoids code
duplication.
Also make get_tjmax less verbose: don't warn about MSR read failure
when failure was expected, and don't report TjMax in the logs unless
debugging is enabled.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Durgadoss R <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
ttarget is initialized when the driver is loaded, but tmin is not.
As a result, tempX_max_hyst attributes read 0. Fix this.
Also use THERM_*_THRESHOLD* constants in these initializations instead
of hard-coding the constants.
Signed-off-by: Jean Delvare <[email protected]>
Cc: "R, Durgadoss" <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
This patch adds the core and pkg support to coretemp.
These thresholds can be configured via the sysfs interfaces tempX_max
and tempX_max_hyst. An interrupt is generated when CPU temperature reaches
or crosses above tempX_max OR drops below tempX_max_hyst.
This patch is based on the documentation in IA Manual vol 3A, that can be
downloaded from here:
http://download.intel.com/design/processor/manuals/253668.pdf
Signed-off-by: Durgadoss R <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Further relax temperature range checks after reading the IA32_TEMPERATURE_TARGET
register. If the register returns a value other than 0 in bits 16..32, assume
that the returned value is correct.
This change applies to both packet and core temperature limits.
Cc: Carsten Emde <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
The current temperature range check of MSR_IA32_TEMPERATURE_TARGET
seems too strict to me, some TjMax values documented in
Documentation/hwmon/coretemp wouldn't pass. Relax the check so that
all the documented values pass.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Carsten Emde <[email protected]>
Cc: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
The coretemp driver provides a single set of device attributes for each
physical core of a HT CPU to avoid duplicate sensors. This
functionality was introduced with commit d883b9f097 ("hwmon:
(coretemp) Skip duplicate CPU entries").
Commit e40cc4bdfd ("x86/hwmon: register alternate sibling upon CPU
removal") extends this functionality to register the HT sibling of a CPU
which is taken offline, to ensure that sensor attributes are provided if
at least one HT sibling of a core is online.
Add comments into the code describing the functionality in some more
detail.
Signed-off-by: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Durgadoss R <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
cpu_sibling_mask() is not defined unless CONFIG_SMP is defined, so it
must not be used directly in the code without ifdef protection.
To solve the problem and avoid ifdefs in the code, define
for_each_sibling() and use it instead.
Signed-off-by: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Durgadoss R <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This patch merges the pkgtemp with coretemp driver.
The sysfs interfaces for all cores in the same pkg
are shown under one directory, in hwmon. It also
supports CONFIG_HOTPLUG_CPU. So, the sysfs interfaces
are created when each core comes online and are
removed when it goes offline.
Signed-off-by: Durgadoss R <[email protected]>
Cc: Fenghua Yu <[email protected]>
[[email protected]: Fixed section reference errors]
Signed-off-by: Guenter Roeck <[email protected]>
According to the documentation, simply reading the respective MSR
isn't sufficient: It should be written with zeros, cpuid(1) be
executed, and then read (see arch/x86/kernel/cpu/intel.c for an
example).
v2: Fail probe when microcode revision cannot be determined, but is
needed to check for proper operation.
Signed-off-by: Jan Beulich <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Chen Gong <[email protected]>
Cc: Jean Delvare <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
CONFIG_HOTPLUG_CPU is used too much in some drivers.
This patch clean them up.
Signed-off-by: Chen Gong <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
These likely originate from these drivers being clones of one another
and/or other drivers which actually needed these includes.
Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
"break" after "return" is at best bogus (good compilers even warn about
the "break" being unreachable).
Signed-off-by: Jan Beulich <[email protected]>
Cc: Rudolf Marek <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
... as they're being called only from a __cpuinit function.
Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Commit e40cc4bdfd introduced
a build breakage if CONFIG_SMP is undefined. This commit
fixes the problem.
This fix is only a workaround. For a real fix, cpu_sibling_mask() should
be defined in UP include code, eg in linux/smp.h, and asm/smp.h should not be
included directly. This fix is currently not possible because asm/smp.h defines
cpu_sibling_mask() unconditionally and is included directly from many source
files.
Reported-by: Ingo Molnar <[email protected]>
Tested-by: Ingo Molnar <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Just like pkgtemp registers another core of the same package when one
gets removed, coretemp should register another hyperthread (if
available) in that situation.
As pointed out in the patch fixing the respective code in pkgtemp, the
list protectng mutex must be dropped before calling
coretemp_device_add(), and due to the restructured loop (including an
explicit return) the "safe" variant of the list iterator isn't needed
anymore.
Signed-off-by: Jan Beulich <[email protected]>
Cc: Rudolf Marek <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Using cpuid_eax() to determine feature availability on other than
the current CPU is invalid. And feature availability should also be
checked in the hotplug code path.
Signed-off-by: Jan Beulich <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Fenghua Yu <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
In commit 0dca94baea the call to
platform_driver_unregister() was made conditional upon !HOTPLUG_CPU,
but the return value from coretemp_init() was left to indicate an
error. This isn't correct, as the negative return value indicates to
the module loader that initialization failed, which isn't intended
here and results in dangling pointers.
Signed-off-by: Jan Beulich <[email protected]>
Cc: Chen Gong <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Fix the following build warning:
CC [M] drivers/hwmon/coretemp.o
drivers/hwmon/coretemp.c: In function "coretemp_init":
drivers/hwmon/coretemp.c:521: warning: unused variable "n"
drivers/hwmon/coretemp.c:521: warning: unused variable "p"
Introduced by commit 851b29cb3b. When
you drop code, you also have to drop the variables this code was
using.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Chen Gong <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Huaxu Wan <[email protected]>
Fix two errors in hotplug. One is for hotplug notifier. The other is
unnecessary driver unregister. Because even none of online cpus supports
coretemp, we can't assume new onlined cpu doesn't support it either. If
related driver is unregistered there we have no chance to use coretemp
from then on.
Signed-off-by: Chen Gong <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Huaxu Wan <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Don't assume that CPU entry number and core ID always match. It
worked in the simple cases (single CPU, no HT) but fails on
multi-CPU systems.
Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Huaxu Wan <[email protected]>
Cc: [email protected]
On hyper-threaded CPUs, each core appears twice in the CPU list. Skip
the second entry to avoid duplicate sensors.
Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Huaxu Wan <[email protected]>
Cc: [email protected]
Add missing newline to dev_warn() message string. This is more of an issue
with older kernels that don't automatically add a newline if it was missing
from the end of the previous line.
Signed-off-by: Dean Nelson <[email protected]>
Cc: [email protected]
Signed-off-by: Jean Delvare <[email protected]>