Commit 8035d70c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'thermal-intel'

Merge updates of Intel thermal drivers for 6.20/7.0:

 - Add Panther Lake, Wildcat Lake and Nova Lake processor IDs to the
   list of supported processors in the intel_tcc_cooling thermal
   driver (Srinivas Pandruvada)

 - Drop unnecessary explicit driver data clearing on removal from the
   intel_pch_thermal driver (Kaushlendra Kumar)

 - Add support for "slow" workload type hints to the int340x
   processor_thermal driver and enable it on the Panther Lake
   platform (Srinivas Pandruvada)

 - Use sysfs_emit{_at}() in sysfs show functions in Intel thermal
   drivers (Thorsten Blum)

 - Update the x86_pkg_temp_thermal driver to handle THERMAL_TEMP_INVALID
   that can be passed to it via sysfs as expected (Rafael Wysocki)

 - Drop a redundant local variable from the intel_tcc_cooling thermal
   driver and fix a kerneldoc comment typo in the TCC library (Sumeet
   Pawnikar)

* thermal-intel:
  drivers: thermal: intel: tcc_cooling: Drop redundant local variable
  thermal: intel: x86_pkg_temp_thermal: Handle invalid temperature
  thermal: intel: Use sysfs_emit() in a sysfs show function
  thermal: intel: fix typo "nagative" in comment for cpu argument
  thermal: intel: int340x: Use sysfs_emit{_at}() in sysfs show functions
  thermal: intel: selftests: workload_hint: Support slow workload hints
  thermal: int340x: processor_thermal: Enable slow workload type hints
  thermal: intel: intel_pch_thermal: Drop explicit driver data clearing
  thermal: intel: intel_tcc_cooling: Add CPU models in the support list
parents 74dd4d1f 9eb9c350
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -375,6 +375,9 @@ based on the processor generation.
``workload_hint_enable`` (RW)
	Enable firmware to send workload type hints to user space.

``workload_slow_hint_enable`` (RW)
	Enable firmware to send slow workload type hints to user space.

``notification_delay_ms`` (RW)
	Minimum delay in milliseconds before firmware will notify OS. This is
	for the rate control of notifications. This delay is between changing
