Commit 47080f22 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull hwmon updates from Guenter Roeck:
 "The most notable change is the removal of the amd_energy driver. It
  was rendered all but unusable by making its attributes privileged-only
  to work around a security issue. A suggested remedy was rejected by
  AMD, so the only real solution was to remove the driver. For the
  future, we'll have to make sure that no privileged-access-only drivers
  are accepted into the hwmon subsystem in the first place. The hwmon
  ABI document was updated accordingly.

  Other changes:

  PMBus drivers:
   - Added driver for MAX15301
   - Added driver for BluTek BPA-RS600
   - Added driver for fsp-3y PSUs and PDUs
   - Added driver for Infineon IR36021
   - Added driver for ST STPDDC60
   - Added support for TI TPS53676 to tps53679 driver
   - Introduced PMBUS symbol namespace. This was made necessary by a
     suggestion to use its exported functions from outside the hwmon
     subsystem.
   - Minor improvements and bug fixes

  New drivers:
   - Driver for NZXT Kraken X42/X52/X62/X72

  Driver enhancements:
   - Added support for Intel D5005 to intel-m10-bmc-hwmon driver
   - Added support for NCT6686D to nct6683 driver

  Other:
   - Converted sch5627 and amd9240 drivers to
     hwmon_device_register_with_info()
   - Added support for fan drawers capability and present registers to
     mlxreg-fan driver
   - Added Dell Latitude E7440 to fan control whitelist in dell-smm
     driver
   - Replaced snprintf in show functions with sysfs_emit. Done with
     coccinelle script for all drivers to preempt endless per-driver
     submissions of the same change.
   - Use kobj_to_dev().  Another coccinelle based change to preempt
     endless per-driver submissions of the same change.
   - Various minor fixes and improvements"

* tag 'hwmon-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (38 commits)
  hwmon: Remove amd_energy driver
  hwmon: Clarify scope of attribute access
  hwmon: (pmbus) Introduce PMBUS symbol namespace
  hwmon: (pmbus) Add pmbus driver for MAX15301
  hwmon: (sch5627) Remove unnecessary error path
  hwmon: (sch5627) Use devres function
  hwmon: (pmbus/pxe1610) don't bail out when not all pages are active
  hwmon: Add driver for fsp-3y PSUs and PDUs
  hwmon: (intel-m10-bmc-hwmon) add sensor support of Intel D5005 card
  hwmon: (sch5627) Split sch5627_update_device()
  hwmon: (sch5627) Convert to hwmon_device_register_with_info()
  hwmon: (nct6683) remove useless function
  hwmon: (dell-smm) Add Dell Latitude E7440 to fan control whitelist
  MAINTAINERS: Add keyword pattern for hwmon registration functions
  hwmon: (mlxreg-fan) Add support for fan drawers capability and present registers
  hwmon: (pmbus/tps53679) Add support for TI TPS53676
  dt-bindings: Add trivial device entry for TPS53676
  hwmon: (ftsteutates) Rudimentary typo fixes
  hwmon: (pmbus) Add driver for BluTek BPA-RS600
  dt-bindings: Add vendor prefix and trivial device for BluTek BPA-RS600
  ...
parents 55ba0fe0 9049572f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ properties:
          - atmel,atsha204a
            # i2c h/w elliptic curve crypto module
          - atmel,atecc508a
            # BPA-RS600: Power Supply
          - blutek,bpa-rs600
            # Bosch Sensortec pressure, temperature, humididty and VOC sensor
          - bosch,bme680
            # CM32181: Ambient Light Sensor
@@ -102,6 +104,8 @@ properties:
          - mps,mp2975
            # G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
          - gmt,g751
            # Infineon IR36021 digital POL buck controller
          - infineon,ir36021
            # Infineon IR38064 Voltage Regulator
          - infineon,ir38064
            # Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
