* [PATCH 1/2] thermal: int340x: processor_thermal: Enable slow workload type hints
2025-12-18 22:25 [PATCH 0/2] thermal: int340x: Enable slow workload type hints Srinivas Pandruvada
@ 2025-12-18 22:25 ` Srinivas Pandruvada
2025-12-18 22:25 ` [PATCH 2/2] thermal: intel: selftests: workload_hint: Support slow workload hints Srinivas Pandruvada
2026-01-07 20:44 ` [PATCH 0/2] thermal: int340x: Enable slow workload type hints Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Pandruvada @ 2025-12-18 22:25 UTC (permalink / raw)
To: rafael, daniel.lezcano; +Cc: linux-pm, linux-kernel, Srinivas Pandruvada
On processors starting from Panther Lake additional hints are provided.
The hardware analyzes workload residencies over an extended period to
determine whether the workload classification tends toward idle/battery
life states or sustained/performance states. Based on this long-term
analysis, it classifies:
Power Classification: If the workload exhibits more idle or battery life
residencies, it is classified as "power". This is indicated by
setting the bit 4 of the current workload type.
Performance Classification: If the workload exhibits more sustained or
performance residencies, it is classified as "performance". This is
indicated by resetting the bit 4 of the current workload type.
This approach enables applications to ignore short-term workload
fluctuations and instead respond to longer-term power vs. performance
trends. This types of hints are called slow workload hints.
To get notifications for slow workload hints, a new bit 22 is added
to thermal mailbox to configure workload interrupts. This is possible
to exclusively only enable slow workload hints or enable in addition to
the current workload hints.
To enable slow workload hint a new attribute is added to the existing
workload hint attributes:
workload_slow_hint_enable (RW): Write 1 to enable, 0 to disable.
Reading this attribute shows the current state.
This attribute is not present any previous generation of processors.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../driver-api/thermal/intel_dptf.rst | 3 +
.../processor_thermal_wt_hint.c | 61 ++++++++++++++++---
2 files changed, 56 insertions(+), 8 deletions(-)
diff --git a/Documentation/driver-api/thermal/intel_dptf.rst b/Documentation/driver-api/thermal/intel_dptf.rst
index 916bf0f36a03..4adfa1eb74db 100644
--- a/Documentation/driver-api/thermal/intel_dptf.rst
+++ b/Documentation/driver-api/thermal/intel_dptf.rst
@@ -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
diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_wt_hint.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_wt_hint.c
index 68e8391af8f4..826775ad8f6c 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_wt_hint.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_wt_hint.c
@@ -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,9 +86,9 @@ 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,
- struct device_attribute *attr,
- const char *buf, size_t size)
+static ssize_t workload_hint_enable(struct device *dev, u8 enable_bit, u8 *status,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
{
struct pci_dev *pdev = to_pci_dev(dev);
u8 mode;
@@ -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,39 @@ 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)
+{
+ struct device *dev = kobj_to_dev(kobj);
+ struct pci_dev *pdev;
+
+ if (attr != &dev_attr_workload_slow_hint_enable.attr)
+ return attr->mode;
+
+ pdev = to_pci_dev(dev);
+ switch (pdev->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
};
/*
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] thermal: intel: selftests: workload_hint: Support slow workload hints
2025-12-18 22:25 [PATCH 0/2] thermal: int340x: Enable slow workload type hints Srinivas Pandruvada
2025-12-18 22:25 ` [PATCH 1/2] thermal: int340x: processor_thermal: " Srinivas Pandruvada
@ 2025-12-18 22:25 ` Srinivas Pandruvada
2026-01-07 20:44 ` [PATCH 0/2] thermal: int340x: Enable slow workload type hints Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Pandruvada @ 2025-12-18 22:25 UTC (permalink / raw)
To: rafael, daniel.lezcano; +Cc: linux-pm, linux-kernel, Srinivas Pandruvada
Add option to enable slow workload type hints. User can specify
"slow" as the command line argument to enable slow workload type hints.
There are two slow workload type hints: "power" and "performance".
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../intel/workload_hint/workload_hint_test.c | 74 +++++++++++++------
1 file changed, 52 insertions(+), 22 deletions(-)
diff --git a/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c b/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
index ca2bd03154e4..569d44f22835 100644
--- a/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
+++ b/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
@@ -12,6 +12,7 @@
#define WORKLOAD_NOTIFICATION_DELAY_ATTRIBUTE "/sys/bus/pci/devices/0000:00:04.0/workload_hint/notification_delay_ms"
#define WORKLOAD_ENABLE_ATTRIBUTE "/sys/bus/pci/devices/0000:00:04.0/workload_hint/workload_hint_enable"
+#define WORKLOAD_SLOW_ENABLE_ATTRIBUTE "/sys/bus/pci/devices/0000:00:04.0/workload_hint/workload_slow_hint_enable"
#define WORKLOAD_TYPE_INDEX_ATTRIBUTE "/sys/bus/pci/devices/0000:00:04.0/workload_hint/workload_type_index"
static const char * const workload_types[] = {
@@ -22,6 +23,9 @@ static const char * const workload_types[] = {
NULL
};
+static int wlt_slow;
+static char *wlt_enable_attr;
+
#define WORKLOAD_TYPE_MAX_INDEX 3
void workload_hint_exit(int signum)
@@ -30,7 +34,7 @@ void workload_hint_exit(int signum)
/* Disable feature via sysfs knob */
- fd = open(WORKLOAD_ENABLE_ATTRIBUTE, O_RDWR);
+ fd = open(wlt_enable_attr, O_RDWR);
if (fd < 0) {
perror("Unable to open workload type feature enable file");
exit(1);
@@ -46,6 +50,26 @@ void workload_hint_exit(int signum)
close(fd);
}
+static void update_delay(char *delay_str)
+{
+ int fd;
+
+ printf("Setting notification delay in ms to %s\n", delay_str);
+
+ fd = open(WORKLOAD_NOTIFICATION_DELAY_ATTRIBUTE, O_RDWR);
+ if (fd < 0) {
+ perror("Unable to open workload notification delay");
+ exit(1);
+ }
+
+ if (write(fd, delay_str, strlen(delay_str)) < 0) {
+ perror("Can't set delay");
+ exit(1);
+ }
+
+ close(fd);
+}
+
int main(int argc, char **argv)
{
struct pollfd ufd;
@@ -54,32 +78,26 @@ int main(int argc, char **argv)
char delay_str[64];
int delay = 0;
- printf("Usage: workload_hint_test [notification delay in milli seconds]\n");
+ printf("Usage: workload_hint_test [notification delay in milli seconds][slow]\n");
if (argc > 1) {
- ret = sscanf(argv[1], "%d", &delay);
- if (ret < 0) {
- printf("Invalid delay\n");
- exit(1);
- }
+ int i;
- printf("Setting notification delay to %d ms\n", delay);
- if (delay < 0)
- exit(1);
+ for (i = 1; i < argc; ++i) {
+ if (!strcmp(argv[i], "slow")) {
+ wlt_slow = 1;
+ continue;
+ }
- sprintf(delay_str, "%s\n", argv[1]);
- fd = open(WORKLOAD_NOTIFICATION_DELAY_ATTRIBUTE, O_RDWR);
- if (fd < 0) {
- perror("Unable to open workload notification delay");
- exit(1);
- }
+ ret = sscanf(argv[1], "%d", &delay);
+ if (ret < 0) {
+ printf("Invalid delay\n");
+ exit(1);
+ }
- if (write(fd, delay_str, strlen(delay_str)) < 0) {
- perror("Can't set delay");
- exit(1);
+ sprintf(delay_str, "%s\n", argv[1]);
+ update_delay(delay_str);
}
-
- close(fd);
}
if (signal(SIGINT, workload_hint_exit) == SIG_IGN)
@@ -89,8 +107,13 @@ int main(int argc, char **argv)
if (signal(SIGTERM, workload_hint_exit) == SIG_IGN)
signal(SIGTERM, SIG_IGN);
+ if (wlt_slow)
+ wlt_enable_attr = WORKLOAD_SLOW_ENABLE_ATTRIBUTE;
+ else
+ wlt_enable_attr = WORKLOAD_ENABLE_ATTRIBUTE;
+
/* Enable feature via sysfs knob */
- fd = open(WORKLOAD_ENABLE_ATTRIBUTE, O_RDWR);
+ fd = open(wlt_enable_attr, O_RDWR);
if (fd < 0) {
perror("Unable to open workload type feature enable file");
exit(1);
@@ -145,6 +168,13 @@ int main(int argc, char **argv)
if (ret < 0)
break;
+ if (wlt_slow) {
+ if (index & 0x10)
+ printf("workload type slow:%s\n", "power");
+ else
+ printf("workload type slow:%s\n", "performance");
+ }
+
index &= 0x0f;
if (index > WORKLOAD_TYPE_MAX_INDEX)
printf("Invalid workload type index\n");
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread