aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/coretemp.c
Commit message (Collapse)AuthorAgeFilesLines
* x86: Simplify code by removing a !SMP #ifdefs from 'struct cpuinfo_x86'Kevin Winchester2012-08-151-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 141168c36cdee3ff23d9c7700b0edc47cb65479f and commit 3f806e50981825fa56a7f1938f24c0680816be45 upstream. 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 <kjwinchester@gmail.com> Cc: Steffen Persvold <sp@numascale.com> Link: http://lkml.kernel.org/r/1324428742-12498-1-git-send-email-kjwinchester@gmail.com Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERMH. Peter Anvin2012-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | commit 4ad33411308596f2f918603509729922a1ec4411 upstream. It makes sense to label "Digital Thermal Sensor" as "DTS", but unfortunately the string "dts" was already used for "Debug Store", and /proc/cpuinfo is a user space ABI. Therefore, rename this to "dtherm". This conflict went into mainline via the hwmon tree without any x86 maintainer ack, and without any kind of hint in the subject. a4659053 x86/hwmon: fix initialization of coretemp Reported-by: Jean Delvare <khali@linux-fr.org> Link: http://lkml.kernel.org/r/4FE34BCB.5050305@linux.intel.com Cc: Jan Beulich <JBeulich@suse.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> [bwh: Backported to 3.2: drop the coretemp device table change] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* hwmon: (coretemp) fix oops on cpu unplugKirill A. Shutemov2012-05-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit b704871124b477807966f06789c2b32f2de58bf7 upstream. coretemp tries to access core_data array beyond bounds on cpu unplug if core id of the cpu if more than NUM_REAL_CORES-1. BUG: unable to handle kernel NULL pointer dereference at 000000000000013c IP: [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] PGD 673e5a067 PUD 66e9b3067 PMD 0 Oops: 0000 [#1] SMP CPU 79 Modules linked in: sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter nf_conntrack_ipv4 nf_defrag_ipv4 ip6_tables xt_state nf_conntrack coretemp crc32c_intel asix tpm_tis pcspkr usbnet iTCO_wdt i2c_i801 microcode mii joydev tpm i2c_core iTCO_vendor_support tpm_bios i7core_edac igb ioatdma edac_core dca megaraid_sas [last unloaded: oprofile] Pid: 3315, comm: set-cpus Tainted: G W 3.4.0-rc5+ #2 QCI QSSC-S4R/QSSC-S4R RIP: 0010:[<ffffffffa00159af>] [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] RSP: 0018:ffff880472fb3d48 EFLAGS: 00010246 RAX: 0000000000000124 RBX: 0000000000000034 RCX: 00000000ffffffff RDX: 0000000000000000 RSI: 0000000000000046 RDI: 0000000000000246 RBP: ffff880472fb3d88 R08: ffff88077fcd36c0 R09: 0000000000000001 R10: ffffffff8184bc48 R11: 0000000000000000 R12: ffff880273095800 R13: 0000000000000013 R14: ffff8802730a1810 R15: 0000000000000000 FS: 00007f694a20f720(0000) GS:ffff88077fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 000000000000013c CR3: 000000067209b000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process set-cpus (pid: 3315, threadinfo ffff880472fb2000, task ffff880471fa0000) Stack: ffff880277b4c308 0000000000000003 ffff880472fb3d88 0000000000000005 0000000000000034 00000000ffffffd1 ffffffff81cadc70 ffff880472fb3e14 ffff880472fb3dc8 ffffffff8161f48d ffff880471fa0000 0000000000000034 Call Trace: [<ffffffff8161f48d>] notifier_call_chain+0x4d/0x70 [<ffffffff8107f1be>] __raw_notifier_call_chain+0xe/0x10 [<ffffffff81059d30>] __cpu_notify+0x20/0x40 [<ffffffff815fa251>] _cpu_down+0x81/0x270 [<ffffffff815fa477>] cpu_down+0x37/0x50 [<ffffffff815fd6a3>] store_online+0x63/0xc0 [<ffffffff813c7078>] dev_attr_store+0x18/0x30 [<ffffffff811f02cf>] sysfs_write_file+0xef/0x170 [<ffffffff81180443>] vfs_write+0xb3/0x180 [<ffffffff8118076a>] sys_write+0x4a/0x90 [<ffffffff816236a9>] system_call_fastpath+0x16/0x1b Code: 48 c7 c7 94 60 01 a0 44 0f b7 ac 10 ac 00 00 00 31 c0 e8 41 b7 5f e1 41 83 c5 02 49 63 c5 49 8b 44 c4 10 48 85 c0 74 56 45 31 ff <39> 58 18 75 4e eb 1f 49 63 d7 4c 89 f7 48 89 45 c8 48 6b d2 28 RIP [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] RSP <ffff880472fb3d48> CR2: 000000000000013c Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* hwmon: (coretemp) Increase CPU core limitGuenter Roeck2012-05-071-1/+1
| | | | | | | | | | | | | | commit bdc71c9a87b898e4c380c23b2e3e18071312ecde upstream. 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 <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org> Acked-by: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* hwmon: (coretemp) Fix oops on CPU offliningJean Delvare2011-12-211-0/+2
| | | | | | | | | | | | | | | This is for stable kernel branch 3.0 only. Previous and later versions have different code paths and are not affected by this bug. This is the same fix as "hwmon: (coretemp) Fix oops on driver load" but for the CPU offlining case. Sorry for missing it at first. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* hwmon: (coretemp) Fix oops on driver loadJean Delvare2011-12-091-0/+2
| | | | | | | | | | | | | | | | This is for stable kernel branch 3.0 only. Previous and later versions have different code paths and are not affected by this bug. If the CPU microcode is too old, the coretemp driver won't work. But instead of failing gracefully, it currently oops. Check for NULL platform device data to avoid this. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Durgadoss R <durgadoss.r@intel.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* hwmon: (coretemp) Fix for non-SMP buildsJean Delvare2011-11-111-2/+1
| | | | | | | | | | | | | | | | | | commit 2aba6cac2a84f3b80e11a680c34d55e7739b474d upstream. 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 <khali@linux-fr.org> Tested-by: Phil Sutter <phil@nwl.cc> Acked-by: Durgadoss R <Durgadoss.r@intel.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* hwmon: (coretemp) Drop unused struct membersJean Delvare2011-06-171-4/+0
| | | | | | | | | | | pdev_entry.cpu and pdev_entry.cpu_core_id aren't used anywhere in the driver code so we can drop these struct members. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Further relax temperature range checksGuenter Roeck2011-06-011-2/+2
| | | | | | | | | | | | | | 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 <C.Emde@osadl.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Fenghua Yu <fenghua.yu@intel.com>
* hwmon: (coretemp) Fix TjMax detection for older CPUsGuenter Roeck2011-06-011-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit a321cedb12904114e2ba5041a3673ca24deb09c9 excludes CPU models 0xe, 0xf, 0x16, and 0x1a from TjMax temperature adjustment, even though several of those CPUs are known to have TiMax other than 100 degrees C, and even though the code in adjust_tjmax() explicitly handles those CPUs and points to a Web document listing several of the affected CPU IDs. Reinstate original TjMax adjustment if TjMax can not be determined using the IA32_TEMPERATURE_TARGET register. https://bugzilla.kernel.org/show_bug.cgi?id=32582 Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Huaxu Wan <huaxu.wan@linux.intel.com> Cc: Carsten Emde <C.Emde@osadl.org> Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Yong Wang <yong.y.wang@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Fenghua Yu <fenghua.yu@intel.com> Tested-by: Jean Delvare <khali@linux-fr.org> Acked-by: Jean Delvare <khali@linux-fr.org> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Cc: <stable@kernel.org> # .35.x .36.x .37.x .38.x .39.x
* hwmon: (coretemp) Relax target temperature range checkJean Delvare2011-06-011-1/+1
| | | | | | | | | | | | 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 <khali@linux-fr.org> Cc: Carsten Emde <C.Emde@osadl.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Fix section mismatchJean Delvare2011-05-271-1/+1
| | | | | | | | | | | chk_ucode_version() is only called from coretemp_probe() which is __devinit, so it can be marked __devinit too. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Durgadoss R <durgadoss.r@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Update comments describing the handling of HT CPUsGuenter Roeck2011-05-271-6/+6
| | | | | | | | | Update comments describing the handling of HT CPUs based on review feedback. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Initialize sysfs attributesSergey Senozhatsky2011-05-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initialize sysfs attrs before device_create_file() call to suppress lockdep_init_map() warning: [ 3.653628] WARNING: at kernel/lockdep.c:2885 lockdep_init_map+0xea/0x43c() [ 3.653698] Modules linked in: [ 3.654835] Pid: 1, comm: swapper Not tainted 2.6.39-dbg-git8-05624-g46187f8 #576 [ 3.656014] Call Trace: [ 3.657139] [<ffffffff8103e4b4>] warn_slowpath_common+0x7e/0x96 [ 3.658298] [<ffffffff8103e4e1>] warn_slowpath_null+0x15/0x17 [ 3.659460] [<ffffffff8106d7b9>] lockdep_init_map+0xea/0x43c [ 3.660616] [<ffffffff81163c1a>] sysfs_add_file_mode+0x5d/0xa8 [ 3.661785] [<ffffffff81163c71>] sysfs_add_file+0xc/0xe [ 3.662929] [<ffffffff81163d26>] sysfs_create_file+0x23/0x25 [ 3.664045] [<ffffffff813724d1>] device_create_file+0x14/0x16 [ 3.665172] [<ffffffff81460ed4>] coretemp_probe+0xf9/0x185 [ 3.666306] [<ffffffff8137638e>] platform_drv_probe+0x12/0x14 [ 3.667420] [<ffffffff81375321>] driver_probe_device+0xb0/0x14b [ 3.668542] [<ffffffff8137546d>] __device_attach+0x35/0x3a [ 3.669710] [<ffffffff81375438>] ? __driver_attach+0x7c/0x7c [ 3.670816] [<ffffffff8137426b>] bus_for_each_drv+0x54/0x88 [ 3.671921] [<ffffffff81375231>] device_attach+0x77/0x9b [ 3.673027] [<ffffffff81374aef>] bus_probe_device+0x22/0x39 [ 3.674137] [<ffffffff81373235>] device_add+0x3c1/0x550 [ 3.675249] [<ffffffff81371ed9>] ? dev_set_name+0x3c/0x3e [ 3.676371] [<ffffffff813769f3>] platform_device_add+0x10c/0x156 [ 3.677491] [<ffffffff8146af9c>] get_core_online+0xab/0x16e [ 3.678608] [<ffffffff81ad8070>] coretemp_init+0x4b/0x80 [ 3.679724] [<ffffffff81ad8025>] ? hwmon_init+0xee/0xee [ 3.680853] [<ffffffff8100020a>] do_one_initcall+0x7a/0x13c [ 3.681975] [<ffffffff81aaac74>] kernel_init+0xe1/0x15b [ 3.683081] [<ffffffff8147e4e4>] kernel_thread_helper+0x4/0x10 [ 3.684174] [<ffffffff8102d48c>] ? finish_task_switch+0x76/0xf0 [ 3.685266] [<ffffffff81477918>] ? retint_restore_args+0x13/0x13 [ 3.686356] [<ffffffff81aaab93>] ? start_kernel+0x3ee/0x3ee [ 3.687425] [<ffffffff8147e4e0>] ? gs_change+0x13/0x13 [ 3.688489] ---[ end trace 7392ad3e6a92ae39 ]--- Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Add comments describing the handling of HT CPUsGuenter Roeck2011-05-231-2/+18
| | | | | | | | | | | | | | | | | | | | 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 d883b9f09772 ("hwmon: (coretemp) Skip duplicate CPU entries"). Commit e40cc4bdfd4b ("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 <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: (coretemp) Fix compile error if CONFIG_SMP is not definedGuenter Roeck2011-05-231-1/+3
| | | | | | | | | | | | | 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 <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: (coretemp) Fix checkpatch errorsGuenter Roeck2011-05-211-30/+37
| | | | | | | | | Fix remaining checkpatch errors in the coretemp driver. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Merge pkgtemp with coretempDurgadoss R2011-05-201-210/+455
| | | | | | | | | | | | | | 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 <durgadoss.r@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> [guenter.roeck@ericsson.com: Fixed section reference errors] Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Use pr_fmt and pr_<level>Joe Perches2011-01-081-5/+6
| | | | | | | | | | Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) fix reading of microcode revision (v2)Jan Beulich2010-10-251-2/+18
| | | | | | | | | | | | | | | | | 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 <jbeulich@novell.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Chen Gong <gong.chen@linux.intel.com> Cc: Jean Delvare <khali@linux-fr.org> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: ({core, pkg, via-cpu}temp) remove unnecessary CONFIG_HOTPLUG_CPU ifdefsChen Gong2010-10-251-2/+1
| | | | | | | | CONFIG_HOTPLUG_CPU is used too much in some drivers. This patch clean them up. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* x86/hwmon: remove inclusion of unnecessary headers from {core, pkg, ↵Jan Beulich2010-10-251-1/+0
| | | | | | | | | | via-cpu}temp.c 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 <jbeulich@novell.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* x86/hwmon: (coretemp) cosmetic cleanupJan Beulich2010-10-251-2/+0
| | | | | | | | | "break" after "return" is at best bogus (good compilers even warn about the "break" being unreachable). Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* x86/hwmon: {core, pkg, via}cpu_temp_device_remove() can all be __cpuinitJan Beulich2010-10-251-1/+1
| | | | | | | ... as they're being called only from a __cpuinit function. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon (coretemp): Fix build breakage if SMP is undefinedGuenter Roeck2010-09-281-0/+1
| | | | | | | | | | | | | | | | | Commit e40cc4bdfd4b89813f072f72bd9c7055814d3f0f 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 <mingo@elte.hu> Tested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com>
* x86/hwmon: register alternate sibling upon CPU removalJan Beulich2010-09-241-7/+15
| | | | | | | | | | | | | | | | 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 <jbeulich@novell.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* x86/hwmon: fix initialization of coretempJan Beulich2010-09-241-16/+13
| | | | | | | | | | | 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 <jbeulich@novell.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* x86/hwmon: fix module init for hotplug-but-no-device-found caseJan Beulich2010-09-241-1/+4
| | | | | | | | | | | | | In commit 0dca94baeab4a1a514841b0a4c8e3a51dfb4d5ae 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 <jbeulich@novell.com> Cc: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
* hwmon: (coretemp) Fix harmless build warningJean Delvare2010-08-251-1/+0
| | | | | | | | | | | | | | | | | | 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 851b29cb3b196cb66452ec964ab5f66c9c9cd1ed. When you drop code, you also have to drop the variables this code was using. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Chen Gong <gong.chen@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@intel.com>
* fix "hwmon: coretemp: update hotplug condition check"Andrew Morton2010-08-111-3/+0
| | | | | | | | | | | | | | | | | In commit 0dca94baeab4 ("hwmon: coretemp: update hotplug condition check") we merged v2 of this patch. Update that to v3. The difference is to remove the new and unnecesary references to CPU_*_FROZEN. Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Chen Gong <gong.chen@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/hwmon/coretemp.c: remove unneeded #ifdef CONFIG_HOTPLUG_CPUAndrew Morton2010-08-091-4/+0
| | | | | | | | | | | | register_hotcpu_notifier() is designed to make these ifdefs unnecessary. Cc: Chen Gong <gong.chen@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: coretemp: enable coretemp device add operation failureChen Gong2010-08-091-14/+3
| | | | | | | | | | | | | | If one coretemp device can't be added, it should allow subsequent adding operation because every new-added device will create a new sysfs group, not an additional sensor sys entry. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: coretemp: update hotplug condition checkChen Gong2010-08-091-0/+5
| | | | | | | | | | | | | | | | 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 <gong.chen@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: (coretemp) Properly label the sensorsJean Delvare2010-07-091-1/+5
| | | | | | | | | | 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 <khali@linux-fr.org> Acked-by: Huaxu Wan <huaxu.wan@intel.com> Cc: stable@kernel.org
* hwmon: (coretemp) Skip duplicate CPU entriesJean Delvare2010-07-091-1/+25
| | | | | | | | | 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 <khali@linux-fr.org> Acked-by: Huaxu Wan <huaxu.wan@intel.com> Cc: stable@kernel.org
* drivers/hwmon/coretemp.c: get TjMax value from MSRCarsten Emde2010-05-251-4/+57
| | | | | | | | | | | | | | | The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer Intel processors. Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com> Signed-off-by: Carsten Emde <C.Emde@osadl.org> Cc: Jean Delvare <khali@linux-fr.org> Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Yong Wang <yong.y.wang@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/hwmon/coretemp.c: detect the thermal sensors by CPUIDCarsten Emde2010-05-251-20/+12
| | | | | | | | | | | | | | | The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction, indicated by CPUID.06H.EAX[0]. Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com> Signed-off-by: Carsten Emde <C.Emde@osadl.org> Reviewed-by: Valdis Kletnieks <valdis.kletnieks@vt.edu> Cc: Jean Delvare <khali@linux-fr.org> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Yong Wang <yong.y.wang@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: (coretemp) Add missing newline to dev_warn() messageDean Nelson2010-03-291-1/+1
| | | | | | | | | | 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 <dnelson@redhat.com> Cc: stable@kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Fix cpu model outputPrarit Bhargava2010-03-291-1/+1
| | | | | | | Avoid hex and decimal confusion when printing out the cpu model. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Fix TjMax for Atom N450/D410/D510 CPUsYong Wang2010-01-101-2/+14
| | | | | | | | | | | The max junction temperature of Atom N450/D410/D510 CPUs is 100 degrees Celsius. Since these CPUs are always coupled with Intel NM10 chipset in one package, the best way to verify whether an Atom CPU is N450/D410/D510 is to check the host bridge device. Signed-off-by: Yong Wang <yong.y.wang@intel.com> Acked-by: Huaxu Wan <huaxu.wan@intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Add Lynnfield CPUHuaxu Wan2009-09-231-2/+4
| | | | | | | | | | | Add Lynnfield processor support. Lynnfield is a quad-core Nehalem based microprocessor for Desktop market, which is introduced in September 2009. Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com> Signed-off-by: Kent Liu <kent.liu@linux.intel.com> Acked-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Add support for Penryn mobile CPUsRudolf Marek2009-09-231-3/+23
| | | | | | | | | | | Following patch adds support for mobile Penryn CPUs. Intel documents this poorly. I asked the Coretemp author for some help. This is totally untested and may not work. Please test! Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@linux.intel.com> Cc: Kent Liu <kent.liu@linux.intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (coretemp) Fix Atom CPUs supportRudolf Marek2009-09-231-10/+19
| | | | | | | | | | Fix Atom CPUs support. Intel documents TjMax at 90 degrees C but some Atoms may have 125 degrees C (this is undocumented speculation). Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Cc: Huaxu Wan <huaxu.wan@linux.intel.com> Cc: Kent Liu <kent.liu@linux.intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* drivers/hwmon/coretemp.c: enable the Intel AtomMichael Riepe2009-09-221-2/+2
| | | | | | | | | | | | | | Enable the coretemp driver on an Intel Atom. I'm not sure if the readings are correct, however - on my 330, the driver reports values between 27 and 41 °C (with core1 being about 8°C hotter than core0, given the same load). Maybe the maximum temperature of 100 °C is wrong for Atom CPUs. Cc: Arjan van de Ven <arjan@infradead.org> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* coretemp: recognize Nehalem CPUsDarrick J. Wong2008-08-151-2/+3
| | | | | | | | | Add in the CPUID for Nehalem chips. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Cc: Kent Liu <kent.liu@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hwmon: (coretemp) Add Penryn CPU to coretempRudolf Marek2008-02-171-2/+2
| | | | | | | | | | | This patch adds support for family 0x17, which has Penryn Core. It should also cover the 8 cores Xeons. Can someone test please? I think it should work. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: (coretemp) Add TjMax detection for mobile CPUsRudolf Marek2008-02-171-32/+51
| | | | | | | | | | | | Following patch will finally solve the detection of Intel Mobile CPUs which share same CPUID with Desktop/Server CPUs. We need this information to test some bit so we know if TjMax is 100C or 85C. Intel claims this works for mobiles only, respect that and set for desktops the TjMax to 100C. Intel provided some table on their wiki based on my chat with them at: http://softwarecommunity.intel.com/isn/Community/en-US/forums/30247249/ShowThread.aspx#30247249 Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: (coretemp) fix section mismatch warningSam Ravnborg2008-02-171-2/+2
| | | | | | | | | | | | | | | Fix following warning: WARNING: vmlinux.o(.text+0xebfd04): Section mismatch in reference from the function coretemp_cpu_callback() to the function .cpuinit.text:coretemp_device_add() coretemp_cpu_callback() are only used inside a HOTPLUG_CPU block so annotate it __cpuinit. The notifier referencing the function are annotated __refdata to silence warning from the exit function. The unregister function do not use the embedded pointer but clears the variable so the annotation is OK. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: (coretemp) Add maximum cooling temperature readoutRudolf Marek2008-02-171-4/+30
| | | | | | | | | Following patch will add reporting of maximum temperature, at which all fans should spin full speed. It may be non-physical temperature on Desktop/Server CPUs. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* HWMON: coretemp, suspend fixRafael J. Wysocki2007-12-041-3/+2
| | | | | | | | | | | | | | | | It's not permitted to unregister a device after devices have been suspended. It causes deadlocks to appear on systems with coretemp hwmon loaded.  To avoid this, we can make coretemp_cpu_callback() do nothing if the _FROZEN bit is set in action.   Also, in other cases it's generally too late to unregister the coretemp device if the CPU is already dead, so it should be unregistered on CPU_DOWN_PREPARE.   Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Jiri Slaby <jirislaby@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>