@@ -288,6 +292,8 @@ properties:
          - ti,tmp103
            # Digital Temperature Sensor
          - ti,tmp275
            # TI Dual channel DCAP+ multiphase controller TPS53676 with AVSBus
          - ti,tps53676
            # TI Dual channel DCAP+ multiphase controller TPS53679
          - ti,tps53679
            # TI Dual channel DCAP+ multiphase controller TPS53688
+2 −0
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ patternProperties:
    description: Beckhoff Automation GmbH & Co. KG
  "^bitmain,.*":
    description: Bitmain Technologies
  "^blutek,.*":
    description: BluTek Power
  "^boe,.*":
    description: BOE Technology Group Co., Ltd.
  "^bosch,.*":
+0 −119
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0

Kernel driver amd_energy
==========================

Supported chips:

* AMD Family 17h Processors: Model 30h

* AMD Family 19h Processors: Model 01h

  Prefix: 'amd_energy'

  Addresses used:  RAPL MSRs

  Datasheets:

  - Processor Programming Reference (PPR) for AMD Family 17h Model 01h, Revision B1 Processors

	https://developer.amd.com/wp-content/resources/55570-B1_PUB.zip

  - Preliminary Processor Programming Reference (PPR) for AMD Family 17h Model 31h, Revision B0 Processors

	https://developer.amd.com/wp-content/resources/56176_ppr_Family_17h_Model_71h_B0_pub_Rev_3.06.zip

Author: Naveen Krishna Chatradhi <nchatrad@amd.com>

Description
-----------

The Energy driver exposes the energy counters that are
reported via the Running Average Power Limit (RAPL)
Model-specific Registers (MSRs) via the hardware monitor
(HWMON) sysfs interface.

1. Power, Energy and Time Units
   MSR_RAPL_POWER_UNIT/ C001_0299:
   shared with all cores in the socket

2. Energy consumed by each Core
   MSR_CORE_ENERGY_STATUS/ C001_029A:
   32-bitRO, Accumulator, core-level power reporting

3. Energy consumed by Socket
   MSR_PACKAGE_ENERGY_STATUS/ C001_029B:
   32-bitRO, Accumulator, socket-level power reporting,
   shared with all cores in socket

These registers are updated every 1ms and cleared on
reset of the system.

Note: If SMT is enabled, Linux enumerates all threads as cpus.
Since, the energy status registers are accessed at core level,
reading those registers from the sibling threads would result
in duplicate values. Hence, energy counter entries are not
populated for the siblings.

Energy Caluclation
------------------

Energy information (in Joules) is based on the multiplier,
1/2^ESU; where ESU is an unsigned integer read from
MSR_RAPL_POWER_UNIT register. Default value is 10000b,
indicating energy status unit is 15.3 micro-Joules increment.

Reported values are scaled as per the formula

scaled value = ((1/2^ESU) * (Raw value) * 1000000UL) in uJoules

Users calculate power for a given domain by calculating
	dEnergy/dTime for that domain.

Energy accumulation
--------------------------

Current, Socket energy status register is 32bit, assuming a 240W
2P system, the register would wrap around in

	2^32*15.3 e-6/240 * 2 = 547.60833024 secs to wrap(~9 mins)

The Core energy register may wrap around after several days.

To improve the wrap around time, a kernel thread is implemented
to accumulate the socket energy counters and one core energy counter
per run to a respective 64-bit counter. The kernel thread starts
running during probe, wakes up every 100secs and stops running
when driver is removed.

Frequency of the accumulator thread is set during the probe
based on the chosen energy unit resolution. For example
A. fine grain (1.625 micro J)
B. course grain (0.125 milli J)

A socket and core energy read would return the current register
value added to the respective energy accumulator.

Sysfs attributes
----------------

=============== ========  =====================================
Attribute	Label	  Description
===============	========  =====================================

* For index N between [1] and [nr_cpus]

===============	========  ======================================
energy[N]_input EcoreX	  Core Energy   X = [0] to [nr_cpus - 1]
			  Measured input core energy
