[PATCH v1 6/6] hwmon: (peci/dimmtemp) Add support for Granite Rapids (GNR)

From: Changhuang Liang

Date: Thu Sep 03 2026 - 10:47:50 EST


Add support for Granite Rapids (GNR) platform in PECI DIMM temperature
monitoring driver.

The GNR platform has different DIMM topology from previous generations,
with 12 channel ranks (CHAN_RANK_MAX_ON_GNR) and 2 DIMM indexes per
channel. Define these new constants and update CHAN_RANK_MAX to use
the GNR value since it represents the maximum across all supported
platforms.

I am not sure whether it differs from previous models, but on GNR,
requests to read DIMM temperature thresholds (DIMM_TEMP_MAX/
DIMM_TEMP_CRIT) via PECI are rejected with completion code 0x90
(invalid request). To handle this, the read_thresholds callback is not
defined for GNR, and the visibility logic is updated to skip exposing
the max and crit temperature attributes when thresholds are not
supported.

The minimum PECI revision required for GNR is 0x40.

Signed-off-by: Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>
---
drivers/hwmon/peci/dimmtemp.c | 36 +++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/peci/dimmtemp.c b/drivers/hwmon/peci/dimmtemp.c
index bd3e8715dfec..9e98effeb928 100644
--- a/drivers/hwmon/peci/dimmtemp.c
+++ b/drivers/hwmon/peci/dimmtemp.c
@@ -34,8 +34,10 @@
#define DIMM_IDX_MAX_ON_SPR 2
#define CHAN_RANK_MAX_ON_EMR 8
#define DIMM_IDX_MAX_ON_EMR 2
+#define CHAN_RANK_MAX_ON_GNR 12
+#define DIMM_IDX_MAX_ON_GNR 2

-#define CHAN_RANK_MAX CHAN_RANK_MAX_ON_HSX
+#define CHAN_RANK_MAX CHAN_RANK_MAX_ON_GNR
#define DIMM_IDX_MAX DIMM_IDX_MAX_ON_HSX
#define DIMM_NUMS_MAX (CHAN_RANK_MAX * DIMM_IDX_MAX)

@@ -125,6 +127,9 @@ static int update_thresholds(struct peci_dimmtemp *priv, int dimm_no)
if (!peci_sensor_need_update(&priv->dimm[dimm_no].thresholds.state))
return 0;

+ if (!priv->gen_info->read_thresholds)
+ return -EOPNOTSUPP;
+
ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data);
if (ret)
return ret;
@@ -198,10 +203,18 @@ static umode_t dimmtemp_is_visible(const void *data, enum hwmon_sensor_types typ
{
const struct peci_dimmtemp *priv = data;

- if (test_bit(channel, priv->dimm_mask))
- return 0444;
+ if (!test_bit(channel, priv->dimm_mask))
+ return 0;

- return 0;
+ /*
+ * Some platforms do not provide the DIMM temperature thresholds over
+ * PECI - do not expose the corresponding attributes there.
+ */
+ if ((attr == hwmon_temp_max || attr == hwmon_temp_crit) &&
+ !priv->gen_info->read_thresholds)
+ return 0;
+
+ return 0444;
}

static const struct hwmon_ops peci_dimmtemp_ops = {
@@ -626,6 +639,17 @@ static const struct dimm_info dimm_emr = {
.read_thresholds = &read_thresholds_emr,
};

+static const struct dimm_info dimm_gnr = {
+ .chan_rank_max = CHAN_RANK_MAX_ON_GNR,
+ .dimm_idx_max = DIMM_IDX_MAX_ON_GNR,
+ .min_peci_revision = 0x40,
+ /*
+ * Reading DIMM_TEMP_MAX/DIMM_TEMP_CRIT over PECI is answered with
+ * completion code 0x90 (invalid request) on Granite Rapids, so the
+ * threshold attributes are not exposed on this platform.
+ */
+};
+
static const struct auxiliary_device_id peci_dimmtemp_ids[] = {
{
.name = "peci_cpu.dimmtemp.hsx",
@@ -659,6 +683,10 @@ static const struct auxiliary_device_id peci_dimmtemp_ids[] = {
.name = "peci_cpu.dimmtemp.emr",
.driver_data = (kernel_ulong_t)&dimm_emr,
},
+ {
+ .name = "peci_cpu.dimmtemp.gnr",
+ .driver_data = (kernel_ulong_t)&dimm_gnr,
+ },
{ }
};
MODULE_DEVICE_TABLE(auxiliary, peci_dimmtemp_ids);
--
2.25.1