Skip to content

Commit 5797c04

Browse files
paulfertsergroeck
authored andcommitted
hwmon: (peci/dimmtemp) Do not provide fake thresholds data
When an Icelake or Sapphire Rapids CPU isn't providing the maximum and critical thresholds for particular DIMM the driver should return an error to the userspace instead of giving it stale (best case) or wrong (the structure contains all zeros after kzalloc() call) data. The issue can be reproduced by binding the peci driver while the host is fully booted and idle, this makes PECI interaction unreliable enough. Fixes: 73bc1b8 ("hwmon: peci: Add dimmtemp driver") Fixes: 621995b ("hwmon: (peci/dimmtemp) Add Sapphire Rapids support") Cc: stable@vger.kernel.org Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20250123122003.6010-1-fercerpav@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent d082ecb commit 5797c04

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/hwmon/peci/dimmtemp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ static int update_thresholds(struct peci_dimmtemp *priv, int dimm_no)
127127
return 0;
128128

129129
ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data);
130-
if (ret == -ENODATA) /* Use default or previous value */
131-
return 0;
132130
if (ret)
133131
return ret;
134132

@@ -509,11 +507,11 @@ read_thresholds_icx(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
509507

510508
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd4, &reg_val);
511509
if (ret || !(reg_val & BIT(31)))
512-
return -ENODATA; /* Use default or previous value */
510+
return -ENODATA;
513511

514512
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd0, &reg_val);
515513
if (ret)
516-
return -ENODATA; /* Use default or previous value */
514+
return -ENODATA;
517515

518516
/*
519517
* Device 26, Offset 224e0: IMC 0 channel 0 -> rank 0
@@ -546,11 +544,11 @@ read_thresholds_spr(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
546544

547545
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, &reg_val);
548546
if (ret || !(reg_val & BIT(31)))
549-
return -ENODATA; /* Use default or previous value */
547+
return -ENODATA;
550548

551549
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, &reg_val);
552550
if (ret)
553-
return -ENODATA; /* Use default or previous value */
551+
return -ENODATA;
554552

555553
/*
556554
* Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0

0 commit comments

Comments
 (0)