===============	========  ======================================

* For N between [nr_cpus] and [nr_cpus + nr_socks]

===============	========  ======================================
energy[N]_input EsocketX  Socket Energy X = [0] to [nr_socks -1]
			  Measured input socket energy
=============== ========  ======================================

Note: To address CVE-2020-12912, the visibility of the energy[N]_input
attributes is restricted to owner and groups only.
+74 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0

Kernel driver bpa-rs600
=======================

Supported chips:

  * BPA-RS600-120

    Datasheet: Publicly available at the BluTek website
       http://blutekpower.com/wp-content/uploads/2019/01/BPA-RS600-120-07-19-2018.pdf

Authors:
      - Chris Packham <chris.packham@alliedtelesis.co.nz>

Description
-----------

The BPA-RS600 is a compact 600W removable power supply module.

Usage Notes
-----------

This driver does not probe for PMBus devices. You will have to instantiate
devices explicitly.

Sysfs attributes
----------------

======================= ============================================
curr1_label             "iin"
curr1_input		Measured input current
curr1_max		Maximum input current
curr1_max_alarm		Input current high alarm

curr2_label		"iout1"
curr2_input		Measured output current
curr2_max		Maximum output current
curr2_max_alarm		Output current high alarm

fan1_input		Measured fan speed
fan1_alarm		Fan warning
fan1_fault		Fan fault

in1_label		"vin"
in1_input		Measured input voltage
in1_max			Maximum input voltage
in1_max_alarm		Input voltage high alarm
in1_min			Minimum input voltage
in1_min_alarm		Input voltage low alarm

in2_label		"vout1"
in2_input		Measured output voltage
in2_max			Maximum output voltage
in2_max_alarm		Output voltage high alarm
in2_min			Maximum output voltage
in2_min_alarm		Output voltage low alarm

power1_label		"pin"
power1_input		Measured input power
power1_alarm		Input power alarm
power1_max		Maximum input power

power2_label		"pout1"
power2_input		Measured output power
power2_max		Maximum output power
power2_max_alarm	Output power high alarm

temp1_input		Measured temperature around input connector
temp1_alarm		Temperature alarm

temp2_input		Measured temperature around output connector
temp2_alarm		Temperature alarm
======================= ============================================
+12 −1
Original line number Diff line number Diff line
@@ -47,19 +47,30 @@ Sysfs entries
=======================	========================================================
curr1_input		Total current usage
curr2_input		Current on the 12v psu rail
curr2_crit		Current max critical value on the 12v psu rail
curr3_input		Current on the 5v psu rail
curr3_crit		Current max critical value on the 5v psu rail
curr4_input		Current on the 3.3v psu rail
curr4_crit		Current max critical value on the 3.3v psu rail
fan1_input		RPM of psu fan
in0_input		Voltage of the psu ac input
in1_input		Voltage of the 12v psu rail
in1_crit		Voltage max critical value on the 12v psu rail
in1_lcrit		Voltage min critical value on the 12v psu rail
in2_input		Voltage of the 5v psu rail
in3_input		Voltage of the 3.3 psu rail
in2_crit		Voltage max critical value on the 5v psu rail
in2_lcrit		Voltage min critical value on the 5v psu rail
in3_input		Voltage of the 3.3v psu rail
in3_crit		Voltage max critical value on the 3.3v psu rail
in3_lcrit		Voltage min critical value on the 3.3v psu rail
power1_input		Total power usage
power2_input		Power usage of the 12v psu rail
power3_input		Power usage of the 5v psu rail
power4_input		Power usage of the 3.3v psu rail
temp1_input		Temperature of the psu vrm component
temp1_crit		Temperature max cirtical value of the psu vrm component
temp2_input		Temperature of the psu case
temp2_crit		Temperature max critical value of psu case
=======================	========================================================

Usage Notes
Loading