[PATCH v2 5/6] hwmon: (peci/cputemp) Add support for Granite Rapids (GNR)

From: Changhuang Liang

Date: Mon Sep 28 2026 - 04:22:44 EST


Add Granite Rapids (GNR) CPU support to the PECI cputemp driver.

For Granite Rapids, the resolved cores mask must be collected from each
compute core. This implementation is relatively complex. Since we do not
use the resolved cores information for these CPUs, we can explicitly
state in the driver that the core mask is not supported for this model.

Define new cpu_info structure for GNR with minimum PECI revision 0x42 and
the thermal margin conversion function dts_ten_dot_six_to_millidegree().

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

diff --git a/drivers/hwmon/peci/cputemp.c b/drivers/hwmon/peci/cputemp.c
index 457089c561b4..69c4a07b99f7 100644
--- a/drivers/hwmon/peci/cputemp.c
+++ b/drivers/hwmon/peci/cputemp.c
@@ -339,6 +339,18 @@ static int init_core_mask(struct peci_cputemp *priv)
u32 data;
int ret;

+ /*
+ * For Granite Rapids, the resolved cores mask is relatively complex to implement.
+ * Since we do not use the resolved cores information for this CPU, the driver
+ * explicitly does not support the core mask for this model.
+ */
+ if (!reg) {
+ dev_dbg(priv->dev,
+ "resolved cores scan is not supported on vendor-family-model 0x%x\n",
+ peci_dev->info.x86_vfm);
+ return -EOPNOTSUPP;
+ }
+
/* Get the RESOLVED_CORES register value */
switch (peci_dev->info.x86_vfm) {
case INTEL_ICELAKE_X:
@@ -543,6 +555,11 @@ static const struct cpu_info cpu_emr = {
.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
};

+static const struct cpu_info cpu_gnr = {
+ .min_peci_revision = 0x42,
+ .thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
+};
+
static const struct auxiliary_device_id peci_cputemp_ids[] = {
{
.name = "peci_cpu.cputemp.hsx",
@@ -576,6 +593,10 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = {
.name = "peci_cpu.cputemp.emr",
.driver_data = (kernel_ulong_t)&cpu_emr,
},
+ {
+ .name = "peci_cpu.cputemp.gnr",
+ .driver_data = (kernel_ulong_t)&cpu_gnr,
+ },
{ }
};
MODULE_DEVICE_TABLE(auxiliary, peci_cputemp_ids);
--
2.25.1