Skip to content

misc: amd-sbi: add DIMM thermal sensors to sbrmi

Akshay Gupta linux-devicetree linux-doc linux-hwmon lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4misc: amd-sbi: use guard() for data->lock mutexdrivers/misc/amd-sbi/rmi-core.c+72 -760 replies
2/4dt-bindings: hwmon: add DIMM thermal sensor propertiesDocumentation/devicetree/bindings/hwmon/amd,sbrmi.yaml+55 -40 replies
3/4misc: amd-sbi: add DIMM thermal sensor supportdrivers/misc/amd-sbi/rmi-core.h drivers/misc/amd-sbi/rmi-hwmon.c+228 -180 replies
4/4Documentation: hwmon: document DIMM thermal sensor channelsDocumentation/hwmon/sbrmi.rst Documentation/misc-devices/amd-sbi.rst+40 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/4] misc: amd-sbi: add DIMM thermal sensors to sbrmi

The sbrmi hwmon device reports socket power. SB-RMI can also read the TS0 and TS1 thermal sensors on each DIMM, which a BMC needs beside the power attributes. This series reports those sensors as temperature channels on the same hwmon device.

The read is mailbox command 0x48 with a Mode 1 DIMM_ADDRESS:

  bit[7]   1 (Mode 1)
  bit[6]   sensor select (0 = TS0, 1 = TS1)
  bit[5]   reserved
  bit[4]   DIMM slot

bit[3:0] memory channel

Up to 16 DIMMs are reported, two sensors each. DIMM n is temp(n+1) for TS0 and temp(n+17) for TS1. Each channel is labelled DIMM_TS<t>_UMC<n>. With one DIMM per channel, n is the memory channel. With two, n is channel * 2 + slot, and the addresses interleave (0x80, 0x90, 0x81, ...). The temp index is the DIMM number, so a DIMM keeps the same tempN when other sensors are left out of the map.

DataOut[31:21] is an 11-bit two's complement value in steps of 0.25 degC. The driver reports it to hwmon in millidegrees Celsius.

Boards differ in how many DIMMs are fitted per memory channel and in which sensors are populated. Two optional firmware properties describe that:

amd,dpc DIMMs per channel, 1 or 2. The default is 1.
amd,dimm-ids Mode 1 address of each sensor to expose. Only those
channels are visible. If the property is absent, all 32 channels are exposed, and a read of a sensor that is not fitted returns the firmware error.

The binding and the driver reject an address without bit[7], with the reserved bit[5], with the slot bit set when amd,dpc is 1, with a memory channel above 7 when amd,dpc is 2, or listed twice. An empty or unreadable amd,dimm-ids property is rejected as well. With one DIMM per channel the allowed values are 0x80-0x8f and 0xc0-0xcf. With two they are 0x80-0x87, 0x90-0x97, 0xc0-0xc7 and 0xd0-0xd7.

The mailbox transaction and the existing hwmon registration both live in drivers/misc/amd-sbi, so the new channels are added there, on the hwmon device the driver already publishes.

Patches:

1. Switch sbrmi_data->lock to guard(). No functional change. The DIMM reads go through rmi_mailbox_xfer(), and this lets the error paths in that function return directly. The patch stands on its own.

2. Add amd,dpc and amd,dimm-ids to the amd,sbrmi binding, and mention the DIMM sensors in the title, description and example.

3. Report the sensors from rmi-hwmon: tempX_input and tempX_label, visibility taken from the DIMM map, and the 0.25 degC conversion.

4. Document the temperature attributes and the DIMM-to-temp mapping in Documentation/hwmon/sbrmi.rst, and point to it from the SB-RMI section of Documentation/misc-devices/amd-sbi.rst.

Thanks,
Akshay Gupta

Prathima Lk (4):
misc: amd-sbi: use guard() for data->lock mutex
dt-bindings: hwmon: add DIMM thermal sensor properties
misc: amd-sbi: add DIMM thermal sensor support
Documentation: hwmon: document DIMM thermal sensor channels

 .../devicetree/bindings/hwmon/amd,sbrmi.yaml  |  59 ++++-
 Documentation/hwmon/sbrmi.rst                 |  37 +++
 Documentation/misc-devices/amd-sbi.rst        |   4 +-
 drivers/misc/amd-sbi/rmi-core.c               | 148 ++++++-----
 drivers/misc/amd-sbi/rmi-core.h               |  10 +
 drivers/misc/amd-sbi/rmi-hwmon.c              | 236 ++++++++++++++++--
 6 files changed, 395 insertions(+), 99 deletions(-)
Signature · 1 line
2.34.1