Skip to contentSkip to conversation

hwmon: (peci/cputemp) Add Intel Sapphire Rapids support

PATCH In review Naresh Solanki 2 participants 3 messages Jul 10, 2023 – Jul 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (peci/cputemp) Add Intel Sapphire Rapids support

From: Patrick Rudolph <[email protected]>

Add support to read DTS for reading Intel Sapphire Rapids platform.

---
 drivers/hwmon/peci/cputemp.c | 18 ++++++++++++++++++
 drivers/peci/cpu.c           |  5 +++++
 2 files changed, 23 insertions(+)
drivers/hwmon/peci/cputemp.c +18 -0
index e5b65a382772..a812c15948d9 100644
@@ -363,6 +363,7 @@ static int init_core_mask(struct peci_cputemp *priv)
 	switch (peci_dev->info.model) {
 	case INTEL_FAM6_ICELAKE_X:
 	case INTEL_FAM6_ICELAKE_D:
+	case INTEL_FAM6_SAPPHIRERAPIDS_X:
 		ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev,
 					     reg->func, reg->offset + 4, &data);
 		if (ret)
@@ -531,6 +532,13 @@ static struct resolved_cores_reg resolved_cores_reg_icx = {
 	.offset = 0xd0,
 };
 
+static struct resolved_cores_reg resolved_cores_reg_spr = {
+	.bus = 31,
+	.dev = 30,
+	.func = 6,
+	.offset = 0x80,
+};
+
 static const struct cpu_info cpu_hsx = {
 	.reg		= &resolved_cores_reg_hsx,
 	.min_peci_revision = 0x33,
@@ -549,6 +557,12 @@ static const struct cpu_info cpu_icx = {
 	.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
 };
 
+static const struct cpu_info cpu_spr = {
+	.reg		= &resolved_cores_reg_spr,
+	.min_peci_revision = 0x40,
+	.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
+};
+
 static const struct auxiliary_device_id peci_cputemp_ids[] = {
 	{
 		.name = "peci_cpu.cputemp.hsx",
@@ -574,6 +588,10 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = {
 		.name = "peci_cpu.cputemp.icxd",
 		.driver_data = (kernel_ulong_t)&cpu_icx,
 	},
+	{
+		.name = "peci_cpu.cputemp.spr",
+		.driver_data = (kernel_ulong_t)&cpu_spr,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(auxiliary, peci_cputemp_ids);
drivers/peci/cpu.c +5 -0
index de4a7b3e5966..3668a908d259 100644
@@ -318,6 +318,11 @@ static const struct peci_device_id peci_cpu_device_ids[] = {
 		.model	= INTEL_FAM6_ICELAKE_X,
 		.data	= "icx",
 	},
+	{ /* Sapphire Rapids Xeon */
+		.family	= 6,
+		.model	= INTEL_FAM6_SAPPHIRERAPIDS_X,
+		.data	= "spr",
+	},
 	{ /* Icelake Xeon D */
 		.family	= 6,
 		.model	= INTEL_FAM6_ICELAKE_D,

base-commit: 4dbbaf8fbdbd13adc80731b2452257857e4c2d8b

Signature · 1 line
2.41.0
maintainer
#1 lore raw
Quoted 5 lines · Naresh Solanki

From: Patrick Rudolph <[email protected]>

Add support to read DTS for reading Intel Sapphire Rapids platform.

This patch touches code outside the hwmon subsystem, so I won't be able to apply it without Ack from a maintainer.

Guenter

Quoted 73 lines
---
  drivers/hwmon/peci/cputemp.c | 18 ++++++++++++++++++
  drivers/peci/cpu.c           |  5 +++++
  2 files changed, 23 insertions(+)
drivers/hwmon/peci/cputemp.c +18 -0
index e5b65a382772..a812c15948d9 100644
@@ -363,6 +363,7 @@ static int init_core_mask(struct peci_cputemp *priv)
  	switch (peci_dev->info.model) {
  	case INTEL_FAM6_ICELAKE_X:
  	case INTEL_FAM6_ICELAKE_D:
+	case INTEL_FAM6_SAPPHIRERAPIDS_X:
  		ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev,
  					     reg->func, reg->offset + 4, &data);
  		if (ret)
@@ -531,6 +532,13 @@ static struct resolved_cores_reg resolved_cores_reg_icx = {
  	.offset = 0xd0,
  };
 
+static struct resolved_cores_reg resolved_cores_reg_spr = {
+	.bus = 31,
+	.dev = 30,
+	.func = 6,
+	.offset = 0x80,
+};
+
  static const struct cpu_info cpu_hsx = {
  	.reg		= &resolved_cores_reg_hsx,
  	.min_peci_revision = 0x33,
@@ -549,6 +557,12 @@ static const struct cpu_info cpu_icx = {
  	.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
  };
 
+static const struct cpu_info cpu_spr = {
+	.reg		= &resolved_cores_reg_spr,
+	.min_peci_revision = 0x40,
+	.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
+};
+
  static const struct auxiliary_device_id peci_cputemp_ids[] = {
  	{
  		.name = "peci_cpu.cputemp.hsx",
@@ -574,6 +588,10 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = {
  		.name = "peci_cpu.cputemp.icxd",
  		.driver_data = (kernel_ulong_t)&cpu_icx,
  	},
+	{
+		.name = "peci_cpu.cputemp.spr",
+		.driver_data = (kernel_ulong_t)&cpu_spr,
+	},
  	{ }
  };
  MODULE_DEVICE_TABLE(auxiliary, peci_cputemp_ids);
drivers/peci/cpu.c +5 -0
index de4a7b3e5966..3668a908d259 100644
@@ -318,6 +318,11 @@ static const struct peci_device_id peci_cpu_device_ids[] = {
  		.model	= INTEL_FAM6_ICELAKE_X,
  		.data	= "icx",
  	},
+	{ /* Sapphire Rapids Xeon */
+		.family	= 6,
+		.model	= INTEL_FAM6_SAPPHIRERAPIDS_X,
+		.data	= "spr",
+	},
  	{ /* Icelake Xeon D */
  		.family	= 6,
  		.model	= INTEL_FAM6_ICELAKE_D,

base-commit: 4dbbaf8fbdbd13adc80731b2452257857e4c2d8b

#2 lore raw

Hi Guenter,

Quoted 10 lines · Guenter Roeck
Quoted 5 lines · Naresh Solanki

From: Patrick Rudolph <[email protected]>

Add support to read DTS for reading Intel Sapphire Rapids platform.

This patch touches code outside the hwmon subsystem, so I won't be able to apply it without Ack from a maintainer.

Yes. I'll split the patch & resubmit.
~Naresh

Quoted 77 lines

Guenter

Quoted 73 lines
---
  drivers/hwmon/peci/cputemp.c | 18 ++++++++++++++++++
  drivers/peci/cpu.c           |  5 +++++
  2 files changed, 23 insertions(+)
drivers/hwmon/peci/cputemp.c +18 -0
index e5b65a382772..a812c15948d9 100644
@@ -363,6 +363,7 @@ static int init_core_mask(struct peci_cputemp *priv)
      switch (peci_dev->info.model) {
      case INTEL_FAM6_ICELAKE_X:
      case INTEL_FAM6_ICELAKE_D:
+     case INTEL_FAM6_SAPPHIRERAPIDS_X:
              ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev,
                                           reg->func, reg->offset + 4, &data);
              if (ret)
@@ -531,6 +532,13 @@ static struct resolved_cores_reg resolved_cores_reg_icx = {
      .offset = 0xd0,
  };
 
+static struct resolved_cores_reg resolved_cores_reg_spr = {
+     .bus = 31,
+     .dev = 30,
+     .func = 6,
+     .offset = 0x80,
+};
+
  static const struct cpu_info cpu_hsx = {
      .reg            = &resolved_cores_reg_hsx,
      .min_peci_revision = 0x33,
@@ -549,6 +557,12 @@ static const struct cpu_info cpu_icx = {
      .thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
  };
 
+static const struct cpu_info cpu_spr = {
+     .reg            = &resolved_cores_reg_spr,
+     .min_peci_revision = 0x40,
+     .thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
+};
+
  static const struct auxiliary_device_id peci_cputemp_ids[] = {
      {
              .name = "peci_cpu.cputemp.hsx",
@@ -574,6 +588,10 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = {
              .name = "peci_cpu.cputemp.icxd",
              .driver_data = (kernel_ulong_t)&cpu_icx,
      },
+     {
+             .name = "peci_cpu.cputemp.spr",
+             .driver_data = (kernel_ulong_t)&cpu_spr,
+     },
      { }
  };
  MODULE_DEVICE_TABLE(auxiliary, peci_cputemp_ids);
drivers/peci/cpu.c +5 -0
index de4a7b3e5966..3668a908d259 100644
@@ -318,6 +318,11 @@ static const struct peci_device_id peci_cpu_device_ids[] = {
              .model  = INTEL_FAM6_ICELAKE_X,
              .data   = "icx",
      },
+     { /* Sapphire Rapids Xeon */
+             .family = 6,
+             .model  = INTEL_FAM6_SAPPHIRERAPIDS_X,
+             .data   = "spr",
+     },
      { /* Icelake Xeon D */
              .family = 6,
              .model  = INTEL_FAM6_ICELAKE_D,

base-commit: 4dbbaf8fbdbd13adc80731b2452257857e4c2d8b