+3 −2
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/sysfs.h>
#include <linux/thermal.h>
#include <asm/msr.h>
#include "int340x_thermal_zone.h"
@@ -23,7 +24,7 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \
{ \
	struct proc_thermal_device *proc_dev = dev_get_drvdata(dev); \
	\
	return sprintf(buf, "%lu\n",\
	return sysfs_emit(buf, "%lu\n",\
	(unsigned long)proc_dev->power_limits[index].suffix * 1000); \
}

@@ -143,7 +144,7 @@ static ssize_t tcc_offset_degree_celsius_show(struct device *dev,
	if (offset < 0)
		return offset;

	return sprintf(buf, "%d\n", offset);
	return sysfs_emit(buf, "%d\n", offset);
}

static ssize_t tcc_offset_degree_celsius_store(struct device *dev,
+5 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/sysfs.h>
#include "processor_thermal_device.h"

MODULE_IMPORT_NS("INT340X_THERMAL");
@@ -211,9 +212,9 @@ static ssize_t suffix##_show(struct device *dev,\
	ret = (reg_val >> mmio_regs[ret].shift) & mmio_regs[ret].mask;\
	err = get_mapped_string(mapping, attr->attr.name, ret, &str);\
	if (!err)\
		return sprintf(buf, "%s\n", str);\
		return sysfs_emit(buf, "%s\n", str);\
	if (err == -EOPNOTSUPP)\
		return sprintf(buf, "%u\n", ret);\
		return sysfs_emit(buf, "%u\n", ret);\
	return err;\
}

@@ -398,7 +399,7 @@ static ssize_t rfi_restriction_show(struct device *dev,
	if (ret)
		return ret;

	return sprintf(buf, "%llu\n", resp);
	return sysfs_emit(buf, "%llu\n", resp);
}

static ssize_t ddr_data_rate_show(struct device *dev,
@@ -413,7 +414,7 @@ static ssize_t ddr_data_rate_show(struct device *dev,
	if (ret)
		return ret;

	return sprintf(buf, "%llu\n", resp);
	return sysfs_emit(buf, "%llu\n", resp);
}

static DEVICE_ATTR_RW(rfi_restriction);
+49 −8
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@

#define SOC_WT				GENMASK_ULL(47, 40)

#define SOC_WT_SLOW_PREDICTION_INT_ENABLE_BIT	22
#define SOC_WT_PREDICTION_INT_ENABLE_BIT	23

#define SOC_WT_PREDICTION_INT_ACTIVE	BIT(2)
@@ -47,6 +48,7 @@ static u16 notify_delay_ms = 1024;

static DEFINE_MUTEX(wt_lock);
static u8 wt_enable;
static u8 wt_slow_enable;

/* Show current predicted workload type index */
static ssize_t workload_type_index_show(struct device *dev,
@@ -59,7 +61,7 @@ static ssize_t workload_type_index_show(struct device *dev,
	int wt;

	mutex_lock(&wt_lock);
	if (!wt_enable) {
	if (!wt_enable && !wt_slow_enable) {
		mutex_unlock(&wt_lock);
		return -ENODATA;
	}
@@ -84,7 +86,7 @@ static ssize_t workload_hint_enable_show(struct device *dev,
	return sysfs_emit(buf, "%d\n", wt_enable);
}

static ssize_t workload_hint_enable_store(struct device *dev,
static ssize_t workload_hint_enable(struct device *dev, u8 enable_bit, u8 *status,
				    struct device_attribute *attr,
				    const char *buf, size_t size)
{
@@ -99,17 +101,17 @@ static ssize_t workload_hint_enable_store(struct device *dev,

	if (mode)
		ret = processor_thermal_mbox_interrupt_config(pdev, true,
							      SOC_WT_PREDICTION_INT_ENABLE_BIT,
							      enable_bit,
							      notify_delay);
	else
		ret = processor_thermal_mbox_interrupt_config(pdev, false,
							      SOC_WT_PREDICTION_INT_ENABLE_BIT, 0);
							      enable_bit, 0);

	if (ret)
		goto ret_enable_store;

	ret = size;
	wt_enable = mode;
	*status = mode;

ret_enable_store:
	mutex_unlock(&wt_lock);
@@ -117,8 +119,28 @@ static ssize_t workload_hint_enable_store(struct device *dev,
	return ret;
}

static ssize_t workload_hint_enable_store(struct device *dev, struct device_attribute *attr,
					  const char *buf, size_t size)
{
	return workload_hint_enable(dev, SOC_WT_PREDICTION_INT_ENABLE_BIT, &wt_enable,
				    attr, buf, size);
}
static DEVICE_ATTR_RW(workload_hint_enable);

static ssize_t workload_slow_hint_enable_show(struct device *dev, struct device_attribute *attr,
					       char *buf)
{
	return sysfs_emit(buf, "%d\n", wt_slow_enable);
}

static ssize_t workload_slow_hint_enable_store(struct device *dev, struct device_attribute *attr,
					       const char *buf, size_t size)
{
	return workload_hint_enable(dev, SOC_WT_SLOW_PREDICTION_INT_ENABLE_BIT, &wt_slow_enable,
				    attr, buf, size);
}
static DEVICE_ATTR_RW(workload_slow_hint_enable);

static ssize_t notification_delay_ms_show(struct device *dev,
					  struct device_attribute *attr,
					  char *buf)
@@ -178,16 +200,35 @@ static ssize_t notification_delay_ms_store(struct device *dev,

static DEVICE_ATTR_RW(notification_delay_ms);

static umode_t workload_hint_attr_visible(struct kobject *kobj, struct attribute *attr, int unused)
{
	if (attr != &dev_attr_workload_slow_hint_enable.attr)
		return attr->mode;

	switch (to_pci_dev(kobj_to_dev(kobj))->device) {
	case PCI_DEVICE_ID_INTEL_LNLM_THERMAL:
	case PCI_DEVICE_ID_INTEL_MTLP_THERMAL:
	case PCI_DEVICE_ID_INTEL_ARL_S_THERMAL:
		return 0;
	default:
		break;
	}

	return attr->mode;
}

static struct attribute *workload_hint_attrs[] = {
	&dev_attr_workload_type_index.attr,
	&dev_attr_workload_hint_enable.attr,
	&dev_attr_workload_slow_hint_enable.attr,
	&dev_attr_notification_delay_ms.attr,
	NULL
};

static const struct attribute_group workload_hint_attribute_group = {
	.attrs = workload_hint_attrs,
	.name = "workload_hint"
	.name = "workload_hint",
	.is_visible = workload_hint_attr_visible
};

/*
+4 −3
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
 */

#include <linux/pci.h>
#include <linux/sysfs.h>
#include "processor_thermal_device.h"

/* List of workload types */
@@ -28,9 +29,9 @@ static ssize_t workload_available_types_show(struct device *dev,
	int ret = 0;

	while (workload_types[i] != NULL)
		ret += sprintf(&buf[ret], "%s ", workload_types[i++]);
		ret += sysfs_emit_at(buf, ret, "%s ", workload_types[i++]);

	ret += sprintf(&buf[ret], "\n");
	ret += sysfs_emit_at(buf, ret, "\n");

	return ret;
}
@@ -85,7 +86,7 @@ static ssize_t workload_type_show(struct device *dev,
	if (cmd_resp > ARRAY_SIZE(workload_types) - 1)
		return -EINVAL;

	return sprintf(buf, "%s\n", workload_types[cmd_resp]);
	return sysfs_emit(buf, "%s\n", workload_types[cmd_resp]);
}

static DEVICE_ATTR_RW(workload_type);
Loading