aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/k10temp.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-05-13hwmon: (k10temp) Use API function to access System Management NetworkGuenter Roeck1-5/+6
The SMN (System Management Network) on Family 17h AMD CPUs is also accessed from other drivers, specifically EDAC. Accessing it directly is racy. On top of that, accessing the SMN through root bridge 00:00 is wrong on multi-die CPUs and may result in reading the temperature from the wrong die. Use available API functions to fix the problem. For this to work, add dependency on AMD_NB. Also change the Raven Ridge PCI device ID to point to Data Fabric Function 3, since this ID is used by the API functions to find the CPU node. Cc: stable@vger.kernel.org # v4.16+ Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-29hwmon: (k10temp) Fix reading critical temperature registerGuenter Roeck1-10/+30
The HTC (Hardware Temperature Control) register has moved for recent chips. Cc: stable@vger.kernel.org # v4.16+ Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-25hwmon: (k10temp) Add support for AMD Ryzen w/ Vega graphicsGuenter Roeck1-0/+5
Enable k10temp for AMD Ryzen APUs w/ Vega Mobile Gfx. Based on patch from René Rebe <rene@exactcode.de>. Dropped temperature offsets since those are not supposed to apply for the affected CPUs. Cc: stable@vger.kernel.org # v4.16+ Cc: René Rebe <rene@exactcode.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-25hwmon: (k10temp) Add temperature offset for Ryzen 2700XGuenter Roeck1-3/+9
Ryzen 2700X has a temperature offset of 10 degrees C. If bit 19 of the Temperature Control register is set, there is an additional offset of 49 degrees C. Take this into account as well. Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-02-15Merge tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-stagingLinus Torvalds1-1/+4
Pull hwmon fix from Guenter Roeck: "Fix bad temperature display on Ryzen/Threadripper" * tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (k10temp) Only apply temperature offset if result is positive
2018-02-14Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-1/+1
Pull x86 PTI and Spectre related fixes and updates from Ingo Molnar: "Here's the latest set of Spectre and PTI related fixes and updates: Spectre: - Add entry code register clearing to reduce the Spectre attack surface - Update the Spectre microcode blacklist - Inline the KVM Spectre helpers to get close to v4.14 performance again. - Fix indirect_branch_prediction_barrier() - Fix/improve Spectre related kernel messages - Fix array_index_nospec_mask() asm constraint - KVM: fix two MSR handling bugs PTI: - Fix a paranoid entry PTI CR3 handling bug - Fix comments objtool: - Fix paranoid_entry() frame pointer warning - Annotate WARN()-related UD2 as reachable - Various fixes - Add Add Peter Zijlstra as objtool co-maintainer Misc: - Various x86 entry code self-test fixes - Improve/simplify entry code stack frame generation and handling after recent heavy-handed PTI and Spectre changes. (There's two more WIP improvements expected here.) - Type fix for cache entries There's also some low risk non-fix changes I've included in this branch to reduce backporting conflicts: - rename a confusing x86_cpu field name - de-obfuscate the naming of single-TLB flushing primitives" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits) x86/entry/64: Fix CR3 restore in paranoid_exit() x86/cpu: Change type of x86_cache_size variable to unsigned int x86/spectre: Fix an error message x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping selftests/x86/mpx: Fix incorrect bounds with old _sigfault x86/mm: Rename flush_tlb_single() and flush_tlb_one() to __flush_tlb_one_[user|kernel]() x86/speculation: Add <asm/msr-index.h> dependency nospec: Move array_index_nospec() parameter checking into separate macro x86/speculation: Fix up array_index_nospec_mask() asm constraint x86/debug: Use UD2 for WARN() x86/debug, objtool: Annotate WARN()-related UD2 as reachable objtool: Fix segfault in ignore_unreachable_insn() selftests/x86: Disable tests requiring 32-bit support on pure 64-bit systems selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c selftests/x86: Fix build bug caused by the 5lvl test which has been moved to the VM directory selftests/x86/pkeys: Remove unused functions selftests/x86: Clean up and document sscanf() usage selftests/x86: Fix vDSO selftest segfault for vsyscall=none x86/entry/64: Remove the unused 'icebp' macro ...
2018-02-15x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_steppingJia Zhang1-1/+1
x86_mask is a confusing name which is hard to associate with the processor's stepping. Additionally, correct an indent issue in lib/cpu.c. Signed-off-by: Jia Zhang <qianyue.zj@alibaba-inc.com> [ Updated it to more recent kernels. ] Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bp@alien8.de Cc: tony.luck@intel.com Link: http://lkml.kernel.org/r/1514771530-70829-1-git-send-email-qianyue.zj@alibaba-inc.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-12hwmon: (k10temp) Only apply temperature offset if result is positiveGuenter Roeck1-1/+4
A user reports a really bad temperature on Ryzen 1950X. k10temp-pci-00cb Adapter: PCI adapter temp1: +4294948.3°C (high = +70.0°C) This will happen if the temperature reported by the chip is lower than the offset temperature. This has been seen in the field if "Sense MI Skew" and/or "Sense MI Offset" BIOS parameters were set to unexpected values. Let's report a temperature of 0 degrees C in that case. Fixes: 1b50b776355f ("hwmon: (k10temp) Add support for temperature offsets") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-01-19hwmon: (k10temp) Add temperature offset for Ryzen 1900XGuenter Roeck1-0/+1
Like the other CPUs from the same series, the 1900X has a temperature offset of 27 degrees C. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-11-16hwmon: (k10temp) Correct model name for Ryzen 1600XGuenter Roeck1-1/+1
Ryzen 1600X is a Ryzen 5 processor. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29hwmon: (k10temp) Add support for temperature offsetsGuenter Roeck1-0/+30
Add support for handling temperature offset values for various AMD CPUs, similar to the code used in the coretemp driver for Intel CPUs. This is primarily for Ryzen CPUs (which has documented temperature offsets), but the code is kept generic to simplify adding additional CPUs. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29hwmon: (k10temp) Add support for family 17hGuenter Roeck1-0/+16
Add support for temperature sensors on Family 17h (Ryzen) processors. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29hwmon: (k10temp) Move chip specific code into probe functionGuenter Roeck1-17/+45
Introduce a local data structure and determine the temperature read function at probe time to reduce runtime complexity. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (k10temp) use permission-specific DEVICE_ATTR variantsJulia Lawall1-6/+6
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-11-09hwmon: (k10temp) Remove duplicate pci-id defineAdam Majer1-1/+0
PCI_DEVICE_ID_AMD_15H_M60H_NB_F3 is now defined in pci_ids.h Signed-off-by: Adam Majer <adamm@zombino.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jean Delvare <jdelvare@suse.de>
2014-09-22hwmon: (k10temp) Convert to devm_hwmon_device_register_with_groupsGuenter Roeck1-76/+48
Use devm_hwmon_device_register_with_groups() to simplify the code and reduce code size. Cc: Clemens Ladisch <clemens@ladisch.de> Tested-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22hwmon: (k10temp) Add support for F15h M60hAravind Gopalakrishnan1-3/+32
This patch adds temperature monitoring support for F15h M60h processor. - Add new pci device id for the relevant processor - The functionality of REG_REPORTED_TEMPERATURE is moved to D0F0xBC_xD820_0CA4 [Reported Temperature Control] - So, use this to get CUR_TEMP value - Since we need an indirect register access, protect this with a mutex lock - Add Kconfig, Doc entries to indicate support for this processor. Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com> Acked-by: Borislav Petkov <bp@suse.de> Acked-by: Clemens Ladisch <clemens@ladisch.de> [Guenter Roeck: Declare new mutex and function static] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-02hwmon: (k10temp) Add support for AMD F16 M30h processorAravind Gopalakrishnan1-0/+1
Adding new PCI ID to support AMD F16 M30h processor (Mullins). While at it, modify Kconfig and Doc files to reflect the support for newer processors Note: PCI ID for this processor will make it into pci_ids.h as part of this patch: http://marc.info/?l=linux-kernel&m=139291362126057&w=2 which should be pulled into 3.15 when merge window opens (It currently sits in 'for-next' branch of bp.git- https://git.kernel.org/cgit/linux/kernel/git/bp/bp.git/log/?h=for-next) Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: (k10temp) Add support for Kaveri CPUsPhil Pokorny1-0/+1
Add new PCI ID to support new model "Kaveri" family. Signed-off-by: Philip Pokorny <ppokorny@penguincomputing.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han1-1/+1
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-12hwmon: (k10temp) remove unnecessary pci_set_drvdata()Jingoo Han1-1/+0
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27hwmon: (k10temp) Add support for Fam16h (Kabini)Wei Hu1-1/+2
The temperature reporting interface stays the same, so we just add the PCI-ID to the list. Verified on AMD Olive Hill. Signed-off-by: Wei Hu <wei@aristanetworks.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-11-28hwmon: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton1-2/+2
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07x86, amd_nb: Export model 0x10 and later PCI idBorislav Petkov1-4/+1
Add the F3 PCI id of F15h, model 0x10 to pci_ids.h and to the amd_nb code which generates the list of northbridges on an AMD box. Shorten define name while at it so that it fits into pci_ids.h. Acked-by: Clemens Ladisch <clemens@ladisch.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
2012-05-20hwmon: use module_pci_driverAxel Lin1-12/+1
This patch converts the drivers in drivers/hwmon/* to use module_pci_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-04-01hwmon: (k10temp) Add support for AMD Trinity CPUsAndre Przywara1-0/+4
The on-chip northbridge's temperature sensor of the upcoming AMD Trinity CPUs works the same as for the previous CPUs. Since it has a different PCI-ID, we just add the new one to the list supported by k10temp. This allows to use the k10temp driver on those CPUs. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-18hwmon: use DEFINE_PCI_DEVICE_TABLEFrans Meulenbroeks1-1/+1
fix all checkpatch warnings about DEFINE_PCI_DEVICE_TABLE Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-05-25hwmon: (k10temp) Add support for Fam15h (Bulldozer)Andre Przywara1-2/+3
AMDs upcoming CPUs use the same mechanism for the internal temperature reporting as the Fam10h CPUs, so we just needed to add the appropriate PCI-ID to the list. This allows to use the k10temp driver on those CPUs. While at it change the Kconfig entry to be more generic. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25hwmon: Use helper functions to set and get driver dataJean Delvare1-3/+3
Use helper functions to set and get driver data. This is more elegant. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Andreas Herrmann <andreas.herrmann3@amd.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-02-18hwmon: (k10temp) add support for AMD Family 12h/14h CPUsClemens Ladisch1-2/+3
Add the PCI ID to support the internal temperature sensor of the AMD "Llano" and "Brazos" processor families. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@kernel.org # ca86828: x86, AMD, PCI: Add AMD northbridge PCI device Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-06-20hwmon: (k10temp) Do not blacklist known working CPU modelsJean Delvare1-2/+12
When detecting AM2+ or AM3 socket with DDR2, only blacklist cores which are known to exist in AM2+ format. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Clemens Ladisch <clemens@ladisch.de> Cc: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: stable@kernel.org
2010-01-10hwmon: Make PCI device ids constantMárton Németh1-1/+1
The id_table field of the struct pci_driver is constant in <linux/pci.h> so it is worth to make pci_device_id also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ identifier I1, I2, x; @@ struct I1 { ... const struct I2 *x; ... }; @s@ identifier r.I1, y; identifier r.x, E; @@ struct I1 y = { .x = E, }; @c@ identifier r.I2; identifier s.E; @@ const struct I2 E[] = ... ; @depends on !c@ identifier r.I2; identifier s.E; @@ + const struct I2 E[] = ...; // </smpl> Signed-off-by: Márton Németh <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-01-10hwmon: (k10temp) Blacklist more family 10h processorsClemens Ladisch1-6/+32
The latest version of the Revision Guide for AMD Family 10h Processors lists two more processor revisions which may be affected by erratum 319. Change the blacklisting code to correctly detect those processors, by implementing AMD's recommended algorithm. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
2009-12-16hwmon: New driver for AMD Family 10h/11h CPUsClemens Ladisch1-0/+197
This adds a driver for the internal temperature sensor of AMD Family 10h and 11h CPUs. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>