mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
hwmon: (peci/dimmtemp) Do not provide fake thresholds data
commit 5797c04400ee117bfe459ff1e468d0ea38054ab4 upstream. 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:73bc1b885d("hwmon: peci: Add dimmtemp driver") Fixes:621995b6d7("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8e507b3798
commit
c144d19958
@@ -127,8 +127,6 @@ static int update_thresholds(struct peci_dimmtemp *priv, int dimm_no)
|
||||
return 0;
|
||||
|
||||
ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data);
|
||||
if (ret == -ENODATA) /* Use default or previous value */
|
||||
return 0;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -509,11 +507,11 @@ read_thresholds_icx(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd4, ®_val);
|
||||
if (ret || !(reg_val & BIT(31)))
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd0, ®_val);
|
||||
if (ret)
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, ®_val);
|
||||
if (ret || !(reg_val & BIT(31)))
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, ®_val);
|
||||
if (ret)
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
/*
|
||||
* Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0
|
||||
|
||||
Reference in New Issue
Block a user