Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 00/10] drm/xe/hwmon: Add fan control support
@ 2026-11-30 18:50 Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

This series adds Intel Xe fan control through the hwmon sysfs ABI: fan
maximum speed, direct PWM control, mode selection and programmable fan
curves. Supported platforms are BMG in this series.

Each fan has a stock table read from firmware and a user table cached in
the driver and written back through PCODE.

Series overview

 01 Initialize fan-control backend and table cache
    Read the fan enable mask and stock fan tables.
 02 Expose fanN_max
    Maximum fan speed in RPM.
 03 Add ordered write batch helper
    PCODE helper that writes a fan table without interleaved mailbox
    commands.
 04 Expose pwm[1-3]
    Constant duty cycle in the hwmon 0..255 range.
 05 Expose pwm[1-3]_enable
    0 = full speed, 1 = manual user table, 2 = firmware automatic.
 06 Enable fan curve control support
    pwm[1-3]_auto_point[1-10]_{temp,pwm}.
 07 Restore fan user tables after resume
 08 Refresh fan data after late binding
 09 Expose tjmax_fan_control_enable device sysfs
 10 Add kernel-doc for fan control

The ABI is documented in
Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon and
Documentation/ABI/testing/sysfs-driver-intel-xe-gpu.

Usage

Read fan speed and max RPM:
  cat /sys/class/hwmon/hwmonX/fan1_input
  cat /sys/class/hwmon/hwmonX/fan1_max

Manual mode with a fixed PWM:
  echo 1 > /sys/class/hwmon/hwmonX/pwm1_enable
  echo 120 > /sys/class/hwmon/hwmonX/pwm1

Back to firmware automatic control:
  echo 2 > /sys/class/hwmon/hwmonX/pwm1_enable

Program a 3-point fan curve:
  echo 1 > /sys/class/hwmon/hwmonX/pwm1_enable
  echo 30000 > /sys/class/hwmon/hwmonX/pwm1_auto_point1_temp
  echo 50 > /sys/class/hwmon/hwmonX/pwm1_auto_point1_pwm
  echo 60000 > /sys/class/hwmon/hwmonX/pwm1_auto_point2_temp
  echo 120 > /sys/class/hwmon/hwmonX/pwm1_auto_point2_pwm
  echo 85000 > /sys/class/hwmon/hwmonX/pwm1_auto_point3_temp
  echo 200 > /sys/class/hwmon/hwmonX/pwm1_auto_point3_pwm
  echo 0 > /sys/class/hwmon/hwmonX/pwm1_auto_point4_temp
  echo 0 > /sys/class/hwmon/hwmonX/pwm1_auto_point4_pwm

Notes
 - Package temperature (temp2_input) is the fan table temperature
   reference.
 - Fans start in pwmN_enable = 2 after probe. pwmN and curve point
   writes need pwmN_enable = 1.
 - A curve has 2 to 10 points. Temperature must increase and PWM must
   not decrease from one point to the next.
 - Curve writes are staged and committed once point K+1 is (0, 0) or
   all 10 points are set. A completing write that fails drops all
   staged points.
 - The user curve is kept across pwmN_enable 0 and 2 and re-applied
   when switching back to 1.
 - If firmware does not accept a user table, the fan falls back to
   pwmN_enable = 2.

v2:
 - Add kernel-doc for fan control.
 - Save/restore the user fan table across suspend/resume.
 - Refresh fan info after late binding; keep the user's PWM mode.
 - Show stock table points in the curve attributes when pwmN_enable = 2.

v3:
 - Address v2 review comments.
 - Add an ordered PCODE write batch helper.
 - Support a variable number of fan curve points.
 - Add missing failure checks.
 - Use only 2 fan curve points when setting pwmN.

v4:
 - Address v3 https://patchwork.freedesktop.org/series/176241/ review
   comments. (Soham)
 - Clamp oversized fan masks and stock tables; continue when one fan's
   stock table fails to read.
 - Clear cached values on failed pcode reads.
 - Use percent for fan speed and clamp min PWM to 100%.
 - Fail pwmN writes if pcode reports the wrong user point count.
 - Create fan curve attributes at probe time; add the (0, 0) end
   marker; points must not decrease.
 - Document pwmN_enable values and the curve rules.
 - Call the system PM hooks from xe_device_suspend()/xe_device_resume(),
   which also covers FLR; check d3cold only for runtime PM.
 - Fix the late binding firmware ID check; start fans enabled after
   late binding in automatic mode.
 - Rebase on drm-xe-next; update the ABI Date and KernelVersion.

v5:
 - Address review comments on v4 patch
   https://patchwork.freedesktop.org/series/179435/ from sashiko.
 - Add new sysfs tjmax_fan_control_enable for enable/disable of
   tjmax fan control.
 - Move CRI fan control support out of this patch series.
 - Add kgdoc patch at the end of the patch series.

v6:
 - Address v5 https://patchwork.freedesktop.org/series/179435/ review
   comments. (Soham, sashiko)
 - Report the active PWM from pwmN: PMT on BMG, otherwise interpolated
   from the active fan table; 100 in full speed mode; -ENODATA while
   the fan control mode is not established.
 - Keep the cached user curve across pwmN_enable 0 and 2; full speed
   no longer overwrites it. Remove the redundant is_full_speed flag.
 - Write and verify all user tables through one helper that falls back
   to stock control on failure. Reject tables with fewer than two
   points or non-increasing temperatures before writing to firmware.
 - Hide pwmN_auto_point* without a stock table, return -ENODATA from
   them while the mode is not established, and document them in the
   ABI. Keep staged curve points when the user table is re-applied.
 - Explain why fan table writes must not be interleaved with other
   mailbox commands, and the pcode lock hold time.
 - Do not flush the late binding work from resume, which could deadlock
   against the MEI device resume.
 - Keep the previous stock table and max RPM if the refresh after late
   binding fails; re-program user tables of fans in manual or full
   speed mode after late binding.
 - Unregister the hwmon device outside registration_lock to avoid a
   deadlock with late binding work.
 - tjmax_fan_control_enable: do not expose on SR-IOV VFs, report only
   the enable bit, drop the probe-time visibility read and use one
   wording in the commit message, ABI and DOC comment.
 - Align enum kernel-doc with the ABI, add debug logs before -EINVAL
   returns and use "late binding" consistently.
 - Update the fan ABI Date to December 2026.

Karthik Poosa (10):
  drm/xe/hwmon: Initialize fan-control backend and table cache
  drm/xe/hwmon: Expose fanN_max
  drm/xe/pcode: Add ordered write batch helper
  drm/xe/hwmon: Expose pwm[1-3]
  drm/xe/hwmon: Expose pwm[1-3]_enable
  drm/xe/hwmon: Enable fan curve control support
  drm/xe/hwmon: Restore fan user tables after resume
  drm/xe/hwmon: Refresh fan data after late binding
  drm/xe: Expose tjmax_fan_control_enable device sysfs
  drm/xe/hwmon: Add kernel-doc for fan control

 .../ABI/testing/sysfs-driver-intel-xe-gpu     |   20 +
 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |   82 ++
 drivers/gpu/drm/xe/regs/xe_pmt.h              |    5 +
 drivers/gpu/drm/xe/xe_device.c                |    3 +
 drivers/gpu/drm/xe/xe_device_sysfs.c          |   62 +
 drivers/gpu/drm/xe/xe_hwmon.c                 | 1278 ++++++++++++++++-
 drivers/gpu/drm/xe/xe_hwmon.h                 |    6 +
 drivers/gpu/drm/xe/xe_late_bind_fw.c          |    3 +
 drivers/gpu/drm/xe/xe_pcode.c                 |   49 +
 drivers/gpu/drm/xe/xe_pcode.h                 |   12 +
 drivers/gpu/drm/xe/xe_pcode_api.h             |   11 +
 drivers/gpu/drm/xe/xe_pm.c                    |   11 +-
 12 files changed, 1513 insertions(+), 29 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 19:04   ` sashiko-bot
  2026-11-30 18:50 ` [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Initialize Xe hwmon fan-control support by detecting enabled fans,
reading stock fan control points and min PWM.

FSC_READ_NUM_FANS returns a bitmask of enabled fans, so use it as a mask
when exposing fanN_input.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Avoid user table initialization during probe. (Badal)
 - Move unused code to appropriate patches.
 - Use xe helpers for dmesg logs.

v3:
 - Rebase.
 - Refine a few debug log messages and comments.
 - Update xe_hwmon_read_fan_control_info() to return on any stock table
   read failures.
 - Avoid returning when num_fans is 0 in
   xe_hwmon_get_preregistration_info(), ensuring thermal mailbox
   initialization is not skipped.
 - Remove XE_PCODE_FAN_CONTROL_TIMEOUT_MS which is unnecessary as default
   timeout itself is now 10ms.
 - Use xe_pcode_read() instead of xe_pcode_read_timeout().
 - Rename fan_control_point_count to point_count in struct fan_table.
 - Resolve kernel-doc warnings.
 - Add valid check for stock table fan point count.
 - Use the fan-enable bitmap reported by FSC_READ_NUM_FANS when enumerating
   fans. This avoids assuming contiguous fan indices and allows masks with
   gaps to be represented correctly in the hwmon interface.

v4:
 - Clamp unsupported fan masks and oversized stock tables instead of
   failing initialization. (Soham)
 - On stock table read failure, mark that fan's table empty and continue
   with the remaining fans; fan_input stays visible. (Soham)
 - Clear fan enable mask and min PWM on pcode read failure. (Soham)
 - Fix FCP_INDEX() type safety and clean up macro usage. (Soham)
 - Use xe_hwmon_pcode_read_fan_control() for fan mailbox reads. (Soham)
 - Fix kernel-doc for fan_table_type and nested fan_table members.
 - Skip min PWM read for fans without a stock table.
 - Make xe_hwmon_get_fan_enable_mask() return void.

v5:
 - Remove min_pwm as it is no longer supported by the hardware.
 - Change xe_hwmon_get_fan_enable_mask() return type from void to int.
 - Copy the stock table to the fan info only if all points are read
   successfully.

v6:
 - Avoid the err variable in xe_hwmon_read_fan_control_info(). (Soham)
 - Maintain alphabetical ordering for #include "xe_printk.h". (Soham)
 - Fix parenthesis alignment in xe_hwmon_pcode_read_fan_control(). (Soham)

 drivers/gpu/drm/xe/xe_hwmon.c     | 161 +++++++++++++++++++++++++++---
 drivers/gpu/drm/xe/xe_pcode_api.h |   4 +
 2 files changed, 150 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 717845b7e6a1..508219b2d604 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -20,6 +20,7 @@
 #include "xe_mmio.h"
 #include "xe_pcode.h"
 #include "xe_pcode_api.h"
+#include "xe_printk.h"
 #include "xe_sriov.h"
 #include "xe_pm.h"
 #include "xe_vsec.h"
@@ -139,13 +140,51 @@ struct xe_hwmon_energy_info {
 };
 
 /**
- * struct xe_hwmon_fan_info - to cache previous fan reading
+ * enum fan_table_type - fan table types tracked per fan
+ */
+enum fan_table_type {
+	/** @STOCK_FAN_TABLE: firmware-provided fan table */
+	STOCK_FAN_TABLE,
+	/** @USER_FAN_TABLE: user fan table written through sysfs */
+	USER_FAN_TABLE,
+	/** @FAN_TABLE_MAX: number of fan tables tracked per fan */
+	FAN_TABLE_MAX,
+};
+
+/* Check if a fan is enabled based on the fan_enable_mask got from FSC_READ_NUM_FANS. */
+#define IS_FAN_ENABLED(hwmon, fan) ((hwmon)->fan_enable_mask & BIT(fan))
+
+/* Maximum number of fan control points supported by each fan. */
+#define MAX_FAN_CONTROL_POINTS	10
+
+/* Fan control point index: bit31 selects fan table type; bits30:0 control point index. */
+#define FCP_INDEX(table_type, point_num) (((u32)(table_type) << 31) | \
+						((u32)(point_num) & GENMASK(30, 0)))
+
+/**
+ * struct xe_hwmon_fan_info - cached fan telemetry and control state
+ *
+ * Each fan keeps the latest tachometer sampling state along with two fan
+ * tables: the stock table discovered from firmware and the user table managed
+ * by hwmon sysfs writes.
  */
 struct xe_hwmon_fan_info {
 	/** @reg_val_prev: previous fan reg val */
 	u32 reg_val_prev;
 	/** @time_prev: previous timestamp */
 	u64 time_prev;
+	/** @fan_table: fan control tables */
+	struct fan_table {
+		/** @fan_table.point_count: number of fan control points */
+		u8 point_count;
+		/** @fan_table.fcp: array of fan control points */
+		struct fan_control_point {
+			/** @fan_table.fcp.temp: temperature in degree celsius */
+			u8 temp;
+			/** @fan_table.fcp.speed: fan speed in percentage */
+			u8 speed;
+		} fcp[MAX_FAN_CONTROL_POINTS];
+	} fan_table[FAN_TABLE_MAX];
 };
 
 /**
@@ -194,6 +233,8 @@ struct xe_hwmon {
 	int scl_shift_time;
 	/** @ei: Energy info for energyN_input */
 	struct xe_hwmon_energy_info ei[CHANNEL_MAX];
+	/** @fan_enable_mask: bitmask of available fans */
+	u32 fan_enable_mask;
 	/** @fi: Fan info for fanN_input */
 	struct xe_hwmon_fan_info fi[FAN_MAX];
 	/** @read_power_limit_from_pcode: pcode accepted power limits write for the channel */
@@ -1084,17 +1125,105 @@ static int xe_hwmon_pcode_write_i1(const struct xe_hwmon *hwmon, u32 uval)
 			      (uval & POWER_SETUP_I1_DATA_MASK));
 }
 
-static int xe_hwmon_pcode_read_fan_control(const struct xe_hwmon *hwmon, u32 subcmd, u32 *uval)
+static int xe_hwmon_pcode_read_fan_control(const struct xe_hwmon *hwmon, u32 subcmd, u8 fan_num,
+					   u32 *uval)
 {
 	struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
 
+	return xe_pcode_read(root_tile, PCODE_MBOX(FAN_SPEED_CONTROL, subcmd, fan_num), uval, NULL);
+}
+
+static int xe_hwmon_get_fan_enable_mask(struct xe_hwmon *hwmon)
+{
+	int ret;
+
 	/* Platforms that don't return correct value */
-	if (hwmon->xe->info.platform == XE_DG2 && subcmd == FSC_READ_NUM_FANS) {
-		*uval = 2;
+	if (hwmon->xe->info.platform == XE_DG2) {
+		hwmon->fan_enable_mask = GENMASK(1, 0);
 		return 0;
 	}
 
-	return xe_pcode_read(root_tile, PCODE_MBOX(FAN_SPEED_CONTROL, subcmd, 0), uval, NULL);
+	ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_NUM_FANS, 0,
+					      &hwmon->fan_enable_mask);
+	if (ret) {
+		hwmon->fan_enable_mask = 0;
+		xe_warn(hwmon->xe, "failed to read number of fans, ret=%d\n", ret);
+		return ret;
+	}
+
+	/* Check if fan mask exceeds FAN_MAX and log a warning if it does */
+	if (hwmon->fan_enable_mask & ~GENMASK(FAN_MAX - 1, 0)) {
+		xe_warn(hwmon->xe, "Fan enable mask exceeds %d supported fans, clamping\n",
+			FAN_MAX);
+		hwmon->fan_enable_mask &= GENMASK(FAN_MAX - 1, 0);
+	}
+
+	xe_info(hwmon->xe, "Number of fans detected: %u\n", hweight32(hwmon->fan_enable_mask));
+
+	return 0;
+}
+
+static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
+{
+	int point;
+	int fan;
+	int ret = 0;
+
+	for (fan = 0; fan < FAN_MAX; fan++) {
+		struct fan_control_point stock_fcp[MAX_FAN_CONTROL_POINTS];
+		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+		u32 stock_fcp_count = 0;
+
+		if (!IS_FAN_ENABLED(hwmon, fan))
+			continue;
+
+		ret = xe_hwmon_pcode_read_fan_control(hwmon,
+						      FSC_READ_STOCK_FAN_CONTROL_POINTS,
+						      fan, &stock_fcp_count);
+		if (ret || !stock_fcp_count) {
+			xe_warn(hwmon->xe,
+				"fan %d stock table unavailable, ret=%d, point count=%u\n",
+				fan, ret, ret ? 0 : stock_fcp_count);
+			continue;
+		}
+
+		if (stock_fcp_count > MAX_FAN_CONTROL_POINTS) {
+			xe_warn(hwmon->xe,
+				"fan %d stock table point count %u exceeds maximum %u, clamping\n",
+				fan, stock_fcp_count, MAX_FAN_CONTROL_POINTS);
+			stock_fcp_count = MAX_FAN_CONTROL_POINTS;
+		}
+
+		xe_dbg(hwmon->xe, "fan %d stock table point count is %u\n", fan, stock_fcp_count);
+
+		/* Cache the stock fan table for later use. */
+		for (point = 0; point < stock_fcp_count; point++) {
+			u32 fcp = FCP_INDEX(STOCK_FAN_TABLE, point);
+
+			ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_FAN_TABLE, fan, &fcp);
+			if (ret) {
+				xe_warn(hwmon->xe, "failed to read fan %d stock point %d, ret=%d\n",
+					fan, point, ret);
+				break;
+			}
+
+			stock_fcp[point].temp =	REG_FIELD_GET(FAN_CONTROL_POINT_TEMP_MASK, fcp);
+			stock_fcp[point].speed = REG_FIELD_GET(FAN_CONTROL_POINT_SPEED_MASK, fcp);
+			xe_dbg(hwmon->xe, "fan %d stock point %d: temp %u C, speed %u %%\n",
+			       fan, point, stock_fcp[point].temp, stock_fcp[point].speed);
+		}
+
+		if (point < stock_fcp_count) {
+			xe_warn(hwmon->xe, "fan %d stock table incomplete, expected %u points, got %d\n",
+				fan, stock_fcp_count, point);
+			continue;
+		}
+
+		memcpy(fi->fan_table[STOCK_FAN_TABLE].fcp, stock_fcp,
+		       stock_fcp_count * sizeof(stock_fcp[0]));
+		fi->fan_table[STOCK_FAN_TABLE].point_count = stock_fcp_count;
+	}
+	return ret;
 }
 
 static int xe_hwmon_power_curr_crit_read(struct xe_hwmon *hwmon, int channel,
@@ -1632,17 +1761,12 @@ xe_hwmon_energy_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 static umode_t
 xe_hwmon_fan_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
 {
-	u32 uval = 0;
-
 	if (!hwmon->xe->info.has_fan_control)
 		return 0;
 
 	switch (attr) {
 	case hwmon_fan_input:
-		if (xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_NUM_FANS, &uval))
-			return 0;
-
-		return channel < uval ? 0444 : 0;
+		return IS_FAN_ENABLED(hwmon, channel) ? 0444 : 0;
 	default:
 		return 0;
 	}
@@ -1876,11 +2000,18 @@ xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon)
 		if (xe_hwmon_is_visible(hwmon, hwmon_energy, hwmon_energy_input, channel))
 			xe_hwmon_energy_get(hwmon, channel, &energy);
 
-	/* Initialize 'struct xe_hwmon_fan_info' with initial fan register reading. */
-	for (channel = 0; channel < FAN_MAX; channel++)
-		if (xe_hwmon_is_visible(hwmon, hwmon_fan, hwmon_fan_input, channel))
-			xe_hwmon_fan_input_read(hwmon, channel, &fan_speed);
+	if (hwmon->xe->info.has_fan_control) {
+		xe_hwmon_get_fan_enable_mask(hwmon);
+
+		/* Initialize 'struct xe_hwmon_fan_info' with initial fan register reading. */
+		for (channel = 0; channel < FAN_MAX; channel++)
+			if (IS_FAN_ENABLED(hwmon, channel))
+				xe_hwmon_fan_input_read(hwmon, channel, &fan_speed);
 
+		/* Fan control tables initialization */
+		if (xe_hwmon_read_fan_control_info(hwmon))
+			xe_warn(hwmon->xe, "Fan control tables are not available\n");
+	}
 	return xe_hwmon_init_temp_info(hwmon);
 }
 
diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h
index f05846931059..387885760205 100644
--- a/drivers/gpu/drm/xe/xe_pcode_api.h
+++ b/drivers/gpu/drm/xe/xe_pcode_api.h
@@ -87,6 +87,10 @@
 
 #define   FAN_SPEED_CONTROL			0x7D
 #define     FSC_READ_NUM_FANS			0x4
+#define     FSC_READ_STOCK_FAN_CONTROL_POINTS	0x5
+#define     FSC_READ_FAN_TABLE			0x7
+#define     FAN_CONTROL_POINT_TEMP_MASK		REG_GENMASK(7, 0)
+#define     FAN_CONTROL_POINT_SPEED_MASK	REG_GENMASK(15, 8)
 
 #define PCODE_SCRATCH(x)		XE_REG(0x138320 + ((x) * 4))
 /* PCODE_SCRATCH0 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Expose fan maximum RPM via fanN_max.

The value is derived from the firmware-reported maximum fan RPS and
converted to RPM in the fan hwmon read path.

Update Xe hwmon ABI documentation for fanN_max.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---
 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  8 ++++++++
 drivers/gpu/drm/xe/xe_hwmon.c                 | 20 ++++++++++++++++++-
 drivers/gpu/drm/xe/xe_pcode_api.h             |  1 +
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
index 2bb78a503f46..ac9ccfd47eab 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
@@ -266,6 +266,14 @@ Description:	RO. Fan 3 speed in RPM.
 
 		Only supported for particular Intel Xe graphics platforms.
 
+What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/fan[1-3]_max
+Date:		December 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:	RO. Maximum fan speed in RPM for each fan channel.
+
+		Only supported for particular Intel Xe graphics platforms.
+
 What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap
 Date:		May 2025
 KernelVersion:	6.15
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 508219b2d604..4822a1c81cd7 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -185,6 +185,8 @@ struct xe_hwmon_fan_info {
 			u8 speed;
 		} fcp[MAX_FAN_CONTROL_POINTS];
 	} fan_table[FAN_TABLE_MAX];
+	/** @max_rps: maximum fan RPS */
+	u32 max_rps;
 };
 
 /**
@@ -919,7 +921,8 @@ static const struct hwmon_channel_info * const hwmon_info[] = {
 	HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | HWMON_C_LABEL),
 	HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL),
 	HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL),
-	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, HWMON_F_INPUT, HWMON_F_INPUT),
+	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_MAX, HWMON_F_INPUT | HWMON_F_MAX,
+			   HWMON_F_INPUT | HWMON_F_MAX),
 	NULL
 };
 
@@ -1169,6 +1172,7 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 	int fan;
 	int ret = 0;
 
+	/* Stock table failures leave fan_input and fan_max visible; they don't need it. */
 	for (fan = 0; fan < FAN_MAX; fan++) {
 		struct fan_control_point stock_fcp[MAX_FAN_CONTROL_POINTS];
 		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
@@ -1177,6 +1181,15 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 		if (!IS_FAN_ENABLED(hwmon, fan))
 			continue;
 
+		ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_MAX_FAN_RPS, fan,
+						      &fi->max_rps);
+		if (ret) {
+			fi->max_rps = 0;
+			xe_warn(hwmon->xe, "failed to read fan %d max RPS, ret=%d\n", fan, ret);
+		} else {
+			xe_dbg(hwmon->xe, "fan %d max RPS %u\n", fan, fi->max_rps);
+		}
+
 		ret = xe_hwmon_pcode_read_fan_control(hwmon,
 						      FSC_READ_STOCK_FAN_CONTROL_POINTS,
 						      fan, &stock_fcp_count);
@@ -1767,6 +1780,8 @@ xe_hwmon_fan_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
 	switch (attr) {
 	case hwmon_fan_input:
 		return IS_FAN_ENABLED(hwmon, channel) ? 0444 : 0;
+	case hwmon_fan_max:
+		return IS_FAN_ENABLED(hwmon, channel) && hwmon->fi[channel].max_rps ? 0444 : 0;
 	default:
 		return 0;
 	}
@@ -1817,6 +1832,9 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 	switch (attr) {
 	case hwmon_fan_input:
 		return xe_hwmon_fan_input_read(hwmon, channel, val);
+	case hwmon_fan_max:
+		*val = mul_u32_u32(hwmon->fi[channel].max_rps, 60);
+		return 0;
 	default:
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h
index 387885760205..2308e5464082 100644
--- a/drivers/gpu/drm/xe/xe_pcode_api.h
+++ b/drivers/gpu/drm/xe/xe_pcode_api.h
@@ -86,6 +86,7 @@
 #define     MEMORY_CONFIG_SUBCOMMAND_READ_MAX_FREQUENCY 0x1
 
 #define   FAN_SPEED_CONTROL			0x7D
+#define     FSC_READ_MAX_FAN_RPS		0x3
 #define     FSC_READ_NUM_FANS			0x4
 #define     FSC_READ_STOCK_FAN_CONTROL_POINTS	0x5
 #define     FSC_READ_FAN_TABLE			0x7
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 20:59   ` Rodrigo Vivi
  2026-11-30 18:50 ` [PATCH v6 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Add a pcode helper that issues an ordered sequence of mailbox writes
while holding the pcode lock, so no other mailbox command can be
interleaved.

Some pcode interfaces keep state across mailbox commands. A fan table is
written one point at a time with FSC_WRITE_FAN_TABLE and loaded by a
final FSC_WRITE_NUM_FAN_CONTROL_POINTS write. pcode does not tie the
staged points to a requester, so fan table writes from another caller
in the middle of the sequence can be merged into it, and the commit then
either fails with illegal data or loads a wrong table.

Serialize all fan control table writes, for every fan, on the pcode
lock rather than per fan. Caller-side locks such as the hwmon lock only
order callers that take them; the pcode lock orders every mailbox user
in the driver.

Lock hold time is the sum of the pcode response times of the batch. Each
write is bounded by PCODE_DEFAULT_TIMEOUT_MS, and a write that times out
ends the batch, so the worst case is count * PCODE_DEFAULT_TIMEOUT_MS
(110 ms for the largest fan table of 10 points plus the count write).
Other pcode users wait on the lock with mutex_lock() and start their own
mailbox timeout only after acquiring it, so a batch delays them but does
not make them time out. This is in line with existing pcode lock users:
xe_pcode_request() holds the lock for up to its base timeout plus 50 ms,
and xe_pcode_init_min_freq_table() holds it across a loop of writes.

This will be used to write fan tables atomically with respect to other
pcode users.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Explain why pcode needs the writes without interleaving, and the
   lock hold time impact on other pcode users. (sashiko)

 drivers/gpu/drm/xe/xe_pcode.c | 49 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_pcode.h | 12 +++++++++
 2 files changed, 61 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
index fa9f45d565cb..f465decbf946 100644
--- a/drivers/gpu/drm/xe/xe_pcode.c
+++ b/drivers/gpu/drm/xe/xe_pcode.c
@@ -124,6 +124,55 @@ int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 data, int timeout
 	return err;
 }
 
+/**
+ * xe_pcode_write_batch - issue pcode writes in order under the mailbox lock
+ * @tile: tile
+ * @writes: mailbox/data pairs to write
+ * @count: number of entries in @writes
+ *
+ * Some pcode interfaces keep state across mailbox commands; e.g. a fan table
+ * is written point by point and loaded by a final point count write. Holding
+ * the pcode lock across all writes keeps each such sequence atomic with
+ * respect to every other mailbox user, including fan table writes for any
+ * other fan, independent of caller-side locks.
+ *
+ * The lock is held for the sum of the pcode response times, bounded by
+ * @count * PCODE_DEFAULT_TIMEOUT_MS; a write that times out ends the batch.
+ * Other pcode users sleep on the lock and start their own mailbox timeout only
+ * once they own it, so they are delayed but do not time out. Keep @count small.
+ *
+ * Stops at the first failure; earlier writes are not reverted.
+ *
+ * Context: Process context. Takes and releases the pcode lock.
+ * Return: 0 on success, negative error code otherwise.
+ */
+int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
+			 unsigned int count)
+{
+	unsigned int i;
+	int err = 0;
+
+	if (!count)
+		return -EINVAL;
+
+	mutex_lock(&tile->pcode.lock);
+	for (i = 0; i < count; i++) {
+		u32 data = writes[i].data;
+
+		err = pcode_mailbox_rw(tile, writes[i].mbox, &data, NULL, PCODE_DEFAULT_TIMEOUT_MS,
+				       false, false);
+		if (err) {
+			xe_err(tile_to_xe(tile),
+			       "pcode batch write %u/%u failed: mbox 0x%08x data 0x%08x, ret %pe\n",
+			       i + 1, count, writes[i].mbox, writes[i].data, ERR_PTR(err));
+			break;
+		}
+	}
+	mutex_unlock(&tile->pcode.lock);
+
+	return err;
+}
+
 int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0, u32 data1, int timeout)
 {
 	int err;
diff --git a/drivers/gpu/drm/xe/xe_pcode.h b/drivers/gpu/drm/xe/xe_pcode.h
index 7e43792b0037..c601a12baba6 100644
--- a/drivers/gpu/drm/xe/xe_pcode.h
+++ b/drivers/gpu/drm/xe/xe_pcode.h
@@ -18,6 +18,16 @@ struct xe_pcode_version {
 	u32 engg;
 };
 
+/**
+ * struct xe_pcode_write - single pcode mailbox write
+ * @mbox: mailbox command
+ * @data: value written to PCODE_DATA0
+ */
+struct xe_pcode_write {
+	u32 mbox;
+	u32 data;
+};
+
 #define PCODE_DEFAULT_TIMEOUT_MS	10
 
 int xe_pcode_init_early(struct xe_tile *tile);
@@ -28,6 +38,8 @@ int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,
 int xe_pcode_read(struct xe_tile *tile, u32 mbox, u32 *val0, u32 *val1);
 int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 val,
 			   int timeout_ms);
+int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
+			 unsigned int count);
 int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0,
 			     u32 data1, int timeout);
 int xe_get_pcode_version(struct xe_device *xe, struct xe_pcode_version *version);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 04/10] drm/xe/hwmon: Expose pwm[1-3]
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (2 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Expose pwm[1-3] hwmon attributes for each available fan. Userspace can
read PWM values in the range 0..255 and set a manual fan speed
independently of the fan curve. Switching back to the stock curve is
added by a later patch.

Read active PWM from PMT on BMG. On other platforms, derive PWM from the
stock curve when no user table is active.

After writing the user table, read back its point count to verify
firmware accepted it. If verification fails, restore stock fan control.

Document pwm[1-3] in the Xe hwmon ABI.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---
v2:
 - Use xe helpers for dmesg logs.
 - Avoid using hwmon->num_fans to get fan count in
   xe_hwmon_pwm_is_visible().

v3:
 - Set PWM directly through the user table; avoid initializing it from the
   stock table. (Soham)
 - Move the unused xe_hwmon_activate_user_fan_table() to the subsequent
   patch.
 - Fail pwmN reads when no value has been written, rather than activating
   the user table from the stock table.
 - Define MIN_FAN_CONTROL_POINTS as 2.
 - Use MIN_FAN_CONTROL_POINTS for PWM configuration. (Soham)
 - Use batched writes for configuring fan control points when setting pwmN.
 - Add and rephrase couple debug logs.
 - Update the hwmon documentation.

v4:
 - Use tab indentation in ABI doc and MIN_FAN_CONTROL_POINTS. (Soham)
 - Drop unused linux/delay.h include. (Soham)
 - Clamp min PWM to 100% since fan table speed is in percent. (Soham)
 - Log both the requested pwm and the applied percentage. (Soham)
 - Fail the pwm write if pcode reports a user point count other than
   MIN_FAN_CONTROL_POINTS after the write. (Soham)
 - Drop redundant channel range checks in pwm read/write. (Soham)
 - Fix misleading comments and debug log alignment. (Soham)
 - Note that the 0..255 to percent round trip is lossy. (Soham)
 - Update ABI Date and KernelVersion to November 2026 and 7.5.
 - Document that pwm values below the fan minimum are raised to it.
 - Return -ENODATA and log at debug level when pwm has not been set.
 - Invalidate the cached user table when the pwm write or verify fails.
 - Clear point count on pcode read failure.
 - Drop unneeded parentheses in MIN_FAN_CONTROL_POINTS and FIXED_PWM_TEMP.
 - Document pcode user table write ordering.

v5:
 - Expose pwm[1-3] node only if stock table is valid.
 - Read current pwm from PMT for BMG and from stock table for other
   platforms when user table is not active.
 - Read back the user point count after every PWM table write and fall
   back to stock table when the count is not accepted.

v6:
 - Add couple of warnings. (Soham)

 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |   9 +
 drivers/gpu/drm/xe/regs/xe_pmt.h              |   5 +
 drivers/gpu/drm/xe/xe_hwmon.c                 | 317 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_pcode_api.h             |   3 +
 4 files changed, 334 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
index ac9ccfd47eab..34c50f13f0b4 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
@@ -346,3 +346,12 @@ Description:	RW. Package burst power limit interval (Tau in PL2/Tau) in
 		milliseconds over which sustained power is averaged.
 
 		Only supported for particular Intel Xe graphics platforms.
+
+What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]
+Date:		December 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:	RW. Target fan PWM duty value in the range 0..255, where 255
+		is 100% fan speed.
+
+		Only supported for particular Intel Xe graphics platforms.
diff --git a/drivers/gpu/drm/xe/regs/xe_pmt.h b/drivers/gpu/drm/xe/regs/xe_pmt.h
index fb5b5a8648ba..4fec057b2dd6 100644
--- a/drivers/gpu/drm/xe/regs/xe_pmt.h
+++ b/drivers/gpu/drm/xe/regs/xe_pmt.h
@@ -15,6 +15,11 @@
 #define	ENERGY_PKG			REG_GENMASK64(31, 0)
 #define	ENERGY_CARD			REG_GENMASK64(63, 32)
 
+#define BMG_FAN_PWM_PMT_OFFSET		(0x58)
+#define BMG_FAN1_PWM			REG_GENMASK64(15, 0)
+#define BMG_FAN2_PWM			REG_GENMASK64(31, 16)
+#define BMG_FAN3_PWM			REG_GENMASK64(47, 32)
+
 #define PUNIT_VERSION_OFFSET		0xA0
 
 #define XE_PMT_BASE_OFFSET		0xE0000
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 4822a1c81cd7..9932003e12b6 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -157,6 +157,9 @@ enum fan_table_type {
 /* Maximum number of fan control points supported by each fan. */
 #define MAX_FAN_CONTROL_POINTS	10
 
+/* Minimum number of points required for a user fan table. */
+#define MIN_FAN_CONTROL_POINTS	2
+
 /* Fan control point index: bit31 selects fan table type; bits30:0 control point index. */
 #define FCP_INDEX(table_type, point_num) (((u32)(table_type) << 31) | \
 						((u32)(point_num) & GENMASK(30, 0)))
@@ -923,6 +926,7 @@ static const struct hwmon_channel_info * const hwmon_info[] = {
 	HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL),
 	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_MAX, HWMON_F_INPUT | HWMON_F_MAX,
 			   HWMON_F_INPUT | HWMON_F_MAX),
+	HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT, HWMON_PWM_INPUT, HWMON_PWM_INPUT),
 	NULL
 };
 
@@ -1166,6 +1170,118 @@ static int xe_hwmon_get_fan_enable_mask(struct xe_hwmon *hwmon)
 	return 0;
 }
 
+static int xe_hwmon_get_fan_point_count(struct xe_hwmon *hwmon, u8 fan, u32 *point_count,
+					enum fan_table_type table_type)
+{
+	int ret;
+
+	ret = xe_hwmon_pcode_read_fan_control(hwmon,
+					      (table_type == USER_FAN_TABLE) ?
+					      FSC_READ_USER_FAN_CONTROL_POINTS :
+					      FSC_READ_STOCK_FAN_CONTROL_POINTS,
+					      fan, point_count);
+	if (ret) {
+		*point_count = 0;
+		xe_err(hwmon->xe, "failed to read fan %d %s point count, ret=%d\n", fan,
+		       (table_type == USER_FAN_TABLE) ? "user" : "stock", ret);
+		return ret;
+	}
+
+	if (*point_count > MAX_FAN_CONTROL_POINTS) {
+		xe_err(hwmon->xe, "fan %d %s point count %u exceeds max %u\n", fan,
+		       (table_type == USER_FAN_TABLE) ? "user" : "stock", *point_count,
+		       MAX_FAN_CONTROL_POINTS);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/*
+ * Set the fan to automatic mode by clearing the user fan table.
+ * This will make the firmware run the stock fan table.
+ */
+static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
+{
+	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+	int ret;
+
+	ret = xe_pcode_write(xe_device_get_root_tile(hwmon->xe),
+			     PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan),
+			     0);
+	if (ret)
+		return ret;
+
+	fi->fan_table[USER_FAN_TABLE].point_count = 0;
+
+	return 0;
+}
+
+/* Temperature to set when setting the fan PWM with pwm[1-3]. */
+#define FIXED_PWM_TEMP	1
+
+static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
+{
+	struct xe_pcode_write writes[MIN_FAN_CONTROL_POINTS + 1];
+	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+	int ret, write_ret, verify_ret, i;
+	u32 point_count = 0;
+	u8 speed;
+
+	/* Fan table speed are in percent. */
+	speed = DIV_ROUND_CLOSEST(pwm * 100, U8_MAX);
+	speed = min_t(u32, speed, 100);
+
+	/* Fan control needs at least two points; program them all at the same speed. */
+	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
+		writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
+		writes[i].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, FIXED_PWM_TEMP + i) |
+				 FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
+		xe_dbg(hwmon->xe, "prepared fan control point %d with temp=%d, speed=%u%%\n", i,
+		       FIXED_PWM_TEMP + i, speed);
+	}
+
+	/* pcode fills the user table from point 0 in write order; the count write commits it. */
+	writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan);
+	writes[i].data = MIN_FAN_CONTROL_POINTS;
+	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
+					 ARRAY_SIZE(writes));
+	if (write_ret)
+		xe_err(hwmon->xe, "failed to write pwm %u (%u%%) for fan %d, ret=%d\n",
+		       pwm, speed, fan, write_ret);
+	else
+		xe_dbg(hwmon->xe, "applied pwm %u (%u%%) for fan %d\n", pwm, speed, fan);
+
+	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
+	if (write_ret || verify_ret || point_count != MIN_FAN_CONTROL_POINTS) {
+		int failure_ret = write_ret ?: verify_ret ?: -EIO;
+
+		/* Firmware may have accepted only part of the user table. */
+		fi->fan_table[USER_FAN_TABLE].point_count = 0;
+		if (verify_ret || point_count != MIN_FAN_CONTROL_POINTS)
+			xe_err(hwmon->xe,
+			       "fan %d PWM table count verification failed: ret=%d, count=%u\n",
+			       fan, verify_ret, point_count);
+		ret = xe_hwmon_fan_set_auto(hwmon, fan);
+		if (ret)
+			xe_err(hwmon->xe, "failed to restore fan %d to auto mode  ret=%d\n",
+			       fan, ret);
+		return failure_ret;
+	}
+
+	/* Update the user fan table cache. */
+	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
+		fi->fan_table[USER_FAN_TABLE].fcp[i].temp = FIXED_PWM_TEMP + i;
+		fi->fan_table[USER_FAN_TABLE].fcp[i].speed = speed;
+		xe_dbg(hwmon->xe, "fan %d user table cache point %d with temp=%d, speed=%u%%\n",
+		       fan, i, fi->fan_table[USER_FAN_TABLE].fcp[i].temp,
+		       fi->fan_table[USER_FAN_TABLE].fcp[i].speed);
+	}
+	fi->fan_table[USER_FAN_TABLE].point_count = MIN_FAN_CONTROL_POINTS;
+
+	return 0;
+}
+
 static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 {
 	int point;
@@ -1787,6 +1903,21 @@ xe_hwmon_fan_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
 	}
 }
 
+static umode_t
+xe_hwmon_pwm_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
+{
+	if (!hwmon->xe->info.has_fan_control || !IS_FAN_ENABLED(hwmon, channel) ||
+	    !hwmon->fi[channel].fan_table[STOCK_FAN_TABLE].point_count)
+		return 0;
+
+	switch (attr) {
+	case hwmon_pwm_input:
+		return 0644;
+	default:
+		return 0;
+	}
+}
+
 static int
 xe_hwmon_fan_input_read(struct xe_hwmon *hwmon, int channel, long *val)
 {
@@ -1840,6 +1971,185 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 	}
 }
 
+/**
+ * xe_hwmon_get_stock_table_pwm - Calculate PWM from the stock fan curve
+ * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
+ * @channel: fan channel
+ * @val: calculated PWM percentage
+ *
+ * Read package temperature and linearly interpolate the stock table. Temperatures
+ * outside the table range use the speed at the nearest endpoint.
+ *
+ * Return: 0 on success, or a negative error code.
+ */
+static int xe_hwmon_get_stock_table_pwm(struct xe_hwmon *hwmon, int channel, long *val)
+{
+	const struct fan_table *table = &hwmon->fi[channel].fan_table[STOCK_FAN_TABLE];
+	long temperature, pwm;
+	int point, ret;
+
+	lockdep_assert_held(&hwmon->hwmon_lock);
+
+	if (!table->point_count)
+		return -ENODATA;
+
+	ret = xe_hwmon_temp_read(hwmon, hwmon_temp_input, CHANNEL_PKG, &temperature);
+	if (ret)
+		return ret;
+
+	pwm = table->fcp[0].speed;
+	for (point = 1; point < table->point_count; point++) {
+		const struct fan_control_point *lower = &table->fcp[point - 1];
+		const struct fan_control_point *upper = &table->fcp[point];
+		long lower_temp = lower->temp * MILLIDEGREE_PER_DEGREE;
+		long upper_temp = upper->temp * MILLIDEGREE_PER_DEGREE;
+		long pwm_delta = upper->speed - lower->speed;
+
+		/* Find the bracketing points; temperatures outside the curve use endpoints. */
+		if (temperature <= lower_temp)
+			break;
+		if (temperature < upper_temp) {
+			pwm += DIV_ROUND_CLOSEST(pwm_delta * (temperature - lower_temp),
+						upper_temp - lower_temp);
+			break;
+		}
+		pwm = upper->speed;
+	}
+
+	*val = pwm;
+	xe_dbg(hwmon->xe, "fan %d stock table active PWM value: %ld\n", channel, pwm);
+	return 0;
+}
+
+/**
+ * xe_hwmon_get_pwm_from_pmt - Read active fan PWM from PMT telemetry
+ * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
+ * @channel: fan channel
+ * @val: raw PWM percentage returned by PMT
+ *
+ * Return: 0 on success, or a negative error code.
+ */
+static int xe_hwmon_get_pwm_from_pmt(struct xe_hwmon *hwmon, int channel, long *val)
+{
+	u64 pmt_val;
+	u32 guid, pwm;
+	int ret;
+
+	lockdep_assert_held(&hwmon->hwmon_lock);
+
+	if (hwmon->xe->info.platform != XE_BATTLEMAGE)
+		return -EOPNOTSUPP;
+
+	ret = xe_vsec_get_guid(hwmon->xe, &guid);
+	if (ret) {
+		xe_warn(hwmon->xe, "failed to read pwm, PMT unavailable: %d\n", ret);
+		return ret;
+	}
+
+	ret = xe_pmt_telem_read(hwmon->xe->drm.dev, guid, &pmt_val,
+				BMG_FAN_PWM_PMT_OFFSET, sizeof(pmt_val));
+	if (ret != sizeof(pmt_val)) {
+		xe_warn(hwmon->xe, "pwm read from PMT failed: %d\n", ret);
+		return ret < 0 ? ret : -EIO;
+	}
+
+	switch (channel) {
+	case FAN_1:
+		pwm = REG_FIELD_GET64(BMG_FAN1_PWM, pmt_val);
+		break;
+	case FAN_2:
+		pwm = REG_FIELD_GET64(BMG_FAN2_PWM, pmt_val);
+		break;
+	case FAN_3:
+		pwm = REG_FIELD_GET64(BMG_FAN3_PWM, pmt_val);
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	xe_dbg(hwmon->xe, "fan %d PMT active PWM value: %u\n", channel, pwm);
+
+	*val = pwm;
+	return 0;
+}
+
+static int
+xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
+{
+	struct xe_hwmon_fan_info *fi;
+	long pwm;
+	int ret = 0;
+
+	mutex_lock(&hwmon->hwmon_lock);
+
+	fi = &hwmon->fi[channel];
+
+	switch (attr) {
+	case hwmon_pwm_input:
+		/* If the user fan table is not populated, get active stock pwm */
+		if (!fi->fan_table[USER_FAN_TABLE].point_count) {
+			xe_dbg(hwmon->xe, "user fan table not active for fan %d\n", channel);
+			switch (hwmon->xe->info.platform) {
+			case XE_BATTLEMAGE:
+				ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, &pwm);
+				break;
+			default:
+				ret = xe_hwmon_get_stock_table_pwm(hwmon, channel, &pwm);
+				break;
+			}
+			if (ret)
+				goto unlock;
+		} else {
+			/*
+			 * pwmN writes set every user-table point to the same speed,
+			 * so the first point gives the cached manual PWM percentage.
+			 */
+			pwm = fi->fan_table[USER_FAN_TABLE].fcp[0].speed;
+		}
+		if (pwm < 0 || pwm > 100) {
+			xe_err(hwmon->xe, "invalid PWM value %ld read for fan %d\n", pwm, channel);
+			ret = -ERANGE;
+			goto unlock;
+		}
+		/* Speed is cached in percent, so the 0..255 round trip may be off by a step. */
+		*val = DIV_ROUND_CLOSEST(pwm * U8_MAX, 100);
+		xe_dbg(hwmon->xe, "pwm read for fan %d: %ld\n", channel, *val);
+		break;
+	default:
+		ret = -EOPNOTSUPP;
+		break;
+	}
+
+unlock:
+	mutex_unlock(&hwmon->hwmon_lock);
+	return ret;
+}
+
+static int
+xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
+{
+	int ret = 0;
+
+	mutex_lock(&hwmon->hwmon_lock);
+
+	switch (attr) {
+	case hwmon_pwm_input:
+		if (val < 0 || val > U8_MAX) {
+			xe_dbg(hwmon->xe, "pwm %ld out of range for fan %d\n", val, channel);
+			ret = -EINVAL;
+			break;
+		}
+		ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, (u8)val);
+		break;
+	default:
+		ret = -EOPNOTSUPP;
+		break;
+	}
+	mutex_unlock(&hwmon->hwmon_lock);
+
+	return ret;
+}
+
 static umode_t
 xe_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_types type,
 		    u32 attr, int channel)
@@ -1866,6 +2176,9 @@ xe_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_types type,
 	case hwmon_fan:
 		ret = xe_hwmon_fan_is_visible(hwmon, attr, channel);
 		break;
+	case hwmon_pwm:
+		ret = xe_hwmon_pwm_is_visible(hwmon, attr, channel);
+		break;
 	default:
 		ret = 0;
 		break;
@@ -1895,6 +2208,8 @@ xe_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		return xe_hwmon_energy_read(hwmon, attr, channel, val);
 	case hwmon_fan:
 		return xe_hwmon_fan_read(hwmon, attr, channel, val);
+	case hwmon_pwm:
+		return xe_hwmon_pwm_read(hwmon, attr, channel, val);
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -1913,6 +2228,8 @@ xe_hwmon_write(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		return xe_hwmon_power_write(hwmon, attr, channel, val);
 	case hwmon_curr:
 		return xe_hwmon_curr_write(hwmon, attr, channel, val);
+	case hwmon_pwm:
+		return xe_hwmon_pwm_write(hwmon, attr, channel, val);
 	default:
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h
index 2308e5464082..bf321ed19251 100644
--- a/drivers/gpu/drm/xe/xe_pcode_api.h
+++ b/drivers/gpu/drm/xe/xe_pcode_api.h
@@ -86,9 +86,12 @@
 #define     MEMORY_CONFIG_SUBCOMMAND_READ_MAX_FREQUENCY 0x1
 
 #define   FAN_SPEED_CONTROL			0x7D
+#define     FSC_WRITE_NUM_FAN_CONTROL_POINTS	0x0
+#define     FSC_WRITE_FAN_TABLE			0x1
 #define     FSC_READ_MAX_FAN_RPS		0x3
 #define     FSC_READ_NUM_FANS			0x4
 #define     FSC_READ_STOCK_FAN_CONTROL_POINTS	0x5
+#define     FSC_READ_USER_FAN_CONTROL_POINTS	0x6
 #define     FSC_READ_FAN_TABLE			0x7
 #define     FAN_CONTROL_POINT_TEMP_MASK		REG_GENMASK(7, 0)
 #define     FAN_CONTROL_POINT_SPEED_MASK	REG_GENMASK(15, 8)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (3 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Expose pwm[1-3]_enable to control the fan operating mode through
the hwmon interface.

Mode 0 forces the fan to run at full speed.
Mode 1 enables user fan-table control.
Mode 2 restores firmware-controlled fan management.

pwm[1-3] writes now require pwm[1-3]_enable to be 1 first. Since fans
start in mode 2 after probe, a pwm[1-3] write without selecting manual
mode is rejected with -EINVAL.

Document pwm[1-3]_enable in the Xe hwmon ABI.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Use xe helpers for dmesg logs.
 - Update kernel version in Xe hwmon documentation.
 - Correct level of some dmesg logs.

v3:
 - Each pwm_enable mode now sets its own state; drop the redundant
   post-switch pwm_enable_mode/is_full_speed update. (Badal)
 - Fix misindented dead assignment in the stock-table branch.
 - Make error handling consistent across pwm_enable modes. (Badal)
 - Document the pwm[1-3] manual-mode write precondition in the ABI. (Badal)
 - Use xe_pcode_write() instead of the timeout variant api as it is not
   needed.

v4:
 - Rebase on reworked pwm[1-3] patch.
 - Clamp min PWM to 100% when activating the user table, since fan
   table speed is in percent.
 - Drop redundant channel range check in pwm write.
 - Use tab indentation and update Date and KernelVersion to November
   2026 and 7.5 in the pwm[1-3]_enable ABI entry.

v5:
 - Address review comments from sashiko.
 - Avoid returning pwm[1-3]_enable as XE_FAN_PWM_MANUAL_USER_TABLE, when
   setting to full speed mode. (sashiko)
 - Set default pwm[1-3]_enable to XE_FAN_PWM_AUTO_STOCK_TABLE after
   probe. (sashiko)
 - Make pwm[1-3]_enable visible only if stock fan table has valid point
   count.
 - Add flag XE_FAN_PWM_UNINITIALIZED.
 - Fall back to the stock table if firmware does not accept a table.

v6:
- Remove is_full_speed as it is redundant with pwm_enable_mode now.
- Rename xe_hwmon_get_stock_table_pwm() to xe_hwmon_get_active_table_pwm().
- Avoid overwriting user table cache for full speed.
- Align pwm_enable mode kernel-doc with the ABI wording. (Soham)
- Add debug logs before -EINVAL returns. (Soham)
- Note the pwm[1-3] write precondition in the commit message. (Soham)

 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  19 ++
 drivers/gpu/drm/xe/xe_hwmon.c                 | 229 +++++++++++++++---
 2 files changed, 214 insertions(+), 34 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
index 34c50f13f0b4..dbf2c6d01376 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
@@ -354,4 +354,23 @@ Contact:	intel-xe@lists.freedesktop.org
 Description:	RW. Target fan PWM duty value in the range 0..255, where 255
 		is 100% fan speed.
 
+		Writing requires the corresponding pwm[1-3]_enable to be set to
+		1 (manual user-table mode) first; otherwise the write is
+		rejected with -EINVAL.
+
+		Only supported for particular Intel Xe graphics platforms.
+
+What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_enable
+Date:		December 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:	RW. Fan control mode selector.
+
+		Use value 0 to run fans at full speed. Use value 1 to enable
+		user table control and value 2 to use firmware default behavior.
+
+		The user fan curve is kept across modes 0 and 2, and re-applied
+		when switching back to 1. Without a user curve, mode 1 starts
+		from the firmware stock curve.
+
 		Only supported for particular Intel Xe graphics platforms.
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 9932003e12b6..1ef9c12b7110 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -139,6 +139,20 @@ struct xe_hwmon_energy_info {
 	long accum_energy;
 };
 
+/**
+ * enum xe_fan_pwm_enable_mode - fan PWM enable modes
+ */
+enum xe_fan_pwm_enable_mode {
+	/** @XE_FAN_PWM_FULL_SPEED: run the fan at full speed */
+	XE_FAN_PWM_FULL_SPEED = 0,
+	/** @XE_FAN_PWM_MANUAL_USER_TABLE: user table control */
+	XE_FAN_PWM_MANUAL_USER_TABLE = 1,
+	/** @XE_FAN_PWM_AUTO_STOCK_TABLE: firmware default behavior using the stock table */
+	XE_FAN_PWM_AUTO_STOCK_TABLE = 2,
+	/** @XE_FAN_PWM_UNINITIALIZED: fan control mode is not established */
+	XE_FAN_PWM_UNINITIALIZED = 0xff,
+};
+
 /**
  * enum fan_table_type - fan table types tracked per fan
  */
@@ -190,6 +204,8 @@ struct xe_hwmon_fan_info {
 	} fan_table[FAN_TABLE_MAX];
 	/** @max_rps: maximum fan RPS */
 	u32 max_rps;
+	/** @pwm_enable_mode: current xe_fan_pwm_enable_mode */
+	u8 pwm_enable_mode;
 };
 
 /**
@@ -926,7 +942,9 @@ static const struct hwmon_channel_info * const hwmon_info[] = {
 	HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL),
 	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_MAX, HWMON_F_INPUT | HWMON_F_MAX,
 			   HWMON_F_INPUT | HWMON_F_MAX),
-	HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT, HWMON_PWM_INPUT, HWMON_PWM_INPUT),
+	HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT | HWMON_PWM_ENABLE,
+			   HWMON_PWM_INPUT | HWMON_PWM_ENABLE,
+			   HWMON_PWM_INPUT | HWMON_PWM_ENABLE),
 	NULL
 };
 
@@ -1175,6 +1193,7 @@ static int xe_hwmon_get_fan_point_count(struct xe_hwmon *hwmon, u8 fan, u32 *poi
 {
 	int ret;
 
+	*point_count = 0;
 	ret = xe_hwmon_pcode_read_fan_control(hwmon,
 					      (table_type == USER_FAN_TABLE) ?
 					      FSC_READ_USER_FAN_CONTROL_POINTS :
@@ -1198,8 +1217,9 @@ static int xe_hwmon_get_fan_point_count(struct xe_hwmon *hwmon, u8 fan, u32 *poi
 }
 
 /*
- * Set the fan to automatic mode by clearing the user fan table.
- * This will make the firmware run the stock fan table.
+ * Set the fan to automatic mode by clearing the firmware user fan table.
+ * This will make the firmware run the stock fan table. The cached user table is
+ * kept so that manual mode can re-apply it.
  */
 static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
 {
@@ -1210,9 +1230,86 @@ static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
 			     PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan),
 			     0);
 	if (ret)
-		return ret;
+		goto fail;
+
+	fi->pwm_enable_mode = XE_FAN_PWM_AUTO_STOCK_TABLE;
+	return 0;
+
+fail:
+	fi->pwm_enable_mode = XE_FAN_PWM_UNINITIALIZED;
+	return ret;
+}
+
+static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
+					    bool is_full_speed, enum fan_table_type table_source)
+{
+	struct xe_pcode_write writes[MAX_FAN_CONTROL_POINTS + 1];
+	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+	struct fan_table *source_table;
+	u32 expected_count, point_count;
+	int ret, write_ret, verify_ret;
+	u32 point;
+
+	source_table = &fi->fan_table[table_source];
+
+	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
+	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
+
+	point_count = source_table->point_count;
+	if (!point_count || point_count > MAX_FAN_CONTROL_POINTS) {
+		xe_err(hwmon->xe,
+		       "fan %d %s table point count %d is invalid, cannot activate user table\n",
+		       fan, (table_source == USER_FAN_TABLE) ? "user" : "stock", point_count);
+		return -EINVAL;
+	}
+	expected_count = point_count;
+
+	for (point = 0; point < point_count; point++) {
+		u8 temp = source_table->fcp[point].temp;
+		u8 speed = is_full_speed ? 100 : min_t(u8, source_table->fcp[point].speed, 100);
+
+		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
+		writes[point].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, temp) |
+					FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
+	}
+
+	writes[point_count].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS,
+					      fan);
+	writes[point_count].data = point_count;
+	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
+					 point_count + 1);
+	if (write_ret)
+		xe_dbg(hwmon->xe, "failed to write fan %d user table, ret=%d\n", fan, write_ret);
+
+	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
+	if (write_ret || verify_ret || point_count != expected_count) {
+		int failure_ret = write_ret ?: verify_ret ?: -EIO;
+
+		if (verify_ret || point_count != expected_count)
+			xe_err(hwmon->xe,
+			       "fan %d user table count mismatch: ret=%d, expected=%u, got=%u\n",
+			       fan, verify_ret, expected_count, point_count);
+		/* Firmware may have accepted only part of the table; fall back to stock. */
+		ret = xe_hwmon_fan_set_auto(hwmon, fan);
+		if (ret)
+			xe_err(hwmon->xe, "failed to restore fan %d to stock mode, ret=%d\n", fan,
+			       ret);
+		return failure_ret;
+	}
+
+	/* Full speed only overrides firmware; the cache keeps the manual curve. */
+	if (table_source == STOCK_FAN_TABLE) {
+		for (point = 0; point < point_count; point++) {
+			fi->fan_table[USER_FAN_TABLE].fcp[point].temp =
+				source_table->fcp[point].temp;
+			fi->fan_table[USER_FAN_TABLE].fcp[point].speed =
+				min_t(u8, source_table->fcp[point].speed, 100);
+		}
+		fi->fan_table[USER_FAN_TABLE].point_count = point_count;
+	}
 
-	fi->fan_table[USER_FAN_TABLE].point_count = 0;
+	fi->pwm_enable_mode = is_full_speed ? XE_FAN_PWM_FULL_SPEED :
+					    XE_FAN_PWM_MANUAL_USER_TABLE;
 
 	return 0;
 }
@@ -1228,6 +1325,11 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
 	u32 point_count = 0;
 	u8 speed;
 
+	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
+		xe_dbg(hwmon->xe, "fan %d manual mode is not active, cannot set pwm\n", fan);
+		return -EINVAL;
+	}
+
 	/* Fan table speed are in percent. */
 	speed = DIV_ROUND_CLOSEST(pwm * 100, U8_MAX);
 	speed = min_t(u32, speed, 100);
@@ -1256,15 +1358,14 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
 	if (write_ret || verify_ret || point_count != MIN_FAN_CONTROL_POINTS) {
 		int failure_ret = write_ret ?: verify_ret ?: -EIO;
 
-		/* Firmware may have accepted only part of the user table. */
-		fi->fan_table[USER_FAN_TABLE].point_count = 0;
 		if (verify_ret || point_count != MIN_FAN_CONTROL_POINTS)
 			xe_err(hwmon->xe,
 			       "fan %d PWM table count verification failed: ret=%d, count=%u\n",
 			       fan, verify_ret, point_count);
+		/* Firmware may have accepted only part of the table; fall back to stock. */
 		ret = xe_hwmon_fan_set_auto(hwmon, fan);
 		if (ret)
-			xe_err(hwmon->xe, "failed to restore fan %d to auto mode  ret=%d\n",
+			xe_err(hwmon->xe, "failed to restore fan %d to auto mode ret=%d\n",
 			       fan, ret);
 		return failure_ret;
 	}
@@ -1351,6 +1452,8 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 		memcpy(fi->fan_table[STOCK_FAN_TABLE].fcp, stock_fcp,
 		       stock_fcp_count * sizeof(stock_fcp[0]));
 		fi->fan_table[STOCK_FAN_TABLE].point_count = stock_fcp_count;
+		if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
+			fi->pwm_enable_mode = XE_FAN_PWM_AUTO_STOCK_TABLE;
 	}
 	return ret;
 }
@@ -1912,6 +2015,7 @@ xe_hwmon_pwm_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
 
 	switch (attr) {
 	case hwmon_pwm_input:
+	case hwmon_pwm_enable:
 		return 0644;
 	default:
 		return 0;
@@ -1971,25 +2075,43 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 	}
 }
 
+static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
+{
+	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
+			USER_FAN_TABLE;
+}
+
 /**
- * xe_hwmon_get_stock_table_pwm - Calculate PWM from the stock fan curve
+ * xe_hwmon_get_active_table_pwm - Calculate PWM from the active fan curve
  * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
  * @channel: fan channel
  * @val: calculated PWM percentage
  *
- * Read package temperature and linearly interpolate the stock table. Temperatures
- * outside the table range use the speed at the nearest endpoint.
+ * Read package temperature and linearly interpolate the fan table selected by
+ * pwm_enable. Temperatures outside the table range use the nearest endpoint.
  *
  * Return: 0 on success, or a negative error code.
  */
-static int xe_hwmon_get_stock_table_pwm(struct xe_hwmon *hwmon, int channel, long *val)
+static int xe_hwmon_get_active_table_pwm(struct xe_hwmon *hwmon, int channel, long *val)
 {
-	const struct fan_table *table = &hwmon->fi[channel].fan_table[STOCK_FAN_TABLE];
+	const struct fan_table *table;
 	long temperature, pwm;
 	int point, ret;
 
 	lockdep_assert_held(&hwmon->hwmon_lock);
 
+	switch (hwmon->fi[channel].pwm_enable_mode) {
+	case XE_FAN_PWM_UNINITIALIZED:
+		return -ENODATA;
+	case XE_FAN_PWM_FULL_SPEED:
+		*val = 100;
+		return 0;
+	default:
+		break;
+	}
+
+	table = &hwmon->fi[channel].fan_table[xe_hwmon_get_active_fan_table(hwmon, channel)];
+
 	if (!table->point_count)
 		return -ENODATA;
 
@@ -2017,7 +2139,7 @@ static int xe_hwmon_get_stock_table_pwm(struct xe_hwmon *hwmon, int channel, lon
 	}
 
 	*val = pwm;
-	xe_dbg(hwmon->xe, "fan %d stock table active PWM value: %ld\n", channel, pwm);
+	xe_dbg(hwmon->xe, "fan %d: pwm value from active table cache: %ld\n", channel, pwm);
 	return 0;
 }
 
@@ -2067,7 +2189,7 @@ static int xe_hwmon_get_pwm_from_pmt(struct xe_hwmon *hwmon, int channel, long *
 		return -EOPNOTSUPP;
 	}
 
-	xe_dbg(hwmon->xe, "fan %d PMT active PWM value: %u\n", channel, pwm);
+	xe_dbg(hwmon->xe, "fan %d: active pwm from PMT: %u\n", channel, pwm);
 
 	*val = pwm;
 	return 0;
@@ -2086,25 +2208,22 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 
 	switch (attr) {
 	case hwmon_pwm_input:
-		/* If the user fan table is not populated, get active stock pwm */
-		if (!fi->fan_table[USER_FAN_TABLE].point_count) {
-			xe_dbg(hwmon->xe, "user fan table not active for fan %d\n", channel);
-			switch (hwmon->xe->info.platform) {
-			case XE_BATTLEMAGE:
-				ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, &pwm);
-				break;
-			default:
-				ret = xe_hwmon_get_stock_table_pwm(hwmon, channel, &pwm);
-				break;
-			}
-			if (ret)
-				goto unlock;
-		} else {
-			/*
-			 * pwmN writes set every user-table point to the same speed,
-			 * so the first point gives the cached manual PWM percentage.
-			 */
-			pwm = fi->fan_table[USER_FAN_TABLE].fcp[0].speed;
+		switch (hwmon->xe->info.platform) {
+		case XE_BATTLEMAGE:
+			ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, &pwm);
+			break;
+		default:
+			ret = xe_hwmon_get_active_table_pwm(hwmon, channel, &pwm);
+			break;
+		}
+		if (ret == -ENODATA) {
+			xe_dbg(hwmon->xe, "fan %d control mode not established\n", channel);
+			goto unlock;
+		}
+		if (ret) {
+			xe_err(hwmon->xe, "failed to get active pwm for fan %d, ret=%d\n",
+			       channel, ret);
+			goto unlock;
 		}
 		if (pwm < 0 || pwm > 100) {
 			xe_err(hwmon->xe, "invalid PWM value %ld read for fan %d\n", pwm, channel);
@@ -2115,6 +2234,13 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 		*val = DIV_ROUND_CLOSEST(pwm * U8_MAX, 100);
 		xe_dbg(hwmon->xe, "pwm read for fan %d: %ld\n", channel, *val);
 		break;
+	case hwmon_pwm_enable:
+		if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED) {
+			ret = -ENODATA;
+			break;
+		}
+		*val = fi->pwm_enable_mode;
+		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;
@@ -2128,8 +2254,11 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 static int
 xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
 {
+	struct xe_hwmon_fan_info *fi;
 	int ret = 0;
 
+	fi = &hwmon->fi[channel];
+
 	mutex_lock(&hwmon->hwmon_lock);
 
 	switch (attr) {
@@ -2141,6 +2270,33 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
 		}
 		ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, (u8)val);
 		break;
+	case hwmon_pwm_enable:
+		if (val == XE_FAN_PWM_FULL_SPEED || val == XE_FAN_PWM_MANUAL_USER_TABLE) {
+			bool full_speed = val == XE_FAN_PWM_FULL_SPEED;
+			/* Without a user curve, start from the clamped stock table. */
+			enum fan_table_type source = fi->fan_table[USER_FAN_TABLE].point_count ?
+				USER_FAN_TABLE : STOCK_FAN_TABLE;
+
+			ret = xe_hwmon_activate_user_fan_table(hwmon, channel, full_speed, source);
+			if (ret)
+				xe_warn(hwmon->xe, "failed to set fan %d pwm_enable %ld, ret=%d\n",
+					channel, val, ret);
+		} else if (val == XE_FAN_PWM_AUTO_STOCK_TABLE) {
+			ret = xe_hwmon_fan_set_auto(hwmon, channel);
+			if (ret) {
+				xe_warn(hwmon->xe,
+					"failed to switch fan %d to automatic stock control, ret=%d\n",
+					channel, ret);
+				break;
+			}
+			xe_dbg(hwmon->xe,
+			       "automatic control enabled for fan %d using stock table\n",
+			       channel);
+		} else {
+			xe_dbg(hwmon->xe, "invalid pwm%d_enable value %ld\n", channel + 1, val);
+			ret = -EINVAL;
+		}
+		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;
@@ -2354,6 +2510,7 @@ int xe_hwmon_register(struct xe_device *xe)
 {
 	struct device *dev = xe->drm.dev;
 	struct xe_hwmon *hwmon;
+	int fan;
 	int ret;
 
 	/* hwmon is available only for dGfx */
@@ -2368,6 +2525,10 @@ int xe_hwmon_register(struct xe_device *xe)
 	if (!hwmon)
 		return -ENOMEM;
 
+	/* Zero is XE_FAN_PWM_FULL_SPEED; stay unset until the stock table is read. */
+	for (fan = 0; fan < FAN_MAX; fan++)
+		hwmon->fi[fan].pwm_enable_mode = XE_FAN_PWM_UNINITIALIZED;
+
 	ret = devm_mutex_init(dev, &hwmon->hwmon_lock);
 	if (ret)
 		return ret;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (4 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 21:00   ` Rodrigo Vivi
  2026-11-30 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Expose curve-point temperature and pwm controls via
pwmF_auto_point[P]_temp and pwmF_auto_point[P]_pwm, where
F is the fan number and P is the fan curve point number.
Each fan curve point has a temperature and a pwm attribute.

Update Xe hwmon ABI documentation for pwm auto point temperature
attributes.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Use xe helpers for dmesg logs.
 - Update kernel version in Xe hwmon documentation.
 - Correct debug level of some dmesg logs.

v3:
 - Allow variable fan curve points from >=2 to MAX_FAN_CONTROL_POINTS.
 - Expose all MAX_FAN_CONTROL_POINTS fan-curve slots so users can extend
   a short fan table.
 - Stage temp/PWM pairs without changing the active curve. Commit at a
   (0, 0) end marker or after all MAX_FAN_CONTROL_POINTS pairs.
 - Write the points together, verify the firmware count, then update the
   active cache.

v4:
 - Use the two-argument IS_FAN_ENABLED() after rebase.
 - Fix kernel-doc for nested staged fan_table members.
 - Use "speed" for percent values and "pwm" only for the 0..255 sysfs
   value. (Soham)
 - Use u32 for the point index in xe_hwmon_commit_user_fan_table(). (Soham)
 - Fix comment to say curve points must not decrease. (Soham)
 - Add debug logs before -EINVAL returns. (Soham)
 - Drop inline from xe_hwmon_get_active_fan_table(). (Soham)
 - Use reverse xmas tree ordering for local variables. (Soham)
 - Rename xe_hwmon_get_u8_from_sysfs() to xe_hwmon_sysfs_to_hw_val().
   (Soham)
 - Use if/else if/else for value selection in pwm auto point show. (Soham)
 - Create the fan curve sensor attributes at probe time instead of 60
   static definitions. (Soham)
 - Clamp min PWM to 100% and reject pwm values above 100% speed.
 - Use xe helpers for logs in the auto point store functions.

v5:
 - Address review comments from Sashiko.
 - Remove min_pwm as it is not available.
 - Read back the user point count after curve programming and fall back
   to stock control when firmware does not accept it.

v6:
 - Require strictly increasing temperatures across curve points, as
   firmware rejects equal temperatures.
 - Reject tables with fewer than MIN_FAN_CONTROL_POINTS before writing
   to firmware.
 - Expose pwmN_auto_point* only when the fan has a stock table, like
   pwmN_enable.
 - Return -ENODATA from pwmN_auto_point* reads while the fan control
   mode is not established, like pwmN and pwmN_enable.
 - Add the missing ABI documentation for pwm[1-3]_auto_point[1-10]_temp
   and pwm[1-3]_auto_point[1-10]_pwm.
 - Use reverse xmas tree ordering in xe_hwmon_activate_user_fan_table().
   (Soham)
 - Drop the else after return in xe_hwmon_get_active_fan_table().
   (Soham)
 - Keep staged curve points when the user table is re-applied on
   resume or after late binding; clear them only on pwm_enable writes.
   (sashiko)
 - Document that a failed completing curve write drops all staged
   points. (Soham)

 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  46 ++
 drivers/gpu/drm/xe/xe_hwmon.c                 | 513 +++++++++++++++---
 2 files changed, 475 insertions(+), 84 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
index dbf2c6d01376..81c0c8217d4a 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
@@ -374,3 +374,49 @@ Description:	RW. Fan control mode selector.
 		from the firmware stock curve.
 
 		Only supported for particular Intel Xe graphics platforms.
+
+What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_auto_point[1-10]_temp
+Date:		December 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:	RW. Temperature of fan curve point in millidegree Celsius.
+
+		Reads return the point of the stock fan curve when
+		pwm[1-3]_enable is 2 and of the user fan curve otherwise. Unused
+		points read 0. Reads fail with -ENODATA while the fan control
+		mode is not established.
+
+		Writes stage the user curve point and require pwm[1-3]_enable
+		to be 1; otherwise they are rejected with -EINVAL. See
+		pwm[1-3]_auto_point[1-10]_pwm for how the curve is committed.
+
+		Only supported for particular Intel Xe graphics platforms.
+
+What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_auto_point[1-10]_pwm
+Date:		December 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:	RW. Fan PWM duty of fan curve point in the range 0..255, where
+		255 is 100% fan speed. Firmware stores the duty in percent, so
+		reads return the value rounded to the nearest percent step.
+
+		Reads return the point of the stock fan curve when
+		pwm[1-3]_enable is 2 and of the user fan curve otherwise. Unused
+		points read 0. Reads fail with -ENODATA while the fan control
+		mode is not established.
+
+		Writes stage the user curve point and require pwm[1-3]_enable
+		to be 1; otherwise they are rejected with -EINVAL. Nonzero
+		values are kept at least 1%.
+
+		The staged curve is programmed once points 1..K all have both a
+		temperature and a PWM value and either point K+1 is set to
+		temperature 0 and PWM 0, or K is 10. The end marker is not part
+		of the curve. The curve needs at least two points, temperature
+		must increase and PWM must not decrease from one point to the
+		next; otherwise the completing write fails with -EINVAL. A
+		completing write that fails drops all staged points. If
+		firmware does not accept the curve, the fan falls back to
+		pwm[1-3]_enable 2 and the write fails.
+
+		Only supported for particular Intel Xe graphics platforms.
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 1ef9c12b7110..857c9d293f09 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -174,6 +174,11 @@ enum fan_table_type {
 /* Minimum number of points required for a user fan table. */
 #define MIN_FAN_CONTROL_POINTS	2
 
+/* pwmN_auto_pointM_temp and pwmN_auto_pointM_pwm for every curve point of a fan. */
+#define XE_CURVE_ATTRS_PER_FAN	(2 * MAX_FAN_CONTROL_POINTS)
+#define XE_CURVE_ATTRS		(FAN_MAX * XE_CURVE_ATTRS_PER_FAN)
+#define XE_CURVE_ATTR_NAME_LEN	sizeof("pwmN_auto_pointNN_temp")
+
 /* Fan control point index: bit31 selects fan table type; bits30:0 control point index. */
 #define FCP_INDEX(table_type, point_num) (((u32)(table_type) << 31) | \
 						((u32)(point_num) & GENMASK(30, 0)))
@@ -201,6 +206,12 @@ struct xe_hwmon_fan_info {
 			/** @fan_table.fcp.speed: fan speed in percentage */
 			u8 speed;
 		} fcp[MAX_FAN_CONTROL_POINTS];
+		/** @fan_table.staged_fcp: curve supplied via sysfs but not yet committed */
+		struct fan_control_point staged_fcp[MAX_FAN_CONTROL_POINTS];
+		/** @fan_table.temp_staged: bitmask of temperature fields supplied via sysfs */
+		u16 temp_staged;
+		/** @fan_table.speed_staged: bitmask of speed fields supplied via sysfs */
+		u16 speed_staged;
 	} fan_table[FAN_TABLE_MAX];
 	/** @max_rps: maximum fan RPS */
 	u32 max_rps;
@@ -266,6 +277,16 @@ struct xe_hwmon {
 	u32 pl2_on_boot[CHANNEL_MAX];
 	/** @temp: Temperature info */
 	struct xe_hwmon_thermal_info temp;
+	/** @curve_sda: fan curve sensor attributes */
+	struct sensor_device_attribute curve_sda[XE_CURVE_ATTRS];
+	/** @curve_names: names of the fan curve sensor attributes */
+	char curve_names[XE_CURVE_ATTRS][XE_CURVE_ATTR_NAME_LEN];
+	/** @curve_attrs: NULL-terminated list of fan curve attributes */
+	struct attribute *curve_attrs[XE_CURVE_ATTRS + 1];
+	/** @curve_group: fan curve attribute group */
+	struct attribute_group curve_group;
+	/** @groups: NULL-terminated list of extra attribute groups */
+	const struct attribute_group *groups[3];
 };
 
 static inline int prepare_power_limit_param2(const struct xe_hwmon *hwmon, int channel)
@@ -910,11 +931,6 @@ static const struct attribute_group hwmon_attrgroup = {
 	.is_visible = xe_hwmon_attributes_visible,
 };
 
-static const struct attribute_group *hwmon_groups[] = {
-	&hwmon_attrgroup,
-	NULL
-};
-
 static const u32 hwmon_temp_config[CHANNEL_MAX + 1] = {
 	[CHANNEL_CARD] = HWMON_T_LABEL,
 	[CHANNEL_PKG] = HWMON_T_CRIT | HWMON_T_EMERGENCY | HWMON_T_INPUT |
@@ -1240,55 +1256,65 @@ static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
 	return ret;
 }
 
-static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
-					    bool is_full_speed, enum fan_table_type table_source)
+static int xe_hwmon_commit_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
+					  const struct fan_control_point *points, u32 point_count)
 {
+	/* The extra write is for the final write that sets the number of fan control points */
 	struct xe_pcode_write writes[MAX_FAN_CONTROL_POINTS + 1];
-	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
-	struct fan_table *source_table;
-	u32 expected_count, point_count;
-	int ret, write_ret, verify_ret;
+	u32 accepted_count = 0;
 	u32 point;
+	int ret, write_ret, verify_ret;
 
-	source_table = &fi->fan_table[table_source];
-
-	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
-	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
-
-	point_count = source_table->point_count;
-	if (!point_count || point_count > MAX_FAN_CONTROL_POINTS) {
-		xe_err(hwmon->xe,
-		       "fan %d %s table point count %d is invalid, cannot activate user table\n",
-		       fan, (table_source == USER_FAN_TABLE) ? "user" : "stock", point_count);
+	if (point_count < MIN_FAN_CONTROL_POINTS) {
+		xe_err(hwmon->xe, "fan %d table needs at least %d points, got %u\n", fan,
+		       MIN_FAN_CONTROL_POINTS, point_count);
 		return -EINVAL;
 	}
-	expected_count = point_count;
 
 	for (point = 0; point < point_count; point++) {
-		u8 temp = source_table->fcp[point].temp;
-		u8 speed = is_full_speed ? 100 : min_t(u8, source_table->fcp[point].speed, 100);
+		u8 temp = points[point].temp;
+		u8 speed = points[point].speed;
+
+		/* Firmware requires increasing temperature and non-decreasing speed. */
+		if (point > 0) {
+			u8 prev_temp = points[point - 1].temp;
+			u8 prev_speed = points[point - 1].speed;
+
+			if (temp <= prev_temp || speed < prev_speed) {
+				xe_dbg(hwmon->xe,
+				       "fan %d point %u not monotonic: %u/%u%% after %u/%u%%\n",
+				       fan, point, temp, speed, prev_temp, prev_speed);
+				return -EINVAL;
+			}
+		}
 
-		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
+		/* Prepare the write for this fan control point */
+		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE,
+						fan);
 		writes[point].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, temp) |
-					FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
+				FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
 	}
 
+	xe_dbg(hwmon->xe, "committing fan %d user table with %u points\n", fan, point_count);
+
+	/* pcode fills the user table from point 0 in write order; the count write commits it. */
 	writes[point_count].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS,
 					      fan);
 	writes[point_count].data = point_count;
+
 	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
 					 point_count + 1);
 	if (write_ret)
 		xe_dbg(hwmon->xe, "failed to write fan %d user table, ret=%d\n", fan, write_ret);
 
-	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
-	if (write_ret || verify_ret || point_count != expected_count) {
+	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &accepted_count, USER_FAN_TABLE);
+	if (write_ret || verify_ret || accepted_count != point_count) {
 		int failure_ret = write_ret ?: verify_ret ?: -EIO;
 
-		if (verify_ret || point_count != expected_count)
+		if (verify_ret || accepted_count != point_count)
 			xe_err(hwmon->xe,
-			       "fan %d user table count mismatch: ret=%d, expected=%u, got=%u\n",
-			       fan, verify_ret, expected_count, point_count);
+			       "fan %d table count verification failed: ret=%d, expected=%u, got=%u\n",
+			       fan, verify_ret, point_count, accepted_count);
 		/* Firmware may have accepted only part of the table; fall back to stock. */
 		ret = xe_hwmon_fan_set_auto(hwmon, fan);
 		if (ret)
@@ -1297,15 +1323,45 @@ static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
 		return failure_ret;
 	}
 
+	xe_dbg(hwmon->xe, "fan %d user table committed successfully with %u points\n", fan,
+	       point_count);
+	return 0;
+}
+
+static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
+					    bool is_full_speed, enum fan_table_type table_source)
+{
+	struct fan_control_point points[MAX_FAN_CONTROL_POINTS];
+	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+	struct fan_table *source_table, *user_table;
+	u32 point_count, point;
+	int ret;
+
+	source_table = &fi->fan_table[table_source];
+	user_table = &fi->fan_table[USER_FAN_TABLE];
+	point_count = source_table->point_count;
+
+	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
+	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
+
+	for (point = 0; point < point_count; point++) {
+		points[point].temp = source_table->fcp[point].temp;
+		points[point].speed = is_full_speed ? 100 :
+				      min_t(u8, source_table->fcp[point].speed, 100);
+	}
+
+	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, points, point_count);
+	if (ret)
+		return ret;
+
 	/* Full speed only overrides firmware; the cache keeps the manual curve. */
 	if (table_source == STOCK_FAN_TABLE) {
 		for (point = 0; point < point_count; point++) {
-			fi->fan_table[USER_FAN_TABLE].fcp[point].temp =
-				source_table->fcp[point].temp;
-			fi->fan_table[USER_FAN_TABLE].fcp[point].speed =
-				min_t(u8, source_table->fcp[point].speed, 100);
+			user_table->fcp[point].temp = source_table->fcp[point].temp;
+			user_table->fcp[point].speed = min_t(u8, source_table->fcp[point].speed,
+							     100);
 		}
-		fi->fan_table[USER_FAN_TABLE].point_count = point_count;
+		user_table->point_count = point_count;
 	}
 
 	fi->pwm_enable_mode = is_full_speed ? XE_FAN_PWM_FULL_SPEED :
@@ -1319,10 +1375,10 @@ static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
 
 static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
 {
-	struct xe_pcode_write writes[MIN_FAN_CONTROL_POINTS + 1];
 	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
-	int ret, write_ret, verify_ret, i;
-	u32 point_count = 0;
+	struct fan_table *user_table = &fi->fan_table[USER_FAN_TABLE];
+	struct fan_control_point points[MIN_FAN_CONTROL_POINTS];
+	int ret, i;
 	u8 speed;
 
 	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
@@ -1331,58 +1387,341 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
 	}
 
 	/* Fan table speed are in percent. */
-	speed = DIV_ROUND_CLOSEST(pwm * 100, U8_MAX);
-	speed = min_t(u32, speed, 100);
+	speed = min_t(u32, DIV_ROUND_CLOSEST(pwm * 100, U8_MAX), 100);
 
 	/* Fan control needs at least two points; program them all at the same speed. */
 	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
-		writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
-		writes[i].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, FIXED_PWM_TEMP + i) |
-				 FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
-		xe_dbg(hwmon->xe, "prepared fan control point %d with temp=%d, speed=%u%%\n", i,
-		       FIXED_PWM_TEMP + i, speed);
+		points[i].temp = FIXED_PWM_TEMP + i;
+		points[i].speed = speed;
 	}
 
-	/* pcode fills the user table from point 0 in write order; the count write commits it. */
-	writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan);
-	writes[i].data = MIN_FAN_CONTROL_POINTS;
-	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
-					 ARRAY_SIZE(writes));
-	if (write_ret)
-		xe_err(hwmon->xe, "failed to write pwm %u (%u%%) for fan %d, ret=%d\n",
-		       pwm, speed, fan, write_ret);
+	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, points, MIN_FAN_CONTROL_POINTS);
+	if (ret) {
+		xe_err(hwmon->xe, "failed to set pwm %u (%u%%) for fan %d, ret=%d\n",
+		       pwm, speed, fan, ret);
+		return ret;
+	}
+
+	memcpy(user_table->fcp, points, sizeof(points));
+	user_table->point_count = MIN_FAN_CONTROL_POINTS;
+	user_table->temp_staged = 0;
+	user_table->speed_staged = 0;
+	xe_dbg(hwmon->xe, "applied pwm %u (%u%%) for fan %d\n", pwm, speed, fan);
+
+	return 0;
+}
+
+#define XE_CURVE_IDX(fan, point)	(((fan) << 8) | (point))
+#define XE_CURVE_FAN(idx)		((u8)(((idx) >> 8) & 0xff))
+#define XE_CURVE_POINT(idx)		((u8)((idx) & 0xff))
+
+static int
+xe_hwmon_decode_curve_index(struct xe_hwmon *hwmon, u32 index, u8 *fan, u8 *point)
+{
+	u8 local_fan = XE_CURVE_FAN(index);
+	u8 local_point = XE_CURVE_POINT(index);
+
+	if (local_fan >= FAN_MAX || local_point >= MAX_FAN_CONTROL_POINTS) {
+		xe_dbg(hwmon->xe, "invalid fan curve index 0x%x: fan %u point %u\n",
+		       index, local_fan, local_point);
+		return -EINVAL;
+	}
+
+	*fan = local_fan;
+	*point = local_point;
+
+	return 0;
+}
+
+static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
+{
+	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
+			USER_FAN_TABLE;
+}
+
+static ssize_t
+xe_hwmon_pwm_auto_point_temp_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+	enum fan_table_type active_table;
+	struct xe_hwmon_fan_info *fi;
+	u32 point_count;
+	u8 point;
+	u8 temp;
+	int ret;
+	u8 fan;
+
+	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
+	if (ret)
+		return ret;
+
+	guard(mutex)(&hwmon->hwmon_lock);
+
+	fi = &hwmon->fi[fan];
+	if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
+		return -ENODATA;
+
+	active_table = xe_hwmon_get_active_fan_table(hwmon, fan);
+
+	point_count = fi->fan_table[active_table].point_count;
+
+	if (point >= point_count)
+		temp = 0;
 	else
-		xe_dbg(hwmon->xe, "applied pwm %u (%u%%) for fan %d\n", pwm, speed, fan);
+		temp = fi->fan_table[active_table].fcp[point].temp;
+	return sysfs_emit(buf, "%u\n", temp * MILLIDEGREE_PER_DEGREE);
+}
 
-	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
-	if (write_ret || verify_ret || point_count != MIN_FAN_CONTROL_POINTS) {
-		int failure_ret = write_ret ?: verify_ret ?: -EIO;
+static int xe_hwmon_update_user_fan_point(struct xe_hwmon *hwmon, u8 fan, u32 point,
+					  bool is_temp, u8 value)
+{
+	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+	struct fan_table *table;
+	u32 point_count;
+	int ret;
 
-		if (verify_ret || point_count != MIN_FAN_CONTROL_POINTS)
-			xe_err(hwmon->xe,
-			       "fan %d PWM table count verification failed: ret=%d, count=%u\n",
-			       fan, verify_ret, point_count);
-		/* Firmware may have accepted only part of the table; fall back to stock. */
-		ret = xe_hwmon_fan_set_auto(hwmon, fan);
-		if (ret)
-			xe_err(hwmon->xe, "failed to restore fan %d to auto mode ret=%d\n",
-			       fan, ret);
-		return failure_ret;
+	table = &fi->fan_table[USER_FAN_TABLE];
+
+	if (is_temp) {
+		table->staged_fcp[point].temp = value;
+		table->temp_staged |= BIT(point);
+	} else {
+		table->staged_fcp[point].speed = value;
+		table->speed_staged |= BIT(point);
 	}
 
-	/* Update the user fan table cache. */
-	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
-		fi->fan_table[USER_FAN_TABLE].fcp[i].temp = FIXED_PWM_TEMP + i;
-		fi->fan_table[USER_FAN_TABLE].fcp[i].speed = speed;
-		xe_dbg(hwmon->xe, "fan %d user table cache point %d with temp=%d, speed=%u%%\n",
-		       fan, i, fi->fan_table[USER_FAN_TABLE].fcp[i].temp,
-		       fi->fan_table[USER_FAN_TABLE].fcp[i].speed);
+	/* Wait for a complete prefix; (0, 0) ends the curve without becoming a point. */
+	for (point_count = 0; point_count < MAX_FAN_CONTROL_POINTS; point_count++) {
+		if (!(table->temp_staged & BIT(point_count)) ||
+		    !(table->speed_staged & BIT(point_count)))
+			return 0;
+		if (!table->staged_fcp[point_count].temp &&
+		    !table->staged_fcp[point_count].speed)
+			break;
+	}
+
+	if (point_count < MIN_FAN_CONTROL_POINTS) {
+		xe_dbg(hwmon->xe, "fan %d curve needs at least %d points, got %u\n",
+		       fan, MIN_FAN_CONTROL_POINTS, point_count);
+		ret = -EINVAL;
+		goto clear_staged;
 	}
-	fi->fan_table[USER_FAN_TABLE].point_count = MIN_FAN_CONTROL_POINTS;
+
+	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, table->staged_fcp, point_count);
+	if (ret)
+		goto clear_staged;
+
+	/* Publish the new curve only after firmware accepts its point count. */
+	memcpy(table->fcp, table->staged_fcp, point_count * sizeof(table->fcp[0]));
+	table->point_count = point_count;
+	fi->pwm_enable_mode = XE_FAN_PWM_MANUAL_USER_TABLE;
+
+clear_staged:
+	table->temp_staged = 0;
+	table->speed_staged = 0;
+	return ret;
+}
+
+static int xe_hwmon_sysfs_to_hw_val(struct xe_hwmon *hwmon, long val, bool is_temp, u8 *out)
+{
+	long max = is_temp ? U8_MAX * MILLIDEGREE_PER_DEGREE : U8_MAX;
+	long hw_val;
+
+	if (val < 0 || val > max) {
+		xe_dbg(hwmon->xe, "%s value %ld out of range\n", is_temp ? "temp" : "pwm", val);
+		return -EINVAL;
+	}
+
+	/* Temperature is in degrees Celsius, speed in percent. */
+	if (is_temp)
+		hw_val = DIV_ROUND_CLOSEST(val, MILLIDEGREE_PER_DEGREE);
+	else
+		hw_val = DIV_ROUND_CLOSEST(val * 100, U8_MAX);
+
+	if (!is_temp && val && !hw_val)
+		hw_val = 1;
+
+	*out = hw_val;
 
 	return 0;
 }
 
+static ssize_t
+xe_hwmon_pwm_auto_point_temp_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+	struct xe_hwmon_fan_info *fi;
+	long val;
+	u8 point;
+	u8 temp;
+	int ret;
+	u8 fan;
+
+	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
+	if (ret)
+		return ret;
+
+	ret = kstrtol(buf, 10, &val);
+	if (ret)
+		return ret;
+
+	ret = xe_hwmon_sysfs_to_hw_val(hwmon, val, true, &temp);
+	if (ret)
+		return ret;
+
+	guard(xe_pm_runtime)(hwmon->xe);
+
+	guard(mutex)(&hwmon->hwmon_lock);
+	fi = &hwmon->fi[fan];
+
+	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
+		xe_dbg(hwmon->xe, "pwm%d_enable not in manual mode; cannot update temp point %d\n",
+		       fan + 1, point + 1);
+		return -EINVAL;
+	}
+
+	xe_dbg(hwmon->xe, "staging fan %d point %d temp to %u\n", fan, point, temp);
+	ret = xe_hwmon_update_user_fan_point(hwmon, fan, point, true, temp);
+
+	return ret ? ret : count;
+}
+
+static ssize_t
+xe_hwmon_pwm_auto_point_pwm_show(struct device *dev,
+				 struct device_attribute *attr,
+				 char *buf)
+{
+	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+	enum fan_table_type active_table;
+	struct xe_hwmon_fan_info *fi;
+	u32 point_count;
+	u8 point;
+	u8 speed;
+	int ret;
+	u8 fan;
+
+	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
+	if (ret)
+		return ret;
+
+	guard(mutex)(&hwmon->hwmon_lock);
+
+	fi = &hwmon->fi[fan];
+	if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
+		return -ENODATA;
+
+	active_table = xe_hwmon_get_active_fan_table(hwmon, fan);
+
+	point_count = fi->fan_table[active_table].point_count;
+
+	if (point >= point_count)
+		speed = 0;
+	else
+		speed = fi->fan_table[active_table].fcp[point].speed;
+	return sysfs_emit(buf, "%u\n", DIV_ROUND_CLOSEST(speed * U8_MAX, 100));
+}
+
+static ssize_t
+xe_hwmon_pwm_auto_point_pwm_store(struct device *dev,
+				  struct device_attribute *attr,
+				  const char *buf, size_t count)
+{
+	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+	struct xe_hwmon_fan_info *fi;
+	long val;
+	u8 point;
+	u8 speed;
+	int ret;
+	u8 fan;
+
+	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
+	if (ret)
+		return ret;
+
+	ret = kstrtol(buf, 10, &val);
+	if (ret)
+		return ret;
+
+	ret = xe_hwmon_sysfs_to_hw_val(hwmon, val, false, &speed);
+	if (ret)
+		return ret;
+
+	guard(xe_pm_runtime)(hwmon->xe);
+
+	guard(mutex)(&hwmon->hwmon_lock);
+	fi = &hwmon->fi[fan];
+
+	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
+		xe_dbg(hwmon->xe,
+		       "pwm%d_enable is not in manual user mode, cannot update pwm point %d\n",
+		       fan + 1, point + 1);
+		return -EINVAL;
+	}
+
+	xe_dbg(hwmon->xe, "staging fan %d point %d speed to %u%%\n", fan, point, speed);
+	ret = xe_hwmon_update_user_fan_point(hwmon, fan, point, false, speed);
+
+	return ret ? ret : count;
+}
+
+static umode_t xe_hwmon_curve_attributes_visible(struct kobject *kobj,
+						 struct attribute *attr, int index)
+{
+	struct device *dev = kobj_to_dev(kobj);
+	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
+	u32 fan = index / XE_CURVE_ATTRS_PER_FAN;
+
+	/* Manual mode, and thus curve writes, need a stock table, as for pwmN_enable. */
+	if (!hwmon->xe->info.has_fan_control || !IS_FAN_ENABLED(hwmon, fan) ||
+	    !hwmon->fi[fan].fan_table[STOCK_FAN_TABLE].point_count)
+		return 0;
+
+	/* All slots must exist at registration, before the user curve has been staged. */
+	return attr->mode;
+}
+
+static void xe_hwmon_init_curve_attrs(struct xe_hwmon *hwmon)
+{
+	int fan, kind, point, i = 0;
+
+	/* Per fan: all temp points then all pwm points; is_visible relies on this layout. */
+	for (fan = 0; fan < FAN_MAX; fan++) {
+		for (kind = 0; kind < 2; kind++) {
+			bool is_temp = !kind;
+
+			for (point = 0; point < MAX_FAN_CONTROL_POINTS; point++, i++) {
+				struct sensor_device_attribute *sda = &hwmon->curve_sda[i];
+
+				snprintf(hwmon->curve_names[i], XE_CURVE_ATTR_NAME_LEN,
+					 "pwm%d_auto_point%d_%s", fan + 1, point + 1,
+					 is_temp ? "temp" : "pwm");
+				sysfs_attr_init(&sda->dev_attr.attr);
+				sda->dev_attr.attr.name = hwmon->curve_names[i];
+				sda->dev_attr.attr.mode = 0644;
+				if (is_temp) {
+					sda->dev_attr.show = xe_hwmon_pwm_auto_point_temp_show;
+					sda->dev_attr.store = xe_hwmon_pwm_auto_point_temp_store;
+				} else {
+					sda->dev_attr.show = xe_hwmon_pwm_auto_point_pwm_show;
+					sda->dev_attr.store = xe_hwmon_pwm_auto_point_pwm_store;
+				}
+				sda->index = XE_CURVE_IDX(fan, point);
+				hwmon->curve_attrs[i] = &sda->dev_attr.attr;
+			}
+		}
+	}
+
+	hwmon->curve_group.attrs = hwmon->curve_attrs;
+	hwmon->curve_group.is_visible = xe_hwmon_curve_attributes_visible;
+}
+
 static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 {
 	int point;
@@ -2075,12 +2414,6 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 	}
 }
 
-static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
-{
-	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
-			USER_FAN_TABLE;
-}
-
 /**
  * xe_hwmon_get_active_table_pwm - Calculate PWM from the active fan curve
  * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
@@ -2278,9 +2611,13 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
 				USER_FAN_TABLE : STOCK_FAN_TABLE;
 
 			ret = xe_hwmon_activate_user_fan_table(hwmon, channel, full_speed, source);
-			if (ret)
+			if (ret) {
 				xe_warn(hwmon->xe, "failed to set fan %d pwm_enable %ld, ret=%d\n",
 					channel, val, ret);
+				break;
+			}
+			fi->fan_table[USER_FAN_TABLE].temp_staged = 0;
+			fi->fan_table[USER_FAN_TABLE].speed_staged = 0;
 		} else if (val == XE_FAN_PWM_AUTO_STOCK_TABLE) {
 			ret = xe_hwmon_fan_set_auto(hwmon, channel);
 			if (ret) {
@@ -2292,6 +2629,8 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
 			xe_dbg(hwmon->xe,
 			       "automatic control enabled for fan %d using stock table\n",
 			       channel);
+			fi->fan_table[USER_FAN_TABLE].temp_staged = 0;
+			fi->fan_table[USER_FAN_TABLE].speed_staged = 0;
 		} else {
 			xe_dbg(hwmon->xe, "invalid pwm%d_enable value %ld\n", channel + 1, val);
 			ret = -EINVAL;
@@ -2543,10 +2882,16 @@ int xe_hwmon_register(struct xe_device *xe)
 
 	drm_dbg(&xe->drm, "Register xe hwmon interface\n");
 
+	hwmon->groups[0] = &hwmon_attrgroup;
+	if (xe->info.has_fan_control) {
+		xe_hwmon_init_curve_attrs(hwmon);
+		hwmon->groups[1] = &hwmon->curve_group;
+	}
+
 	/*  hwmon_dev points to device hwmon<i> */
 	hwmon->hwmon_dev = hwmon_device_register_with_info(dev, "xe", hwmon,
 							   &hwmon_chip_info,
-							   hwmon_groups);
+							   hwmon->groups);
 	if (IS_ERR(hwmon->hwmon_dev)) {
 		ret = PTR_ERR(hwmon->hwmon_dev);
 		xe_log_err(xe, HWMON, ret, "Failed to register xe hwmon\n");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (5 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 21:03   ` Rodrigo Vivi
  2026-11-30 18:50 ` [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Preserve active manual and full-speed fan tables across system suspend,
runtime D3cold, and FLR.

On resume, restore the cached table without waiting for the late-bound
fan-control firmware, which reloads asynchronously. Waiting for it from
the resume path can deadlock against the resume of the MEI device that
loads it. If restoration fails, fall back to stock fan control.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2: Use xe_pcode_read() instead of xe_pcode_read_timeout().

v3:
 - Use u32 for the point index. (Soham)
 - Say "user table point" in suspend warnings. (Soham)
 - Sort the xe_hwmon.h include. (Soham)
 - Call the system PM hooks from xe_device_suspend() and
   xe_device_resume() after the upstream refactor, so FLR also
   restores the table.
 - Check d3cold.allowed only for runtime PM; system suspend always
   loses the table.
 - Pass hwmon to IS_FAN_ENABLED().

v4:
 - Avoid fan-table reads during suspend.
 - Fall back to the stock fan table on user-table restore failure.

v5:
 - Do not flush the late-binding work from xe_late_bind_pm_resume();
   it can deadlock against the MEI device resume. (sashiko)
 - Drop the duplicate stock fallback in xe_hwmon_resume(). (sashiko)

 drivers/gpu/drm/xe/xe_device.c |   3 +
 drivers/gpu/drm/xe/xe_hwmon.c  | 101 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_hwmon.h  |   4 ++
 drivers/gpu/drm/xe/xe_pm.c     |  11 +++-
 4 files changed, 116 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index fccb0eff54ee..066949bee1ac 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -1428,6 +1428,8 @@ int xe_device_suspend(struct xe_device *xe, bool hibernate, bool flr)
 
 	xe_late_bind_pm_suspend(&xe->late_bind);
 
+	xe_hwmon_suspend(xe, false);
+
 	for_each_gt(gt, xe, id)
 		xe_gt_suspend_prepare(gt);
 
@@ -1558,6 +1560,7 @@ int xe_device_resume(struct xe_device *xe, bool flr)
 	xe_pxp_pm_resume(xe->pxp);
 
 	xe_late_bind_pm_resume(&xe->late_bind);
+	xe_hwmon_resume(xe, false);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 857c9d293f09..ea342f12a756 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -217,6 +217,8 @@ struct xe_hwmon_fan_info {
 	u32 max_rps;
 	/** @pwm_enable_mode: current xe_fan_pwm_enable_mode */
 	u8 pwm_enable_mode;
+	/** @restore_user_table: restore user fan table on next resume */
+	bool restore_user_table;
 };
 
 /**
@@ -2920,4 +2922,103 @@ void xe_hwmon_unregister(struct xe_device *xe)
 	hwmon_device_unregister(xe->hwmon->hwmon_dev);
 	xe->hwmon = NULL;
 }
+
+/**
+ * xe_hwmon_suspend - Save hwmon state before suspend
+ * @xe: xe device instance
+ * @runtime: true for runtime suspend, false for system suspend or FLR prepare
+ *
+ * Save any hwmon runtime state that must survive PM suspend transitions.
+ */
+void xe_hwmon_suspend(struct xe_device *xe, bool runtime)
+{
+	struct xe_hwmon *hwmon = READ_ONCE(xe->hwmon);
+	int fan;
+
+	if (!hwmon || !xe->info.has_fan_control)
+		return;
+
+	/* Runtime suspend keeps the fan tables unless the device enters d3cold. */
+	if (runtime && !xe->d3cold.allowed) {
+		xe_dbg(xe, "d3cold not allowed, skipping fan user-table snapshot\n");
+		return;
+	}
+
+	mutex_lock(&hwmon->hwmon_lock);
+
+	for (fan = 0; fan < FAN_MAX; fan++) {
+		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+		u32 point_count = fi->fan_table[USER_FAN_TABLE].point_count;
+
+		if (!IS_FAN_ENABLED(hwmon, fan))
+			continue;
+
+		fi->restore_user_table = false;
+		if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE &&
+		    fi->pwm_enable_mode != XE_FAN_PWM_FULL_SPEED)
+			continue;
+
+		if (point_count < MIN_FAN_CONTROL_POINTS ||
+		    point_count > MAX_FAN_CONTROL_POINTS)
+			continue;
+		fi->restore_user_table = true;
+		xe_dbg(hwmon->xe,
+		       "fan %d cached user table marked for restore, point_count=%u\n", fan,
+		       point_count);
+	}
+
+	mutex_unlock(&hwmon->hwmon_lock);
+}
+
+/**
+ * xe_hwmon_resume - Restore hwmon state after resume
+ * @xe: xe device instance
+ * @runtime: true for runtime resume, false for system resume or FLR done
+ *
+ * Restore any hwmon runtime state that was saved across suspend.
+ */
+void xe_hwmon_resume(struct xe_device *xe, bool runtime)
+{
+	struct xe_hwmon *hwmon = READ_ONCE(xe->hwmon);
+	int fan;
+
+	if (!hwmon || !xe->info.has_fan_control)
+		return;
+
+	if (runtime && !xe->d3cold.allowed) {
+		xe_dbg(xe, "d3cold not allowed, skipping fan user-table restore\n");
+		return;
+	}
+
+	mutex_lock(&hwmon->hwmon_lock);
+
+	for (fan = 0; fan < FAN_MAX; fan++) {
+		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+		int ret;
+
+		if (!IS_FAN_ENABLED(hwmon, fan))
+			continue;
+
+		if (!fi->restore_user_table) {
+			xe_dbg(xe, "fan %d user table restore not required\n", fan);
+			continue;
+		}
+
+		/* Re-program cached user-table settings for fans active before suspend. */
+		ret = xe_hwmon_activate_user_fan_table(hwmon, fan,
+						       fi->pwm_enable_mode == XE_FAN_PWM_FULL_SPEED,
+						       USER_FAN_TABLE);
+		fi->restore_user_table = false;
+		if (ret) {
+			xe_warn(xe, "failed to restore fan %d user table after resume, ret=%d\n",
+				fan, ret);
+			continue;
+		}
+
+		xe_dbg(xe, "fan %d user table restored\n", fan);
+	}
+
+	mutex_unlock(&hwmon->hwmon_lock);
+}
+
 MODULE_IMPORT_NS("INTEL_PMT_TELEMETRY");
diff --git a/drivers/gpu/drm/xe/xe_hwmon.h b/drivers/gpu/drm/xe/xe_hwmon.h
index e67e0134f02a..50874b6b6527 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.h
+++ b/drivers/gpu/drm/xe/xe_hwmon.h
@@ -13,9 +13,13 @@ struct xe_device;
 #if IS_REACHABLE(CONFIG_HWMON)
 int xe_hwmon_register(struct xe_device *xe);
 void xe_hwmon_unregister(struct xe_device *xe);
+void xe_hwmon_suspend(struct xe_device *xe, bool runtime);
+void xe_hwmon_resume(struct xe_device *xe, bool runtime);
 #else
 static inline int xe_hwmon_register(struct xe_device *xe) { return 0; };
 static inline void xe_hwmon_unregister(struct xe_device *xe) { }
+static inline void xe_hwmon_suspend(struct xe_device *xe, bool runtime) {}
+static inline void xe_hwmon_resume(struct xe_device *xe, bool runtime) {}
 #endif
 
 #endif /* _XE_HWMON_H_ */
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index f73f68bd449b..4d4b398cbeda 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -20,6 +20,7 @@
 #include "xe_ggtt.h"
 #include "xe_gt.h"
 #include "xe_gt_idle.h"
+#include "xe_hwmon.h"
 #include "xe_i2c.h"
 #include "xe_irq.h"
 #include "xe_late_bind_fw.h"
@@ -567,6 +568,8 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 	if (err)
 		goto out;
 
+	xe_hwmon_suspend(xe, true);
+
 	/*
 	 * Applying lock for entire list op as xe_ttm_bo_destroy and xe_bo_move_notify
 	 * also checks and deletes bo entry from user fault list.
@@ -683,12 +686,14 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 
 	xe_pxp_pm_resume(xe->pxp);
 
-	if (IS_VF_CCS_READY(xe))
-		xe_sriov_vf_ccs_register_context(xe);
-
 	if (xe->d3cold.allowed)
 		xe_late_bind_pm_resume(&xe->late_bind);
 
+	xe_hwmon_resume(xe, true);
+
+	if (IS_VF_CCS_READY(xe))
+		xe_sriov_vf_ccs_register_context(xe);
+
 out:
 	xe_rpm_lockmap_release(xe);
 	xe_pm_write_callback_task(xe, NULL);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (6 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Refresh cached stock fan tables and maximum RPM for registered fans after
fan-control firmware loads. The stock table can change with the late
bound firmware; keep the previous one if a complete table cannot be
read, and likewise keep the previous maximum RPM if its read fails.
Re-program the user table of fans in manual or full-speed mode.

Serialize the refresh with hwmon registration and teardown. Flush
late binding work before releasing hwmon state, and protect fanN_max reads
against concurrent max_rps updates.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Compare lbfw->id with XE_LB_FW_FAN_CONTROL. (Soham)
 - Use xe already in scope. (Soham)
 - Spell out "late binding" in warnings. (Soham)
 - Start fans enabled after late binding in automatic mode.

v3:
 - Serialize the refresh with hwmon registration and teardown. Flush
   late binding work before releasing hwmon state, and protect
   fanN_max reads against concurrent max_rps updates.

v4:
 - Keep the previous stock table if the refresh does not read a
   complete one.
 - Re-program user tables of fans in manual or full-speed mode after
   late binding.
 - Unregister the hwmon device outside registration_lock, so sysfs
   callbacks resuming the device cannot deadlock with late binding work.
 - Keep the previous max RPM if the refresh read fails.

v5:
 - Fix xe_hwmon_fan_late_binding_update() kernel-doc; it does not read
   the number of fans. (sashiko)
 - Drop a v2 note that does not belong to this patch. (sashiko)
 - Use "late binding" consistently and rename
   xe_hwmon_fan_update_post_lb() to xe_hwmon_fan_late_binding_update().
   (Soham)
 - Use guards for hwmon_lock. (Soham)

 drivers/gpu/drm/xe/xe_hwmon.c        | 99 +++++++++++++++++++++++++---
 drivers/gpu/drm/xe/xe_hwmon.h        |  2 +
 drivers/gpu/drm/xe/xe_late_bind_fw.c |  3 +
 3 files changed, 96 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index ea342f12a756..4ee51cfc9283 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -16,6 +16,7 @@
 #include "regs/xe_pcode_regs.h"
 #include "xe_device.h"
 #include "xe_hwmon.h"
+#include "xe_late_bind_fw.h"
 #include "xe_log.h"
 #include "xe_mmio.h"
 #include "xe_pcode.h"
@@ -257,6 +258,8 @@ struct xe_hwmon {
 	struct device *hwmon_dev;
 	/** @xe: Xe device */
 	struct xe_device *xe;
+	/** @registration_lock: serialize registration with late binding updates */
+	struct mutex registration_lock;
 	/** @hwmon_lock: lock for rw attributes*/
 	struct mutex hwmon_lock;
 	/** @scl_shift_power: pkg power unit */
@@ -291,6 +294,13 @@ struct xe_hwmon {
 	const struct attribute_group *groups[3];
 };
 
+static void xe_hwmon_flush_late_bind(void *arg)
+{
+	struct xe_device *xe = arg;
+
+	xe_late_bind_pm_suspend(&xe->late_bind);
+}
+
 static inline int prepare_power_limit_param2(const struct xe_hwmon *hwmon, int channel)
 {
 	if (hwmon->read_power_limit_from_pcode[channel]) {
@@ -1735,16 +1745,17 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
 		struct fan_control_point stock_fcp[MAX_FAN_CONTROL_POINTS];
 		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
 		u32 stock_fcp_count = 0;
+		u32 max_rps = 0;
 
 		if (!IS_FAN_ENABLED(hwmon, fan))
 			continue;
 
 		ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_MAX_FAN_RPS, fan,
-						      &fi->max_rps);
+						      &max_rps);
 		if (ret) {
-			fi->max_rps = 0;
 			xe_warn(hwmon->xe, "failed to read fan %d max RPS, ret=%d\n", fan, ret);
 		} else {
+			fi->max_rps = max_rps;
 			xe_dbg(hwmon->xe, "fan %d max RPS %u\n", fan, fi->max_rps);
 		}
 
@@ -2409,7 +2420,9 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
 	case hwmon_fan_input:
 		return xe_hwmon_fan_input_read(hwmon, channel, val);
 	case hwmon_fan_max:
-		*val = mul_u32_u32(hwmon->fi[channel].max_rps, 60);
+		scoped_guard(mutex, &hwmon->hwmon_lock) {
+			*val = mul_u32_u32(hwmon->fi[channel].max_rps, 60);
+		}
 		return 0;
 	default:
 		return -EOPNOTSUPP;
@@ -2874,9 +2887,21 @@ int xe_hwmon_register(struct xe_device *xe)
 	if (ret)
 		return ret;
 
+	ret = devm_mutex_init(dev, &hwmon->registration_lock);
+	if (ret)
+		return ret;
+
+	/* Flush late binding work before devm releases the hwmon state it may use. */
+	ret = devm_add_action_or_reset(dev, xe_hwmon_flush_late_bind, xe);
+	if (ret)
+		return ret;
+
+	guard(mutex)(&hwmon->registration_lock);
+
 	/* There's only one instance of hwmon per device */
 	hwmon->xe = xe;
-	xe->hwmon = hwmon;
+	/* Pair with the acquire load in xe_hwmon_fan_late_binding_update(). */
+	smp_store_release(&xe->hwmon, hwmon);
 
 	ret = xe_hwmon_get_preregistration_info(hwmon);
 	if (ret)
@@ -2903,7 +2928,7 @@ int xe_hwmon_register(struct xe_device *xe)
 	return 0;
 
 err_null_hwmon:
-	xe->hwmon = NULL;
+	WRITE_ONCE(xe->hwmon, NULL);
 	return ret;
 }
 
@@ -2916,11 +2941,25 @@ int xe_hwmon_register(struct xe_device *xe)
  */
 void xe_hwmon_unregister(struct xe_device *xe)
 {
-	if (!xe->hwmon)
+	struct xe_hwmon *hwmon;
+
+	/* Stop updates before unregistering hwmon or unplugging the device. */
+	xe_late_bind_pm_suspend(&xe->late_bind);
+
+	hwmon = READ_ONCE(xe->hwmon);
+	if (!hwmon)
 		return;
 
-	hwmon_device_unregister(xe->hwmon->hwmon_dev);
-	xe->hwmon = NULL;
+	mutex_lock(&hwmon->registration_lock);
+	if (READ_ONCE(xe->hwmon) != hwmon) {
+		mutex_unlock(&hwmon->registration_lock);
+		return;
+	}
+	WRITE_ONCE(xe->hwmon, NULL);
+	mutex_unlock(&hwmon->registration_lock);
+
+	/* Sysfs callbacks may resume and wait on late binding work that takes registration_lock. */
+	hwmon_device_unregister(hwmon->hwmon_dev);
 }
 
 /**
@@ -3021,4 +3060,48 @@ void xe_hwmon_resume(struct xe_device *xe, bool runtime)
 	mutex_unlock(&hwmon->hwmon_lock);
 }
 
+/**
+ * xe_hwmon_fan_late_binding_update - Update fan info after late binding
+ * @xe: xe device instance
+ *
+ * Re-read the maximum fan speed and stock fan tables after late binding, and
+ * re-program the user table of fans in manual or full-speed mode.
+ */
+void xe_hwmon_fan_late_binding_update(struct xe_device *xe)
+{
+	/* Pair with the release store in xe_hwmon_register(). */
+	struct xe_hwmon *hwmon = smp_load_acquire(&xe->hwmon);
+	int fan;
+
+	if (!hwmon || !xe->info.has_fan_control)
+		return;
+
+	guard(mutex)(&hwmon->registration_lock);
+	if (READ_ONCE(xe->hwmon) != hwmon)
+		return;
+
+	guard(mutex)(&hwmon->hwmon_lock);
+
+	if (xe_hwmon_read_fan_control_info(hwmon))
+		xe_warn(hwmon->xe, "failed to read stock fan tables after late binding\n");
+
+	for (fan = 0; fan < FAN_MAX; fan++) {
+		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
+		int ret;
+
+		if (!IS_FAN_ENABLED(hwmon, fan) ||
+		    (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE &&
+		     fi->pwm_enable_mode != XE_FAN_PWM_FULL_SPEED))
+			continue;
+
+		ret = xe_hwmon_activate_user_fan_table(hwmon, fan,
+						       fi->pwm_enable_mode == XE_FAN_PWM_FULL_SPEED,
+						       USER_FAN_TABLE);
+		if (ret)
+			xe_warn(hwmon->xe,
+				"failed to restore fan %d user table after late binding, ret=%d\n",
+				fan, ret);
+	}
+}
+
 MODULE_IMPORT_NS("INTEL_PMT_TELEMETRY");
diff --git a/drivers/gpu/drm/xe/xe_hwmon.h b/drivers/gpu/drm/xe/xe_hwmon.h
index 50874b6b6527..ceb3cbe93a5d 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.h
+++ b/drivers/gpu/drm/xe/xe_hwmon.h
@@ -15,11 +15,13 @@ int xe_hwmon_register(struct xe_device *xe);
 void xe_hwmon_unregister(struct xe_device *xe);
 void xe_hwmon_suspend(struct xe_device *xe, bool runtime);
 void xe_hwmon_resume(struct xe_device *xe, bool runtime);
+void xe_hwmon_fan_late_binding_update(struct xe_device *xe);
 #else
 static inline int xe_hwmon_register(struct xe_device *xe) { return 0; };
 static inline void xe_hwmon_unregister(struct xe_device *xe) { }
 static inline void xe_hwmon_suspend(struct xe_device *xe, bool runtime) {}
 static inline void xe_hwmon_resume(struct xe_device *xe, bool runtime) {}
+static inline void xe_hwmon_fan_late_binding_update(struct xe_device *xe) {}
 #endif
 
 #endif /* _XE_HWMON_H_ */
diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c
index ad39383a7e41..b76c18f91849 100644
--- a/drivers/gpu/drm/xe/xe_late_bind_fw.c
+++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c
@@ -14,6 +14,7 @@
 
 #include "xe_configfs.h"
 #include "xe_device.h"
+#include "xe_hwmon.h"
 #include "xe_late_bind_fw.h"
 #include "xe_pcode.h"
 #include "xe_pcode_api.h"
@@ -298,6 +299,8 @@ static void xe_late_bind_work(struct work_struct *work)
 	if (!ret) {
 		drm_dbg(&xe->drm, "Load %s firmware successful\n",
 			fw_id_to_name[lbfw->id]);
+		if (lbfw->id == XE_LB_FW_FAN_CONTROL)
+			xe_hwmon_fan_late_binding_update(xe);
 		goto out;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (7 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 18:50 ` [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
  2026-11-30 20:52 ` ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3) Patchwork
  10 siblings, 0 replies; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Add a device attribute to read and configure firmware TjMax fan control,
which forces maximum fan PWM as SoC temperature approaches TjMax or
GDDR/VR temperature approaches its thermal maximum.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Use one wording for TjMax fan control in the commit message, ABI and
   DOC comment. (Soham)
 - Report only the enable bit. (Soham)
 - Do not expose the attribute on SR-IOV VFs, where pcode access is
   skipped. (sashiko)
 - Drop the probe-time read used for visibility; the command may only
   be supported after fan-control late binding. This also removes the
   uninitialized value passed to xe_pcode_read(). (sashiko)

 .../ABI/testing/sysfs-driver-intel-xe-gpu     | 20 ++++++
 drivers/gpu/drm/xe/xe_device_sysfs.c          | 62 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_pcode_api.h             |  3 +
 3 files changed, 85 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-gpu b/Documentation/ABI/testing/sysfs-driver-intel-xe-gpu
index b563b7e8a9d9..85091d44df9b 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-gpu
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-gpu
@@ -21,6 +21,26 @@ Description:
 		This sysfs file is present only on Crescent Island devices.
 		It is readable by all users.
 
+What:		/sys/bus/pci/drivers/xe/.../tjmax_fan_control_enable
+Date:		November 2026
+KernelVersion:	7.5
+Contact:	intel-xe@lists.freedesktop.org
+Description:
+		RW. Firmware TjMax fan control.
+
+		Write 1 to enable or 0 to disable firmware TjMax fan control,
+		which forces maximum fan PWM as SoC temperature approaches
+		TjMax or GDDR/VR temperature approaches its thermal maximum.
+		Reads return 1 if enabled and 0 otherwise.
+
+		This mode is applied by firmware on top of the hwmon
+		pwm[1-3]_enable selection; hwmon pwm[1-3] and
+		pwm[1-3]_enable do not reflect the override.
+
+		This sysfs file is present only on devices with fan control
+		support, except SR-IOV VFs. Accesses fail with the firmware
+		error if the command is not supported.
+
 What:		/sys/bus/pci/drivers/xe/.../tile<N>/memory/max_freq
 Date:		October 2026
 KernelVersion:	7.5
diff --git a/drivers/gpu/drm/xe/xe_device_sysfs.c b/drivers/gpu/drm/xe/xe_device_sysfs.c
index 9b734aeefd33..87ee91f51977 100644
--- a/drivers/gpu/drm/xe/xe_device_sysfs.c
+++ b/drivers/gpu/drm/xe/xe_device_sysfs.c
@@ -35,6 +35,11 @@
  * lb_voltage_regulator_version - Voltage regulator version provisioned by late
  * binding. Exposed only if supported by the device.
  *
+ * tjmax_fan_control_enable - Report/change firmware TjMax fan control, which
+ * forces maximum fan PWM as SoC temperature approaches TjMax or GDDR/VR
+ * temperature approaches its thermal maximum. Exposed on devices with fan
+ * control support, except SR-IOV VFs.
+ *
  * shrinker_non_purgeable_seeks - Report/change the cost, relative to
  * purgeable buffer objects, of recreating non-purgeable buffer objects
  * reclaimed by the shrinker. Higher values reduce reclaim pressure on
@@ -209,6 +214,57 @@ static const struct attribute_group late_bind_attr_group = {
 	.is_visible = late_bind_attr_is_visible,
 };
 
+static ssize_t
+tjmax_fan_control_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
+	u32 val = 0;
+	int ret;
+
+	guard(xe_pm_runtime)(xe);
+	ret = xe_pcode_read(xe_device_get_root_tile(xe),
+			    PCODE_MBOX(FAN_SPEED_CONTROL, FSC_READ_TJMAX_FAN_CONTROL_MODE, 0),
+			    &val, NULL);
+	drm_dbg(&xe->drm, "pcode READ_TJMAX_FAN_CONTROL_MODE: val %#x, ret %d\n",
+		ret ? 0 : val, ret);
+
+	return ret ?: sysfs_emit(buf, "%u\n", !!(val & TJMAX_FAN_CONTROL_ENABLE));
+}
+
+static ssize_t
+tjmax_fan_control_enable_store(struct device *dev, struct device_attribute *attr,
+			       const char *buf, size_t count)
+{
+	struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
+	u32 val;
+	int ret;
+
+	ret = kstrtou32(buf, 0, &val);
+	if (ret)
+		return ret;
+	if (val > 1)
+		return -EINVAL;
+
+	guard(xe_pm_runtime)(xe);
+	ret = xe_pcode_write(xe_device_get_root_tile(xe),
+			     PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_TJMAX_FAN_CONTROL_MODE, 0),
+			     val);
+	drm_dbg(&xe->drm, "pcode WRITE_TJMAX_FAN_CONTROL_MODE: val %u, ret %d\n", val, ret);
+
+	return ret ?: count;
+}
+static DEVICE_ATTR_RW(tjmax_fan_control_enable);
+
+static struct attribute *fan_control_attrs[] = {
+	&dev_attr_tjmax_fan_control_enable.attr,
+	NULL
+};
+
+/* Not probed: the command may only be supported after fan-control late binding. */
+static const struct attribute_group fan_control_attr_group = {
+	.attrs = fan_control_attrs,
+};
+
 /**
  * DOC: PCIe Gen5 Limitations
  *
@@ -463,5 +519,11 @@ int xe_device_sysfs_init(struct xe_device *xe)
 			return ret;
 	}
 
+	if (xe->info.has_fan_control && !IS_SRIOV_VF(xe)) {
+		ret = devm_device_add_group(dev, &fan_control_attr_group);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h
index bf321ed19251..a217256f9e9d 100644
--- a/drivers/gpu/drm/xe/xe_pcode_api.h
+++ b/drivers/gpu/drm/xe/xe_pcode_api.h
@@ -95,6 +95,9 @@
 #define     FSC_READ_FAN_TABLE			0x7
 #define     FAN_CONTROL_POINT_TEMP_MASK		REG_GENMASK(7, 0)
 #define     FAN_CONTROL_POINT_SPEED_MASK	REG_GENMASK(15, 8)
+#define     FSC_WRITE_TJMAX_FAN_CONTROL_MODE	0x8
+#define     FSC_READ_TJMAX_FAN_CONTROL_MODE	0x9
+#define       TJMAX_FAN_CONTROL_ENABLE		REG_BIT(0)
 
 #define PCODE_SCRATCH(x)		XE_REG(0x138320 + ((x) * 4))
 /* PCODE_SCRATCH0 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (8 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
@ 2026-11-30 18:50 ` Karthik Poosa
  2026-11-30 21:04   ` Rodrigo Vivi
  2026-11-30 20:52 ` ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3) Patchwork
  10 siblings, 1 reply; 17+ messages in thread
From: Karthik Poosa @ 2026-11-30 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

Add kernel-doc for xe hwmon fan control and describe the fan control
model built around firmware stock tables and driver-managed user tables.

Document the exposed sysfs files for fan speed, maximum speed, pwm
control, pwm mode selection, and per-point fan curve temperature/PWM
programming.

This makes the hwmon fan control userspace interface easier to discover
and understand.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---

v2:
 - Clarify the registration-time visibility requirements.
 - Document how late binding affects existing fan attributes.

v3:
 - Document that curve files need a stock table and that tables
   programmed by pwmN_enable modes 0 and 1 follow the curve rules.
 - Document that a failed stock table refresh after late binding keeps
   the previous table.
 - Document -ENODATA reads when the fan control mode is not
   established.
 - Document that a failed completing curve write drops all staged
   points. (Soham)

 drivers/gpu/drm/xe/xe_hwmon.c | 70 +++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 4ee51cfc9283..70a4e4941390 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -140,6 +140,76 @@ struct xe_hwmon_energy_info {
 	long accum_energy;
 };
 
+/**
+ * DOC: Xe fan control
+ *
+ * Xe fan control is exposed through the hwmon pwm and fan interfaces when the
+ * platform advertises PCODE-backed fan management support.
+ *
+ * Attribute visibility is determined during hwmon registration. ``fanN_max``
+ * requires maximum fan speed data, while ``pwmN``, ``pwmN_enable`` and the
+ * ``pwmN_auto_pointM_*`` curve files require a readable stock fan table. Late
+ * binding refreshes cached data for existing fans but does not create
+ * attributes that were hidden at registration. The stock table can change with
+ * the late bound firmware; if a complete table cannot be read, the previous one
+ * is kept.
+ *
+ * The implementation tracks two fan tables per fan:
+ *
+ * - A stock table read from firmware through PCODE.
+ * - A user table cached in the driver and programmed back through PCODE.
+ *
+ * The pwmN_enable sysfs value selects how those tables are used:
+ *
+ * - 0 (``XE_FAN_PWM_FULL_SPEED``) programs the user table at 100 percent duty
+ *   cycle as a full-speed override. The cached user curve is kept.
+ * - 1 (``XE_FAN_PWM_MANUAL_USER_TABLE``) enables the user table for manual
+ *   control. Without a cached user curve, it starts from the stock table.
+ * - 2 (``XE_FAN_PWM_AUTO_STOCK_TABLE``) restores automatic control using the
+ *   stock firmware table. The cached user curve is kept for a later switch to
+ *   mode 1.
+ *
+ * Any table programmed by modes 0 and 1 must meet the curve rules below;
+ * otherwise the mode switch fails with -EINVAL.
+ *
+ * The fan-control sysfs files are:
+ *
+ * - ``fanN_input`` reports the measured fan speed in RPM.
+ * - ``fanN_max`` reports the maximum supported fan speed in RPM.
+ * - ``pwmN`` reads or sets the manual PWM duty cycle in the hwmon 0..255
+ *   range.
+ * - ``pwmN_enable`` selects the mode described above.
+ * - ``pwmN_auto_pointM_temp`` reports the temperature of point ``M`` of the
+ *   stock table in mode 2 or of the user table otherwise, in millidegrees
+ *   Celsius. Writes stage the user-table point.
+ * - ``pwmN_auto_pointM_pwm`` reports the PWM value of point ``M`` of the same
+ *   table in the hwmon 0..255 range. Writes stage the user-table point.
+ *
+ * Writes to ``pwmN``, ``pwmN_auto_pointM_temp`` and ``pwmN_auto_pointM_pwm``
+ * are accepted only while ``pwmN_enable`` is 1; otherwise they fail with
+ * -EINVAL. Firmware stores duty cycle in percent, so PWM values read back
+ * rounded to the nearest percent step. Nonzero curve PWM writes are kept at
+ * least 1 percent so rounding cannot turn them into an end marker.
+ *
+ * Writes to ``pwmN_auto_pointM_temp`` and ``pwmN_auto_pointM_pwm`` are staged
+ * in the driver, so intermediate writes never reach firmware as a partial
+ * curve. The staged curve is committed once points 1..K all have both a
+ * temperature and a PWM value and either point K+1 is set to (0, 0) or K is
+ * the last supported point. The (0, 0) end marker is not part of the curve.
+ * A curve must have at least two points, temperature must increase and PWM
+ * must not decrease from one point to the next; otherwise the completing write
+ * fails with -EINVAL. A completing write that fails drops all staged points.
+ *
+ * Writes to ``pwmN`` replace the user table with a two-point table at a
+ * constant duty cycle.
+ *
+ * If a user-table write is not accepted by firmware, the fan falls back to
+ * mode 2 and the previously cached user curve is kept. If that fallback also
+ * fails, the fan control mode is not established and reads of ``pwmN``,
+ * ``pwmN_enable`` and ``pwmN_auto_pointM_*`` fail with -ENODATA until a mode
+ * is written again.
+ */
+
 /**
  * enum xe_fan_pwm_enable_mode - fan PWM enable modes
  */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache
  2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
@ 2026-11-30 19:04   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-11-30 19:04 UTC (permalink / raw)
  To: Karthik Poosa, intel-xe

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] drm/xe/hwmon: overwritten return status in
  xe_hwmon_read_fan_control_info()
- [Low] drm/xe/hwmon: commit message claims min PWM read removed in v5
--

commit 3b481ee0a99b1ba8da639e856d7c106898545563
Author: Karthik Poosa <karthik.poosa@intel.com>

drm/xe/hwmon: Initialize fan-control backend and table cache

This commit initializes Xe hwmon fan-control support by caching the enabled
fan bitmask from PCODE and reading the stock fan control tables for each
enabled fan.

> Initialize Xe hwmon fan-control support by detecting enabled fans,
> reading stock fan control points and min PWM.

[Severity: Low]
This isn't a bug, but the commit message still mentions reading min PWM,
which was dropped from the patch in v5.

> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 171990602f537..72e176011ea7b 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
[ ... ]
> +static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
> +{
> +	int point;
> +	int fan;
> +	int ret = 0;
> +
> +	for (fan = 0; fan < FAN_MAX; fan++) {
> +		struct fan_control_point stock_fcp[MAX_FAN_CONTROL_POINTS];
> +		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +		u32 stock_fcp_count = 0;
> +
> +		if (!IS_FAN_ENABLED(hwmon, fan))
> +			continue;
> +
> +		ret = xe_hwmon_pcode_read_fan_control(hwmon,
> +						      FSC_READ_STOCK_FAN_CONTROL_POINTS,
> +						      fan, &stock_fcp_count);
> +		if (ret || !stock_fcp_count) {
> +			xe_warn(hwmon->xe,
> +				"fan %d stock table unavailable, ret=%d, point count=%u\n",
> +				fan, ret, ret ? 0 : stock_fcp_count);
> +			continue;
> +		}
[ ... ]
> +		memcpy(fi->fan_table[STOCK_FAN_TABLE].fcp, stock_fcp,
> +		       stock_fcp_count * sizeof(stock_fcp[0]));
> +		fi->fan_table[STOCK_FAN_TABLE].point_count = stock_fcp_count;
> +	}
> +	return ret;
> +}

[Severity: Low]
Does xe_hwmon_read_fan_control_info() return only the last PCODE read status
instead of whether fan control tables are available?

Because ret is reused across the loop and not set when stock_fcp_count is 0,
an error on an earlier fan is overwritten if a higher-numbered fan succeeds,
and returning 0 when all enabled fans report stock_fcp_count == 0 suppresses
the "Fan control tables are not available" warning in
xe_hwmon_get_preregistration_info().  Conversely, if fan 0 succeeds and a
later fan fails (for example on single-fan DG2 cards where fan_enable_mask
is hardcoded to GENMASK(1, 0)), the caller logs that fan control tables are
not available even though fan 0's stock table was initialized.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130185050.36979-1-karthik.poosa@intel.com?part=1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3)
  2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
                   ` (9 preceding siblings ...)
  2026-11-30 18:50 ` [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
@ 2026-11-30 20:52 ` Patchwork
  10 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2026-11-30 20:52 UTC (permalink / raw)
  To: Karthik Poosa; +Cc: intel-xe

== Series Details ==

Series: drm/xe/hwmon: Add fan control support (rev3)
URL   : https://patchwork.freedesktop.org/series/179435/
State : success

== Summary ==

+ trap cleanup EXIT
+ kunitconfigs=('/kernel/drivers/gpu/tests/.kunitconfig' '/kernel/drivers/gpu/drm/xe/.kunitconfig' '/kernel/drivers/gpu/drm/tests/.kunitconfig' '/kernel/drivers/gpu/drm/ttm/tests/.kunitconfig' '/kernel/drivers/dma-buf/.kunitconfig')
+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/tests/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/tests/.kunitconfig
[20:49:46] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[20:49:52] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[20:50:12] Starting KUnit Kernel (1/1)...
[20:50:12] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[20:50:12] ================= gpu_buddy (15 subtests) ==================
[20:50:12] [PASSED] gpu_test_buddy_alloc_limit
[20:50:12] [PASSED] gpu_test_buddy_alloc_optimistic
[20:50:12] [PASSED] gpu_test_buddy_alloc_pessimistic
[20:50:12] [PASSED] gpu_test_buddy_alloc_pathological
[20:50:12] [PASSED] gpu_test_buddy_alloc_contiguous
[20:50:12] [PASSED] gpu_test_buddy_alloc_clear
[20:50:12] [PASSED] gpu_test_buddy_alloc_range
[20:50:12] [PASSED] gpu_test_buddy_alloc_range_bias
[20:50:13] [PASSED] gpu_test_buddy_alloc_range_clear_guard
[20:50:14] [PASSED] gpu_test_buddy_fragmentation_performance
[20:50:14] [PASSED] gpu_test_buddy_dirty_tracker_performance
[20:50:14] [PASSED] gpu_test_buddy_alloc_exceeds_max_order
[20:50:14] [PASSED] gpu_test_buddy_offset_aligned_allocation
[20:50:14] [PASSED] gpu_test_buddy_subtree_offset_alignment_stress
[20:50:14] [PASSED] gpu_test_buddy_addr_to_block
[20:50:14] ==================== [PASSED] gpu_buddy ====================
[20:50:14] ============================================================
[20:50:14] Testing complete. Ran 15 tests: passed: 15
[20:50:14] Elapsed time: 28.025s total, 5.150s configuring, 20.857s building, 1.983s running

+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/drm/xe/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
[20:50:15] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[20:50:17] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[20:50:56] Starting KUnit Kernel (1/1)...
[20:50:56] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[20:50:56] ================= xe_ggtt_iov (9 subtests) =================
[20:50:56] [PASSED] init_shared_pf
[20:50:56] [PASSED] init_partial_overlap
[20:50:56] [PASSED] alloc_usable_pool_low
[20:50:56] [PASSED] alloc_shareable_pool_high
[20:50:56] [PASSED] alloc_partial_overlap
[20:50:56] [PASSED] alloc_partial_overlap_usable_full
[20:50:56] [PASSED] alloc_partial_overlap_shareable_full
[20:50:56] [PASSED] alloc_shareable_pool_unavailable
[20:50:56] [PASSED] alloc_shareable_pool_oversized
[20:50:56] =================== [PASSED] xe_ggtt_iov ===================
[20:50:56] =================== xe_ggtt (3 subtests) ===================
[20:50:56] [PASSED] init_native
[20:50:56] [PASSED] alloc_usable_pool_native
[20:50:56] [PASSED] alloc_usable_pool_oversized
[20:50:56] ===================== [PASSED] xe_ggtt =====================
[20:50:56] ================== guc_buf (11 subtests) ===================
[20:50:56] [PASSED] test_smallest
[20:50:56] [PASSED] test_largest
[20:50:56] [PASSED] test_granular
[20:50:56] [PASSED] test_unique
[20:50:56] [PASSED] test_overlap
[20:50:56] [PASSED] test_reusable
[20:50:56] [PASSED] test_too_big
[20:50:56] [PASSED] test_flush
[20:50:56] [PASSED] test_lookup
[20:50:56] [PASSED] test_data
[20:50:56] [PASSED] test_class
[20:50:56] ===================== [PASSED] guc_buf =====================
[20:50:56] =================== guc_dbm (7 subtests) ===================
[20:50:56] [PASSED] test_empty
[20:50:56] [PASSED] test_default
[20:50:56] ======================== test_size  ========================
[20:50:56] [PASSED] 4
[20:50:56] [PASSED] 8
[20:50:56] [PASSED] 32
[20:50:56] [PASSED] 256
[20:50:56] ==================== [PASSED] test_size ====================
[20:50:56] ======================= test_reuse  ========================
[20:50:56] [PASSED] 4
[20:50:56] [PASSED] 8
[20:50:56] [PASSED] 32
[20:50:56] [PASSED] 256
[20:50:56] =================== [PASSED] test_reuse ====================
[20:50:56] =================== test_range_overlap  ====================
[20:50:56] [PASSED] 4
[20:50:56] [PASSED] 8
[20:50:56] [PASSED] 32
[20:50:56] [PASSED] 256
[20:50:56] =============== [PASSED] test_range_overlap ================
[20:50:56] =================== test_range_compact  ====================
[20:50:56] [PASSED] 4
[20:50:56] [PASSED] 8
[20:50:56] [PASSED] 32
[20:50:56] [PASSED] 256
[20:50:56] =============== [PASSED] test_range_compact ================
[20:50:56] ==================== test_range_spare  =====================
[20:50:56] [PASSED] 4
[20:50:56] [PASSED] 8
[20:50:56] [PASSED] 32
[20:50:56] [PASSED] 256
[20:50:56] ================ [PASSED] test_range_spare =================
[20:50:56] ===================== [PASSED] guc_dbm =====================
[20:50:56] ================== guc_idm (22 subtests) ===================
[20:50:56] [PASSED] bad_init
[20:50:56] [PASSED] no_init
[20:50:56] [PASSED] init_fini
[20:50:56] [PASSED] check_init_small
[20:50:56] [PASSED] check_init_shared
[20:50:56] [PASSED] check_used
[20:50:56] [PASSED] check_quota
[20:50:56] [PASSED] check_all
[20:50:56] [PASSED] check_limits
[20:50:56] [PASSED] check_overlap
[20:50:56] [PASSED] check_overlap_alloc
[20:50:56] [PASSED] check_overlap_release
[20:50:56] [PASSED] check_overlap_partial_init
[20:50:56] [PASSED] check_overlap_partial_shared_range_blocking
[20:50:56] [PASSED] check_used_usable
[20:50:56] [PASSED] check_used_shareable
[20:50:56] [PASSED] check_used_mixed
[20:50:56] [PASSED] check_release_usable_range
[20:50:56] [PASSED] check_release_shareable_range
[20:50:56] [PASSED] check_split_boundaries
[20:50:56] [PASSED] check_shareable_spare
[20:50:56] [PASSED] check_shareable_spare_fragmented_tail
[20:50:56] ===================== [PASSED] guc_idm =====================
[20:50:56] ============== guc_klv_helpers (13 subtests) ===============
[20:50:56] [PASSED] test_count
[20:50:56] [PASSED] test_encode_u32
[20:50:56] [PASSED] test_encode_u64
[20:50:56] [PASSED] test_encode_string
[20:50:56] [PASSED] test_encode_object_raw
[20:50:56] [PASSED] test_encode_object_klv
[20:50:56] [PASSED] test_encode_object_nested
[20:50:56] [PASSED] test_encode_object_basic
[20:50:56] ===================== test_decode_u16  =====================
[20:50:56] [PASSED] empty
[20:50:56] [PASSED] valid
[20:50:56] [PASSED] max
[20:50:56] [PASSED] big
[20:50:56] [PASSED] long
[20:50:56] ================= [PASSED] test_decode_u16 =================
[20:50:56] ===================== test_decode_u32  =====================
[20:50:56] [PASSED] empty
[20:50:56] [PASSED] valid
[20:50:56] [PASSED] max
[20:50:56] [PASSED] long
[20:50:56] ================= [PASSED] test_decode_u32 =================
[20:50:56] ===================== test_decode_u64  =====================
[20:50:56] [PASSED] empty
[20:50:56] [PASSED] short
[20:50:56] [PASSED] valid
[20:50:56] [PASSED] max
[20:50:56] [PASSED] long
[20:50:56] ================= [PASSED] test_decode_u64 =================
[20:50:56] ===================== test_decode_str  =====================
[20:50:56] [PASSED] empty
[20:50:56] [PASSED] one
[20:50:56] [PASSED] one_trash
[20:50:56] [PASSED] two
[20:50:56] [PASSED] two_trash
[20:50:56] [PASSED] three
[20:50:56] [PASSED] dword
[20:50:56] [PASSED] four
[20:50:56] [PASSED] five
[20:50:56] [PASSED] six
[20:50:56] [PASSED] seven
[20:50:56] [PASSED] qword
[20:50:56] ================= [PASSED] test_decode_str =================
[20:50:56] [PASSED] test_print
[20:50:56] ================= [PASSED] guc_klv_helpers =================
[20:50:56] =================== xe_log (6 subtests) ====================
[20:50:56] [PASSED] demo_cper
[20:50:56] [PASSED] demo_dmesg
[20:50:56] [PASSED] test_cper_null_xe
[20:50:56] ======================= test_dmesg  ========================
[20:50:56] [PASSED] test_fatal
[20:50:56] [PASSED] test_fatal_tile
[20:50:56] [PASSED] test_fatal_gt
[20:50:56] [PASSED] test_fatal_comp
[20:50:56] [PASSED] test_fatal_comp_tile
[20:50:56] [PASSED] test_fatal_comp_gt
[20:50:56] [PASSED] test_fatal_all
[20:50:56] [PASSED] test_recoverable
[20:50:56] [PASSED] test_recoverable_tile
[20:50:56] [PASSED] test_recoverable_gt
[20:50:56] [PASSED] test_recoverable_comp
[20:50:56] [PASSED] test_recoverable_comp_tile
[20:50:56] [PASSED] test_recoverable_comp_gt
[20:50:56] [PASSED] test_recoverable_all
[20:50:56] [PASSED] test_info
[20:50:56] [PASSED] test_info_tile
[20:50:56] [PASSED] test_info_gt
[20:50:56] [PASSED] test_info_err
[20:50:56] [PASSED] test_info_comp
[20:50:56] [PASSED] test_info_comp_tile
[20:50:56] [PASSED] test_info_comp_gt
[20:50:56] [PASSED] test_info_all
[20:50:56] [PASSED] test_hw_fatal
[20:50:56] [PASSED] test_hw_recoverable
[20:50:56] [PASSED] test_hw_corrected
[20:50:56] [PASSED] test_hw_informational
[20:50:56] =================== [PASSED] test_dmesg ====================
[20:50:56] ====================== test_sw_cper  =======================
[20:50:56] [PASSED] sw-fatal-errno
[20:50:56] [PASSED] sw-recoverable-errno
[20:50:56] [PASSED] sw-corrected
[20:50:56] [PASSED] sw-informational
[20:50:56] [PASSED] sw-with-error-class
[20:50:56] ================== [PASSED] test_sw_cper ===================
[20:50:56] ====================== test_invalid  =======================
[20:50:56] [SKIPPED] no-component no-location no-warn (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] reserved location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] unknown location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] nonzero-device-id location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] invalid-tile-id location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] invalid-gt-id location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] unknown component class (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] unknown system component (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] unknown hardware component (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] [SKIPPED] unknown component and location (requires CONFIG_DRM_XE_DEBUG)
[20:50:56] ================== [SKIPPED] test_invalid ==================
[20:50:56] ===================== [PASSED] xe_log ======================
[20:50:56] ================== no_relay (3 subtests) ===================
[20:50:56] [PASSED] xe_drops_guc2pf_if_not_ready
[20:50:56] [PASSED] xe_drops_guc2vf_if_not_ready
[20:50:56] [PASSED] xe_rejects_send_if_not_ready
[20:50:56] ==================== [PASSED] no_relay =====================
[20:50:56] ================== pf_relay (14 subtests) ==================
[20:50:56] [PASSED] pf_rejects_guc2pf_too_short
[20:50:56] [PASSED] pf_rejects_guc2pf_too_long
[20:50:56] [PASSED] pf_rejects_guc2pf_no_payload
[20:50:56] [PASSED] pf_fails_no_payload
[20:50:56] [PASSED] pf_fails_bad_origin
[20:50:56] [PASSED] pf_fails_bad_type
[20:50:56] [PASSED] pf_txn_reports_error
[20:50:56] [PASSED] pf_txn_sends_pf2guc
[20:50:56] [PASSED] pf_sends_pf2guc
[20:50:56] [SKIPPED] pf_loopback_nop (requires CONFIG_DRM_XE_DEBUG_SRIOV)
[20:50:56] [SKIPPED] pf_loopback_echo (requires CONFIG_DRM_XE_DEBUG_SRIOV)
[20:50:56] [SKIPPED] pf_loopback_fail (requires CONFIG_DRM_XE_DEBUG_SRIOV)
[20:50:56] [SKIPPED] pf_loopback_busy (requires CONFIG_DRM_XE_DEBUG_SRIOV)
[20:50:56] [SKIPPED] pf_loopback_retry (requires CONFIG_DRM_XE_DEBUG_SRIOV)
[20:50:56] ==================== [PASSED] pf_relay =====================
[20:50:56] ================== vf_relay (3 subtests) ===================
[20:50:56] [PASSED] vf_rejects_guc2vf_too_short
[20:50:56] [PASSED] vf_rejects_guc2vf_too_long
[20:50:56] [PASSED] vf_rejects_guc2vf_no_payload
[20:50:56] ==================== [PASSED] vf_relay =====================
[20:50:56] ================ pf_gt_config (9 subtests) =================
[20:50:56] [PASSED] fair_contexts_1vf
[20:50:56] [PASSED] fair_doorbells_1vf
[20:50:56] [PASSED] fair_ggtt_1vf
[20:50:56] ====================== fair_vram_1vf  ======================
[20:50:56] [PASSED] 3.50 GiB
[20:50:56] [PASSED] 11.5 GiB
[20:50:56] [PASSED] 15.5 GiB
[20:50:56] [PASSED] 31.5 GiB
[20:50:56] [PASSED] 63.5 GiB
[20:50:56] [PASSED] 1.91 GiB
[20:50:56] ================== [PASSED] fair_vram_1vf ==================
[20:50:56] ================ fair_vram_1vf_admin_only  =================
[20:50:56] [PASSED] 3.50 GiB
[20:50:56] [PASSED] 11.5 GiB
[20:50:56] [PASSED] 15.5 GiB
[20:50:56] [PASSED] 31.5 GiB
[20:50:56] [PASSED] 63.5 GiB
[20:50:56] [PASSED] 1.91 GiB
[20:50:56] ============ [PASSED] fair_vram_1vf_admin_only =============
[20:50:56] ====================== fair_contexts  ======================
[20:50:56] [PASSED] 1 VF
[20:50:56] [PASSED] 2 VFs
[20:50:56] [PASSED] 3 VFs
[20:50:56] [PASSED] 4 VFs
[20:50:56] [PASSED] 5 VFs
[20:50:56] [PASSED] 6 VFs
[20:50:56] [PASSED] 7 VFs
[20:50:56] [PASSED] 8 VFs
[20:50:56] [PASSED] 9 VFs
[20:50:56] [PASSED] 10 VFs
[20:50:56] [PASSED] 11 VFs
[20:50:56] [PASSED] 12 VFs
[20:50:56] [PASSED] 13 VFs
[20:50:56] [PASSED] 14 VFs
[20:50:56] [PASSED] 15 VFs
[20:50:56] [PASSED] 16 VFs
[20:50:56] [PASSED] 17 VFs
[20:50:56] [PASSED] 18 VFs
[20:50:56] [PASSED] 19 VFs
[20:50:56] [PASSED] 20 VFs
[20:50:56] [PASSED] 21 VFs
[20:50:56] [PASSED] 22 VFs
[20:50:56] [PASSED] 23 VFs
[20:50:56] [PASSED] 24 VFs
[20:50:56] [PASSED] 25 VFs
[20:50:56] [PASSED] 26 VFs
[20:50:56] [PASSED] 27 VFs
[20:50:56] [PASSED] 28 VFs
[20:50:56] [PASSED] 29 VFs
[20:50:56] [PASSED] 30 VFs
[20:50:56] [PASSED] 31 VFs
[20:50:56] [PASSED] 32 VFs
[20:50:56] [PASSED] 33 VFs
[20:50:56] [PASSED] 34 VFs
[20:50:56] [PASSED] 35 VFs
[20:50:56] [PASSED] 36 VFs
[20:50:56] [PASSED] 37 VFs
[20:50:56] [PASSED] 38 VFs
[20:50:56] [PASSED] 39 VFs
[20:50:56] [PASSED] 40 VFs
[20:50:56] [PASSED] 41 VFs
[20:50:56] [PASSED] 42 VFs
[20:50:56] [PASSED] 43 VFs
[20:50:56] [PASSED] 44 VFs
[20:50:56] [PASSED] 45 VFs
[20:50:56] [PASSED] 46 VFs
[20:50:56] [PASSED] 47 VFs
[20:50:56] [PASSED] 48 VFs
[20:50:56] [PASSED] 49 VFs
[20:50:56] [PASSED] 50 VFs
[20:50:56] [PASSED] 51 VFs
[20:50:56] [PASSED] 52 VFs
[20:50:56] [PASSED] 53 VFs
[20:50:56] [PASSED] 54 VFs
[20:50:56] [PASSED] 55 VFs
[20:50:56] [PASSED] 56 VFs
[20:50:56] [PASSED] 57 VFs
[20:50:56] [PASSED] 58 VFs
[20:50:56] [PASSED] 59 VFs
[20:50:56] [PASSED] 60 VFs
[20:50:56] [PASSED] 61 VFs
[20:50:56] [PASSED] 62 VFs
[20:50:56] [PASSED] 63 VFs
[20:50:56] ================== [PASSED] fair_contexts ==================
[20:50:56] ===================== fair_doorbells  ======================
[20:50:56] [PASSED] 1 VF
[20:50:56] [PASSED] 2 VFs
[20:50:56] [PASSED] 3 VFs
[20:50:56] [PASSED] 4 VFs
[20:50:56] [PASSED] 5 VFs
[20:50:56] [PASSED] 6 VFs
[20:50:56] [PASSED] 7 VFs
[20:50:56] [PASSED] 8 VFs
[20:50:56] [PASSED] 9 VFs
[20:50:56] [PASSED] 10 VFs
[20:50:56] [PASSED] 11 VFs
[20:50:56] [PASSED] 12 VFs
[20:50:56] [PASSED] 13 VFs
[20:50:56] [PASSED] 14 VFs
[20:50:56] [PASSED] 15 VFs
[20:50:56] [PASSED] 16 VFs
[20:50:56] [PASSED] 17 VFs
[20:50:56] [PASSED] 18 VFs
[20:50:56] [PASSED] 19 VFs
[20:50:56] [PASSED] 20 VFs
[20:50:56] [PASSED] 21 VFs
[20:50:56] [PASSED] 22 VFs
[20:50:56] [PASSED] 23 VFs
[20:50:56] [PASSED] 24 VFs
[20:50:56] [PASSED] 25 VFs
[20:50:56] [PASSED] 26 VFs
[20:50:56] [PASSED] 27 VFs
[20:50:56] [PASSED] 28 VFs
[20:50:56] [PASSED] 29 VFs
[20:50:56] [PASSED] 30 VFs
[20:50:56] [PASSED] 31 VFs
[20:50:56] [PASSED] 32 VFs
[20:50:56] [PASSED] 33 VFs
[20:50:56] [PASSED] 34 VFs
[20:50:56] [PASSED] 35 VFs
[20:50:56] [PASSED] 36 VFs
[20:50:56] [PASSED] 37 VFs
[20:50:56] [PASSED] 38 VFs
[20:50:56] [PASSED] 39 VFs
[20:50:56] [PASSED] 40 VFs
[20:50:56] [PASSED] 41 VFs
[20:50:56] [PASSED] 42 VFs
[20:50:56] [PASSED] 43 VFs
[20:50:56] [PASSED] 44 VFs
[20:50:56] [PASSED] 45 VFs
[20:50:56] [PASSED] 46 VFs
[20:50:56] [PASSED] 47 VFs
[20:50:56] [PASSED] 48 VFs
[20:50:56] [PASSED] 49 VFs
[20:50:56] [PASSED] 50 VFs
[20:50:56] [PASSED] 51 VFs
[20:50:56] [PASSED] 52 VFs
[20:50:56] [PASSED] 53 VFs
[20:50:56] [PASSED] 54 VFs
[20:50:56] [PASSED] 55 VFs
[20:50:56] [PASSED] 56 VFs
[20:50:56] [PASSED] 57 VFs
[20:50:56] [PASSED] 58 VFs
[20:50:56] [PASSED] 59 VFs
[20:50:56] [PASSED] 60 VFs
[20:50:56] [PASSED] 61 VFs
[20:50:56] [PASSED] 62 VFs
[20:50:56] [PASSED] 63 VFs
[20:50:56] ================= [PASSED] fair_doorbells ==================
[20:50:56] ======================== fair_ggtt  ========================
[20:50:56] [PASSED] 1 VF
[20:50:56] [PASSED] 2 VFs
[20:50:56] [PASSED] 3 VFs
[20:50:56] [PASSED] 4 VFs
[20:50:56] [PASSED] 5 VFs
[20:50:56] [PASSED] 6 VFs
[20:50:56] [PASSED] 7 VFs
[20:50:56] [PASSED] 8 VFs
[20:50:56] [PASSED] 9 VFs
[20:50:56] [PASSED] 10 VFs
[20:50:56] [PASSED] 11 VFs
[20:50:56] [PASSED] 12 VFs
[20:50:56] [PASSED] 13 VFs
[20:50:56] [PASSED] 14 VFs
[20:50:56] [PASSED] 15 VFs
[20:50:56] [PASSED] 16 VFs
[20:50:56] [PASSED] 17 VFs
[20:50:56] [PASSED] 18 VFs
[20:50:56] [PASSED] 19 VFs
[20:50:56] [PASSED] 20 VFs
[20:50:56] [PASSED] 21 VFs
[20:50:56] [PASSED] 22 VFs
[20:50:56] [PASSED] 23 VFs
[20:50:56] [PASSED] 24 VFs
[20:50:56] [PASSED] 25 VFs
[20:50:56] [PASSED] 26 VFs
[20:50:56] [PASSED] 27 VFs
[20:50:56] [PASSED] 28 VFs
[20:50:56] [PASSED] 29 VFs
[20:50:56] [PASSED] 30 VFs
[20:50:56] [PASSED] 31 VFs
[20:50:56] [PASSED] 32 VFs
[20:50:56] [PASSED] 33 VFs
[20:50:56] [PASSED] 34 VFs
[20:50:56] [PASSED] 35 VFs
[20:50:56] [PASSED] 36 VFs
[20:50:56] [PASSED] 37 VFs
[20:50:56] [PASSED] 38 VFs
[20:50:56] [PASSED] 39 VFs
[20:50:56] [PASSED] 40 VFs
[20:50:56] [PASSED] 41 VFs
[20:50:56] [PASSED] 42 VFs
[20:50:56] [PASSED] 43 VFs
[20:50:56] [PASSED] 44 VFs
[20:50:56] [PASSED] 45 VFs
[20:50:56] [PASSED] 46 VFs
[20:50:56] [PASSED] 47 VFs
[20:50:56] [PASSED] 48 VFs
[20:50:56] [PASSED] 49 VFs
[20:50:56] [PASSED] 50 VFs
[20:50:56] [PASSED] 51 VFs
[20:50:56] [PASSED] 52 VFs
[20:50:56] [PASSED] 53 VFs
[20:50:56] [PASSED] 54 VFs
[20:50:56] [PASSED] 55 VFs
[20:50:56] [PASSED] 56 VFs
[20:50:56] [PASSED] 57 VFs
[20:50:56] [PASSED] 58 VFs
[20:50:56] [PASSED] 59 VFs
[20:50:56] [PASSED] 60 VFs
[20:50:56] [PASSED] 61 VFs
[20:50:56] [PASSED] 62 VFs
[20:50:56] [PASSED] 63 VFs
[20:50:56] ==================== [PASSED] fair_ggtt ====================
[20:50:56] ======================== fair_vram  ========================
[20:50:56] [PASSED] 1 VF
[20:50:56] [PASSED] 2 VFs
[20:50:56] [PASSED] 3 VFs
[20:50:56] [PASSED] 4 VFs
[20:50:56] [PASSED] 5 VFs
[20:50:56] [PASSED] 6 VFs
[20:50:56] [PASSED] 7 VFs
[20:50:56] [PASSED] 8 VFs
[20:50:56] [PASSED] 9 VFs
[20:50:56] [PASSED] 10 VFs
[20:50:56] [PASSED] 11 VFs
[20:50:56] [PASSED] 12 VFs
[20:50:56] [PASSED] 13 VFs
[20:50:56] [PASSED] 14 VFs
[20:50:56] [PASSED] 15 VFs
[20:50:56] [PASSED] 16 VFs
[20:50:56] [PASSED] 17 VFs
[20:50:56] [PASSED] 18 VFs
[20:50:56] [PASSED] 19 VFs
[20:50:56] [PASSED] 20 VFs
[20:50:56] [PASSED] 21 VFs
[20:50:56] [PASSED] 22 VFs
[20:50:56] [PASSED] 23 VFs
[20:50:56] [PASSED] 24 VFs
[20:50:56] [PASSED] 25 VFs
[20:50:56] [PASSED] 26 VFs
[20:50:56] [PASSED] 27 VFs
[20:50:56] [PASSED] 28 VFs
[20:50:56] [PASSED] 29 VFs
[20:50:56] [PASSED] 30 VFs
[20:50:56] [PASSED] 31 VFs
[20:50:56] [PASSED] 32 VFs
[20:50:56] [PASSED] 33 VFs
[20:50:56] [PASSED] 34 VFs
[20:50:56] [PASSED] 35 VFs
[20:50:56] [PASSED] 36 VFs
[20:50:56] [PASSED] 37 VFs
[20:50:56] [PASSED] 38 VFs
[20:50:56] [PASSED] 39 VFs
[20:50:56] [PASSED] 40 VFs
[20:50:56] [PASSED] 41 VFs
[20:50:56] [PASSED] 42 VFs
[20:50:56] [PASSED] 43 VFs
[20:50:56] [PASSED] 44 VFs
[20:50:56] [PASSED] 45 VFs
[20:50:56] [PASSED] 46 VFs
[20:50:56] [PASSED] 47 VFs
[20:50:56] [PASSED] 48 VFs
[20:50:56] [PASSED] 49 VFs
[20:50:56] [PASSED] 50 VFs
[20:50:56] [PASSED] 51 VFs
[20:50:56] [PASSED] 52 VFs
[20:50:56] [PASSED] 53 VFs
[20:50:56] [PASSED] 54 VFs
[20:50:56] [PASSED] 55 VFs
[20:50:56] [PASSED] 56 VFs
[20:50:56] [PASSED] 57 VFs
[20:50:56] [PASSED] 58 VFs
[20:50:56] [PASSED] 59 VFs
[20:50:56] [PASSED] 60 VFs
[20:50:56] [PASSED] 61 VFs
[20:50:56] [PASSED] 62 VFs
[20:50:56] [PASSED] 63 VFs
[20:50:56] ==================== [PASSED] fair_vram ====================
[20:50:56] ================== [PASSED] pf_gt_config ===================
[20:50:56] ===================== lmtt (1 subtest) =====================
[20:50:56] ======================== test_ops  =========================
[20:50:56] [PASSED] 2-level
[20:50:56] [PASSED] multi-level
[20:50:56] ==================== [PASSED] test_ops =====================
[20:50:56] ====================== [PASSED] lmtt =======================
[20:50:56] ================= sriov_packet (1 subtest) =================
[20:50:56] [PASSED] test_descriptor_init
[20:50:56] ================== [PASSED] sriov_packet ===================
[20:50:56] ================= pf_service (11 subtests) =================
[20:50:56] [PASSED] pf_negotiate_any
[20:50:56] [PASSED] pf_negotiate_base_match
[20:50:56] [PASSED] pf_negotiate_base_newer
[20:50:56] [PASSED] pf_negotiate_base_next
[20:50:56] [SKIPPED] pf_negotiate_base_older (no older minor)
[20:50:56] [PASSED] pf_negotiate_base_prev
[20:50:56] [PASSED] pf_negotiate_latest_match
[20:50:56] [PASSED] pf_negotiate_latest_newer
[20:50:56] [PASSED] pf_negotiate_latest_next
[20:50:56] [SKIPPED] pf_negotiate_latest_older (no older minor)
[20:50:56] [SKIPPED] pf_negotiate_latest_prev (no prev major)
[20:50:56] =================== [PASSED] pf_service ====================
[20:50:56] ================= xe_guc_g2g (2 subtests) ==================
[20:50:56] ============== xe_live_guc_g2g_kunit_default  ==============
[20:50:56] ========= [SKIPPED] xe_live_guc_g2g_kunit_default ==========
[20:50:56] ============== xe_live_guc_g2g_kunit_allmem  ===============
[20:50:56] ========== [SKIPPED] xe_live_guc_g2g_kunit_allmem ==========
[20:50:56] =================== [SKIPPED] xe_guc_g2g ===================
[20:50:56] =================== xe_mocs (2 subtests) ===================
[20:50:56] ================ xe_live_mocs_kernel_kunit  ================
[20:50:56] =========== [SKIPPED] xe_live_mocs_kernel_kunit ============
[20:50:56] ================ xe_live_mocs_reset_kunit  =================
[20:50:56] ============ [SKIPPED] xe_live_mocs_reset_kunit ============
[20:50:56] ==================== [SKIPPED] xe_mocs =====================
[20:50:56] ================= xe_migrate (3 subtests) ==================
[20:50:56] ================= xe_migrate_sanity_kunit  =================
[20:50:56] ============ [SKIPPED] xe_migrate_sanity_kunit =============
[20:50:56] ================== xe_validate_ccs_kunit  ==================
[20:50:56] ============= [SKIPPED] xe_validate_ccs_kunit ==============
[20:50:56] ============= xe_migrate_access_memory_kunit  ==============
[20:50:56] ========= [SKIPPED] xe_migrate_access_memory_kunit =========
[20:50:56] =================== [SKIPPED] xe_migrate ===================
[20:50:56] ================== xe_dma_buf (1 subtest) ==================
[20:50:56] ==================== xe_dma_buf_kunit  =====================
[20:50:56] ================ [SKIPPED] xe_dma_buf_kunit ================
[20:50:56] =================== [SKIPPED] xe_dma_buf ===================
[20:50:56] ================= xe_bo_shrink (1 subtest) =================
[20:50:56] =================== xe_bo_shrink_kunit  ====================
[20:50:56] =============== [SKIPPED] xe_bo_shrink_kunit ===============
[20:50:56] ================== [SKIPPED] xe_bo_shrink ==================
[20:50:56] ==================== xe_bo (2 subtests) ====================
[20:50:56] ================== xe_ccs_migrate_kunit  ===================
[20:50:56] ============== [SKIPPED] xe_ccs_migrate_kunit ==============
[20:50:56] ==================== xe_bo_evict_kunit  ====================
[20:50:56] =============== [SKIPPED] xe_bo_evict_kunit ================
[20:50:56] ===================== [SKIPPED] xe_bo ======================
[20:50:56] =================== xe_any (9 subtests) ====================
[20:50:56] [PASSED] test_to_xe
[20:50:56] [PASSED] test_to_dev
[20:50:56] [PASSED] test_to_pdev
[20:50:56] [PASSED] test_to_drm
[20:50:56] [PASSED] test_if_pdev
[20:50:56] [PASSED] test_if_xe
[20:50:56] [PASSED] test_if_tile
[20:50:56] [PASSED] test_if_gt
[20:50:56] [PASSED] test_to_id
[20:50:56] ===================== [PASSED] xe_any ======================
[20:50:56] ==================== args (13 subtests) ====================
[20:50:56] [PASSED] count_args_test
[20:50:56] [PASSED] call_args_example
[20:50:56] [PASSED] call_args_test
[20:50:56] [PASSED] drop_first_arg_example
[20:50:56] [PASSED] drop_first_arg_test
[20:50:56] [PASSED] first_arg_example
[20:50:56] [PASSED] first_arg_test
[20:50:56] [PASSED] last_arg_example
[20:50:56] [PASSED] last_arg_test
[20:50:56] [PASSED] pick_arg_example
[20:50:56] [PASSED] if_args_example
[20:50:56] [PASSED] if_args_test
[20:50:56] [PASSED] sep_comma_example
[20:50:56] ====================== [PASSED] args =======================
[20:50:56] =================== xe_pci (3 subtests) ====================
[20:50:56] ==================== check_graphics_ip  ====================
[20:50:56] [PASSED] 12.00 Xe_LP
[20:50:56] [PASSED] 12.10 Xe_LP+
[20:50:56] [PASSED] 12.55 Xe_HPG
[20:50:56] [PASSED] 12.60 Xe_HPC
[20:50:56] [PASSED] 12.70 Xe_LPG
[20:50:56] [PASSED] 12.71 Xe_LPG
[20:50:56] [PASSED] 12.74 Xe_LPG+
[20:50:56] [PASSED] 20.01 Xe2_HPG
[20:50:56] [PASSED] 20.02 Xe2_HPG
[20:50:56] [PASSED] 20.04 Xe2_LPG
[20:50:56] [PASSED] 30.00 Xe3_LPG
[20:50:56] [PASSED] 30.01 Xe3_LPG
[20:50:56] [PASSED] 30.03 Xe3_LPG
[20:50:56] [PASSED] 30.04 Xe3_LPG
[20:50:56] [PASSED] 30.05 Xe3_LPG
[20:50:56] [PASSED] 35.10 Xe3p_LPG
[20:50:56] [PASSED] 35.11 Xe3p_XPC
[20:50:56] ================ [PASSED] check_graphics_ip ================
[20:50:56] ===================== check_media_ip  ======================
[20:50:56] [PASSED] 12.00 Xe_M
[20:50:56] [PASSED] 12.55 Xe_HPM
[20:50:56] [PASSED] 13.00 Xe_LPM+
[20:50:56] [PASSED] 13.01 Xe2_HPM
[20:50:56] [PASSED] 20.00 Xe2_LPM
[20:50:56] [PASSED] 30.00 Xe3_LPM
[20:50:56] [PASSED] 30.02 Xe3_LPM
[20:50:56] [PASSED] 35.00 Xe3p_LPM
[20:50:56] [PASSED] 35.03 Xe3p_HPM
[20:50:56] ================= [PASSED] check_media_ip ==================
[20:50:56] =================== check_platform_desc  ===================
[20:50:56] [PASSED] 0x9A60 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A68 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A70 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A40 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A49 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A59 (TIGERLAKE)
[20:50:56] [PASSED] 0x9A78 (TIGERLAKE)
[20:50:56] [PASSED] 0x9AC0 (TIGERLAKE)
[20:50:56] [PASSED] 0x9AC9 (TIGERLAKE)
[20:50:56] [PASSED] 0x9AD9 (TIGERLAKE)
[20:50:56] [PASSED] 0x9AF8 (TIGERLAKE)
[20:50:56] [PASSED] 0x4C80 (ROCKETLAKE)
[20:50:56] [PASSED] 0x4C8A (ROCKETLAKE)
[20:50:56] [PASSED] 0x4C8B (ROCKETLAKE)
[20:50:56] [PASSED] 0x4C8C (ROCKETLAKE)
[20:50:56] [PASSED] 0x4C90 (ROCKETLAKE)
[20:50:56] [PASSED] 0x4C9A (ROCKETLAKE)
[20:50:56] [PASSED] 0x4680 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4682 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4688 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x468A (ALDERLAKE_S)
[20:50:56] [PASSED] 0x468B (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4690 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4692 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4693 (ALDERLAKE_S)
[20:50:56] [PASSED] 0x46A0 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46A1 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46A2 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46A3 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46A6 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46A8 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46AA (ALDERLAKE_P)
[20:50:56] [PASSED] 0x462A (ALDERLAKE_P)
[20:50:56] [PASSED] 0x4626 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x4628 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46B0 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46B1 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46B2 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46B3 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46C0 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46C1 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46C2 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46C3 (ALDERLAKE_P)
[20:50:56] [PASSED] 0x46D0 (ALDERLAKE_N)
[20:50:56] [PASSED] 0x46D1 (ALDERLAKE_N)
[20:50:56] [PASSED] 0x46D2 (ALDERLAKE_N)
[20:50:56] [PASSED] 0x46D3 (ALDERLAKE_N)
[20:50:56] [PASSED] 0x46D4 (ALDERLAKE_N)
[20:50:56] [PASSED] 0xA721 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7A1 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7A9 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7AC (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7AD (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA720 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7A0 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7A8 (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7AA (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA7AB (ALDERLAKE_P)
[20:50:56] [PASSED] 0xA780 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA781 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA782 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA783 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA788 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA789 (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA78A (ALDERLAKE_S)
[20:50:56] [PASSED] 0xA78B (ALDERLAKE_S)
[20:50:56] [PASSED] 0x4905 (DG1)
[20:50:56] [PASSED] 0x4906 (DG1)
[20:50:56] [PASSED] 0x4907 (DG1)
[20:50:56] [PASSED] 0x4908 (DG1)
[20:50:56] [PASSED] 0x4909 (DG1)
[20:50:56] [PASSED] 0x56C0 (DG2)
[20:50:56] [PASSED] 0x56C2 (DG2)
[20:50:56] [PASSED] 0x56C1 (DG2)
[20:50:56] [PASSED] 0x7D51 (METEORLAKE)
[20:50:56] [PASSED] 0x7DD1 (METEORLAKE)
[20:50:56] [PASSED] 0x7D41 (METEORLAKE)
[20:50:56] [PASSED] 0x7D67 (METEORLAKE)
[20:50:56] [PASSED] 0xB640 (METEORLAKE)
[20:50:56] [PASSED] 0x56A0 (DG2)
[20:50:56] [PASSED] 0x56A1 (DG2)
[20:50:56] [PASSED] 0x56A2 (DG2)
[20:50:56] [PASSED] 0x56BE (DG2)
[20:50:56] [PASSED] 0x56BF (DG2)
[20:50:56] [PASSED] 0x5690 (DG2)
[20:50:56] [PASSED] 0x5691 (DG2)
[20:50:56] [PASSED] 0x5692 (DG2)
[20:50:56] [PASSED] 0x56A5 (DG2)
[20:50:56] [PASSED] 0x56A6 (DG2)
[20:50:56] [PASSED] 0x56B0 (DG2)
[20:50:56] [PASSED] 0x56B1 (DG2)
[20:50:56] [PASSED] 0x56BA (DG2)
[20:50:56] [PASSED] 0x56BB (DG2)
[20:50:56] [PASSED] 0x56BC (DG2)
[20:50:56] [PASSED] 0x56BD (DG2)
[20:50:56] [PASSED] 0x5693 (DG2)
[20:50:56] [PASSED] 0x5694 (DG2)
[20:50:56] [PASSED] 0x5695 (DG2)
[20:50:56] [PASSED] 0x56A3 (DG2)
[20:50:56] [PASSED] 0x56A4 (DG2)
[20:50:56] [PASSED] 0x56B2 (DG2)
[20:50:56] [PASSED] 0x56B3 (DG2)
[20:50:56] [PASSED] 0x5696 (DG2)
[20:50:56] [PASSED] 0x5697 (DG2)
[20:50:56] [PASSED] 0xB69 (PVC)
[20:50:56] [PASSED] 0xB6E (PVC)
[20:50:56] [PASSED] 0xBD4 (PVC)
[20:50:56] [PASSED] 0xBD5 (PVC)
[20:50:56] [PASSED] 0xBD6 (PVC)
[20:50:56] [PASSED] 0xBD7 (PVC)
[20:50:56] [PASSED] 0xBD8 (PVC)
[20:50:56] [PASSED] 0xBD9 (PVC)
[20:50:56] [PASSED] 0xBDA (PVC)
[20:50:56] [PASSED] 0xBDB (PVC)
[20:50:56] [PASSED] 0xBE0 (PVC)
[20:50:56] [PASSED] 0xBE1 (PVC)
[20:50:56] [PASSED] 0xBE5 (PVC)
[20:50:56] [PASSED] 0x7D40 (METEORLAKE)
[20:50:56] [PASSED] 0x7D45 (METEORLAKE)
[20:50:56] [PASSED] 0x7D55 (METEORLAKE)
[20:50:56] [PASSED] 0x7D60 (METEORLAKE)
[20:50:56] [PASSED] 0x7DD5 (METEORLAKE)
[20:50:56] [PASSED] 0x6420 (LUNARLAKE)
[20:50:56] [PASSED] 0x64A0 (LUNARLAKE)
[20:50:56] [PASSED] 0x64B0 (LUNARLAKE)
[20:50:56] [PASSED] 0xE202 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE209 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE20B (BATTLEMAGE)
[20:50:56] [PASSED] 0xE20C (BATTLEMAGE)
[20:50:56] [PASSED] 0xE20D (BATTLEMAGE)
[20:50:56] [PASSED] 0xE210 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE211 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE212 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE216 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE220 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE221 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE222 (BATTLEMAGE)
[20:50:56] [PASSED] 0xE223 (BATTLEMAGE)
[20:50:56] [PASSED] 0xB080 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB081 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB082 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB083 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB084 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB085 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB086 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB087 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB08F (PANTHERLAKE)
[20:50:56] [PASSED] 0xB090 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB0A0 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB0A1 (PANTHERLAKE)
[20:50:56] [PASSED] 0xB0B0 (PANTHERLAKE)
[20:50:56] [PASSED] 0xFD80 (PANTHERLAKE)
[20:50:56] [PASSED] 0xFD81 (PANTHERLAKE)
[20:50:56] [PASSED] 0xD740 (NOVALAKE_S)
[20:50:56] [PASSED] 0xD741 (NOVALAKE_S)
[20:50:56] [PASSED] 0xD742 (NOVALAKE_S)
[20:50:56] [PASSED] 0xD743 (NOVALAKE_S)
[20:50:56] [PASSED] 0xD745 (NOVALAKE_S)
[20:50:56] [PASSED] 0xD74A (NOVALAKE_S)
[20:50:56] [PASSED] 0xD74B (NOVALAKE_S)
[20:50:56] [PASSED] 0x674C (CRESCENTISLAND)
[20:50:56] [PASSED] 0x674D (CRESCENTISLAND)
[20:50:56] [PASSED] 0x674E (CRESCENTISLAND)
[20:50:56] [PASSED] 0x674F (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6750 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6751 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6752 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6753 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6754 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6755 (CRESCENTISLAND)
[20:50:56] [PASSED] 0x6756 (CRESCENTISLAND)
[20:50:56] [PASSED] 0xD750 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD751 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD752 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD753 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD754 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD755 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD756 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD757 (NOVALAKE_P)
[20:50:56] [PASSED] 0xD75F (NOVALAKE_P)
[20:50:56] =============== [PASSED] check_platform_desc ===============
[20:50:56] ===================== [PASSED] xe_pci ======================
[20:50:56] ============= xe_rtp_tables_test (5 subtests) ==============
[20:50:56] ================== xe_rtp_table_gt_test  ===================
[20:50:56] [PASSED] gt_was/14011060649
[20:50:56] [PASSED] gt_was/14011059788
[20:50:56] [PASSED] gt_was/14015795083
[20:50:56] [PASSED] gt_was/16021867713
[20:50:56] [PASSED] gt_was/14019449301
[20:50:56] [PASSED] gt_was/16028005424
[20:50:56] [PASSED] gt_was/14026578760
[20:50:56] [PASSED] gt_was/1409420604
[20:50:56] [PASSED] gt_was/1408615072
[20:50:56] [PASSED] gt_was/22010523718
[20:50:56] [PASSED] gt_was/14011006942
[20:50:56] [PASSED] gt_was/14014830051
[20:50:56] [PASSED] gt_was/18018781329
[20:50:56] [PASSED] gt_was/1509235366
[20:50:56] [PASSED] gt_was/18018781329
[20:50:56] [PASSED] gt_was/16016694945
[20:50:56] [PASSED] gt_was/14018575942
[20:50:56] [PASSED] gt_was/22016670082
[20:50:56] [PASSED] gt_was/22016670082
[20:50:56] [PASSED] gt_was/14017421178
[20:50:56] [PASSED] gt_was/16025250150
[20:50:56] [PASSED] gt_was/14021871409
[20:50:56] [PASSED] gt_was/16021865536
[20:50:56] [PASSED] gt_was/14021486841
[20:50:56] [PASSED] gt_was/14025160223
[20:50:56] [PASSED] gt_was/14026144927, 16029437861, 14026127056
[20:50:56] [PASSED] gt_was/14025635424
[20:50:56] [PASSED] gt_was/16028005424
[20:50:56] ============== [PASSED] xe_rtp_table_gt_test ===============
[20:50:56] ================== xe_rtp_table_gt_test  ===================
[20:50:56] [PASSED] gt_tunings/Tuning: Blend Fill Caching Optimization Disable
[20:50:56] [PASSED] gt_tunings/Tuning: 32B Access Enable
[20:50:56] [PASSED] gt_tunings/Tuning: L3 cache
[20:50:56] [PASSED] gt_tunings/Tuning: L3 cache - media
[20:50:56] [PASSED] gt_tunings/Tuning: Compression Overfetch
[20:50:56] [PASSED] gt_tunings/Tuning: Compression Overfetch - media
[20:50:56] [PASSED] gt_tunings/Tuning: Enable compressible partial write overfetch in L3
[20:50:56] [PASSED] gt_tunings/Tuning: Enable compressible partial write overfetch in L3 - media
[20:50:56] [PASSED] gt_tunings/Tuning: L2 Overfetch Compressible Only
[20:50:56] [PASSED] gt_tunings/Tuning: L2 Overfetch Compressible Only - media
[20:50:56] [PASSED] gt_tunings/Tuning: Stateless compression control
[20:50:56] [PASSED] gt_tunings/Tuning: Stateless compression control - media
[20:50:56] [PASSED] gt_tunings/Tuning: L3 RW flush all Cache
[20:50:56] [PASSED] gt_tunings/Tuning: L3 RW flush all cache - media
[20:50:56] [PASSED] gt_tunings/Tuning: Set STLB Bank Hash Mode to 4KB
[20:50:56] [PASSED] gt_tunings/Tuning: Force All Non-Compressible Memory Reads to be 256B Overfetches
[20:50:56] ============== [PASSED] xe_rtp_table_gt_test ===============
[20:50:56] ================== xe_rtp_table_oob_test  ==================
[20:50:56] [PASSED] oob_was/1607983814
[20:50:56] [PASSED] oob_was/16010904313
[20:50:56] [PASSED] oob_was/18022495364
[20:50:56] [PASSED] oob_was/22012773006
[20:50:56] [PASSED] oob_was/14014475959
[20:50:56] [PASSED] oob_was/22011391025
[20:50:56] [PASSED] oob_was/22012727170
[20:50:56] [PASSED] oob_was/22012727685
[20:50:56] [PASSED] oob_was/22016596838
[20:50:56] [PASSED] oob_was/18020744125
[20:50:56] [PASSED] oob_was/1409600907
[20:50:56] [PASSED] oob_was/22014953428
[20:50:56] [PASSED] oob_was/16017236439
[20:50:56] [PASSED] oob_was/14019821291
[20:50:56] [PASSED] oob_was/14015076503
[20:50:56] [PASSED] oob_was/22016122933
[20:50:56] [PASSED] oob_was/14018913170
[20:50:56] [PASSED] oob_was/14018094691
[20:50:56] [PASSED] oob_was/18024947630
[20:50:56] [PASSED] oob_was/16022287689
[20:50:56] [PASSED] oob_was/13011645652
[20:50:56] [PASSED] oob_was/14022293748
[20:50:56] [PASSED] oob_was/22019794406
[20:50:56] [PASSED] oob_was/22019338487
[20:50:56] [PASSED] oob_was/16023588340
[20:50:56] [PASSED] oob_was/14019789679
[20:50:56] [PASSED] oob_was/14022866841
[20:50:56] [PASSED] oob_was/16021333562
[20:50:56] [PASSED] oob_was/14016712196
[20:50:56] [PASSED] oob_was/14015568240
[20:50:56] [PASSED] oob_was/18013179988
[20:50:56] [PASSED] oob_was/1508761755
[20:50:56] [PASSED] oob_was/16023105232
[20:50:56] [PASSED] oob_was/16026508708
[20:50:56] [PASSED] oob_was/14020001231
[20:50:56] [PASSED] oob_was/16023683509
[20:50:56] [PASSED] oob_was/14025515070
[20:50:56] [PASSED] oob_was/15015404425_disable
[20:50:56] [PASSED] oob_was/16026007364
[20:50:56] [PASSED] oob_was/14020316580
[20:50:56] [PASSED] oob_was/14025883347
[20:50:56] [PASSED] oob_was/16029380221
[20:50:56] [PASSED] oob_was/22022079272
[20:50:56] [PASSED] oob_was/16029897822
[20:50:56] [PASSED] oob_was/14026539277
[20:50:56] [PASSED] oob_was/14027054324
[20:50:56] [PASSED] oob_was/14025941587
[20:50:56] [PASSED] oob_was/16030224309
[20:50:56] [PASSED] oob_was/14028709524
[20:50:56] [PASSED] oob_was/14028250015
[20:50:56] [PASSED] oob_was/16031259911
[20:50:56] ============== [PASSED] xe_rtp_table_oob_test ==============
[20:50:56] ================ xe_rtp_table_dev_oob_test  ================
[20:50:56] [PASSED] device_oob_was/22010954014
[20:50:56] [PASSED] device_oob_was/15015404425
[20:50:56] [PASSED] device_oob_was/22019338487_display
[20:50:56] [PASSED] device_oob_was/14022085890
[20:50:56] [PASSED] device_oob_was/14026633728
[20:50:56] [PASSED] device_oob_was/14026746987
[20:50:56] [PASSED] device_oob_was/14026779378
[20:50:56] [PASSED] device_oob_was/14028586678
[20:50:56] [PASSED] device_oob_was/14028434957
[20:50:56] ============ [PASSED] xe_rtp_table_dev_oob_test ============
[20:50:56] ========== xe_rtp_table_missing_upper_bound_test  ==========
[20:50:56] [PASSED] register_whitelist/WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865
[20:50:56] [PASSED] register_whitelist/1508744258, 14012131227, 1808121037
[20:50:56] [PASSED] register_whitelist/1806527549
[20:50:56] [PASSED] register_whitelist/allow_read_ctx_timestamp
[20:50:56] [PASSED] register_whitelist/allow_read_queue_timestamp
[20:50:56] [PASSED] register_whitelist/16014440446
[20:50:56] [PASSED] register_whitelist/16017236439
[20:50:56] [PASSED] register_whitelist/16020183090
[20:50:56] [PASSED] register_whitelist/14024997852
[20:50:56] [PASSED] register_whitelist/14024997852
[20:50:56] ====== [PASSED] xe_rtp_table_missing_upper_bound_test ======
[20:50:56] =============== [PASSED] xe_rtp_tables_test ================
[20:50:56] =================== xe_rtp (3 subtests) ====================
[20:50:56] =================== xe_rtp_rules_tests  ====================
[20:50:56] [PASSED] no
[20:50:56] [PASSED] yes
[20:50:56] [PASSED] no-and-no
[20:50:56] [PASSED] no-and-yes
[20:50:56] [PASSED] yes-and-no
[20:50:56] [PASSED] yes-and-yes
[20:50:56] [PASSED] no-or-no
[20:50:56] [PASSED] no-or-yes
[20:50:56] [PASSED] yes-or-no
[20:50:56] [PASSED] yes-or-yes
[20:50:56] [PASSED] no-yes-or-yes-no
[20:50:56] [PASSED] no-yes-or-yes-yes
[20:50:56] [PASSED] yes-yes-or-no-yes
[20:50:56] [PASSED] yes-yes-or-yes-yes
[20:50:56] [PASSED] no-no-or-yes-or-no
[20:50:56] [PASSED] or
[20:50:56] [PASSED] or-yes
[20:50:56] [PASSED] or-no
[20:50:56] [PASSED] yes-or
[20:50:56] [PASSED] no-or
[20:50:56] [PASSED] no-or-or-yes
[20:50:56] [PASSED] yes-or-or-no
[20:50:56] [PASSED] no-or-or-no
[20:50:56] [PASSED] missing-context-engine-class
[20:50:56] [PASSED] missing-context-engine-class-or-yes
[20:50:56] [PASSED] missing-context-engine-class-or-or-yes
[20:50:56] =============== [PASSED] xe_rtp_rules_tests ================
[20:50:56] =============== xe_rtp_process_to_sr_tests  ================
[20:50:56] [PASSED] coalesce-same-reg
[20:50:56] [PASSED] coalesce-same-reg-literal-and-func
[20:50:56] [PASSED] no-match-no-add
[20:50:56] [PASSED] two-regs-two-entries
[20:50:56] [PASSED] clr-one-set-other
[20:50:56] [PASSED] set-field
[20:50:56] [PASSED] conflict-duplicate
[20:50:56] [PASSED] conflict-not-disjoint
[20:50:56] [PASSED] conflict-not-disjoint-literal-and-func
[20:50:56] [PASSED] conflict-reg-type
[20:50:56] [PASSED] bad-mcr-reg-forced-to-regular
[20:50:56] [PASSED] bad-regular-reg-forced-to-mcr
[20:50:56] =========== [PASSED] xe_rtp_process_to_sr_tests ============
[20:50:56] ================== xe_rtp_process_tests  ===================
[20:50:56] [PASSED] active1
[20:50:56] [PASSED] active2
[20:50:56] [PASSED] active-inactive
[20:50:56] [PASSED] inactive-active
[20:50:56] [PASSED] inactive-active-inactive
[20:50:56] [PASSED] inactive-inactive-inactive
[20:50:56] ============== [PASSED] xe_rtp_process_tests ===============
[20:50:56] ===================== [PASSED] xe_rtp ======================
[20:50:56] ==================== xe_wa (1 subtest) =====================
[20:50:56] ======================== xe_wa_gt  =========================
[20:50:56] [PASSED] TIGERLAKE B0
[20:50:56] [PASSED] DG1 A0
[20:50:56] [PASSED] DG1 B0
[20:50:56] [PASSED] ALDERLAKE_S A0
[20:50:56] [PASSED] ALDERLAKE_S B0
[20:50:56] [PASSED] ALDERLAKE_S C0
[20:50:56] [PASSED] ALDERLAKE_S D0
[20:50:56] [PASSED] ALDERLAKE_P A0
[20:50:56] [PASSED] ALDERLAKE_P B0
[20:50:56] [PASSED] ALDERLAKE_P C0
[20:50:56] [PASSED] ALDERLAKE_S RPLS D0
[20:50:56] [PASSED] ALDERLAKE_P RPLU E0
[20:50:56] [PASSED] DG2 G10 C0
[20:50:56] [PASSED] DG2 G11 B1
[20:50:56] [PASSED] DG2 G12 A1
[20:50:56] [PASSED] METEORLAKE 12.70(Xe_LPG) A0 13.00(Xe_LPM+) A0
[20:50:56] [PASSED] METEORLAKE 12.71(Xe_LPG) A0 13.00(Xe_LPM+) A0
[20:50:56] [PASSED] METEORLAKE 12.74(Xe_LPG+) A0 13.00(Xe_LPM+) A0
[20:50:56] [PASSED] LUNARLAKE 20.04(Xe2_LPG) A0 20.00(Xe2_LPM) A0
[20:50:56] [PASSED] LUNARLAKE 20.04(Xe2_LPG) B0 20.00(Xe2_LPM) A0
[20:50:56] [PASSED] BATTLEMAGE 20.01(Xe2_HPG) A0 13.01(Xe2_HPM) A1
[20:50:56] [PASSED] PANTHERLAKE 30.00(Xe3_LPG) A0 30.00(Xe3_LPM) A0
[20:50:56] ==================== [PASSED] xe_wa_gt =====================
[20:50:56] ====================== [PASSED] xe_wa ======================
[20:50:56] ============================================================
[20:50:56] Testing complete. Ran 866 tests: passed: 837, skipped: 29
[20:50:57] Elapsed time: 41.947s total, 2.587s configuring, 38.594s building, 0.748s running

+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/drm/tests/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/tests/.kunitconfig
[20:50:57] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[20:50:59] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[20:51:25] Starting KUnit Kernel (1/1)...
[20:51:25] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[20:51:25] ============ drm_test_pick_cmdline (2 subtests) ============
[20:51:25] [PASSED] drm_test_pick_cmdline_res_1920_1080_60
[20:51:25] =============== drm_test_pick_cmdline_named  ===============
[20:51:25] [PASSED] NTSC
[20:51:25] [PASSED] NTSC-J
[20:51:25] [PASSED] PAL
[20:51:25] [PASSED] PAL-M
[20:51:25] =========== [PASSED] drm_test_pick_cmdline_named ===========
[20:51:25] ============== [PASSED] drm_test_pick_cmdline ==============
[20:51:25] == drm_test_atomic_get_connector_for_encoder (1 subtest) ===
[20:51:25] [PASSED] drm_test_drm_atomic_get_connector_for_encoder
[20:51:25] ==== [PASSED] drm_test_atomic_get_connector_for_encoder ====
[20:51:25] =========== drm_validate_clone_mode (2 subtests) ===========
[20:51:25] ============== drm_test_check_in_clone_mode  ===============
[20:51:25] [PASSED] in_clone_mode
[20:51:25] [PASSED] not_in_clone_mode
[20:51:25] ========== [PASSED] drm_test_check_in_clone_mode ===========
[20:51:25] =============== drm_test_check_valid_clones  ===============
[20:51:25] [PASSED] not_in_clone_mode
[20:51:25] [PASSED] valid_clone
[20:51:25] [PASSED] invalid_clone
[20:51:25] =========== [PASSED] drm_test_check_valid_clones ===========
[20:51:25] ============= [PASSED] drm_validate_clone_mode =============
[20:51:25] ============= drm_validate_modeset (1 subtest) =============
[20:51:25] [PASSED] drm_test_check_connector_changed_modeset
[20:51:25] ============== [PASSED] drm_validate_modeset ===============
[20:51:25] ====== drm_test_bridge_get_current_state (1 subtest) =======
[20:51:25] [PASSED] drm_test_drm_bridge_get_current_state_atomic
[20:51:25] ======== [PASSED] drm_test_bridge_get_current_state ========
[20:51:25] ====== drm_test_bridge_helper_reset_crtc (3 subtests) ======
[20:51:25] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic
[20:51:25] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic_disabled
[20:51:25] [PASSED] drm_test_drm_bridge_helper_hdmi_output_bus_fmts
[20:51:25] ======== [PASSED] drm_test_bridge_helper_reset_crtc ========
[20:51:25] ============== drm_bridge_alloc (2 subtests) ===============
[20:51:25] [PASSED] drm_test_drm_bridge_alloc_basic
[20:51:25] [PASSED] drm_test_drm_bridge_alloc_get_put
[20:51:25] ================ [PASSED] drm_bridge_alloc =================
[20:51:25] ============= drm_bridge_bus_fmt (5 subtests) ==============
[20:51:25] [PASSED] drm_test_bridge_rgb_yuv_rgb
[20:51:25] [PASSED] drm_test_bridge_must_convert_to_yuv444
[20:51:25] [PASSED] drm_test_bridge_hdmi_auto_rgb
[20:51:25] [PASSED] drm_test_bridge_auto_first
[20:51:25] [PASSED] drm_test_bridge_rgb_yuv_no_path
[20:51:25] =============== [PASSED] drm_bridge_bus_fmt ================
[20:51:25] ============= drm_cmdline_parser (40 subtests) =============
[20:51:25] [PASSED] drm_test_cmdline_force_d_only
[20:51:25] [PASSED] drm_test_cmdline_force_D_only_dvi
[20:51:25] [PASSED] drm_test_cmdline_force_D_only_hdmi
[20:51:25] [PASSED] drm_test_cmdline_force_D_only_not_digital
[20:51:25] [PASSED] drm_test_cmdline_force_e_only
[20:51:25] [PASSED] drm_test_cmdline_res
[20:51:25] [PASSED] drm_test_cmdline_res_vesa
[20:51:25] [PASSED] drm_test_cmdline_res_vesa_rblank
[20:51:25] [PASSED] drm_test_cmdline_res_rblank
[20:51:25] [PASSED] drm_test_cmdline_res_bpp
[20:51:25] [PASSED] drm_test_cmdline_res_refresh
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_margins
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_force_off
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_analog
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_digital
[20:51:25] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced_margins_force_on
[20:51:25] [PASSED] drm_test_cmdline_res_margins_force_on
[20:51:25] [PASSED] drm_test_cmdline_res_vesa_margins
[20:51:25] [PASSED] drm_test_cmdline_name
[20:51:25] [PASSED] drm_test_cmdline_name_bpp
[20:51:25] [PASSED] drm_test_cmdline_name_option
[20:51:25] [PASSED] drm_test_cmdline_name_bpp_option
[20:51:25] [PASSED] drm_test_cmdline_rotate_0
[20:51:25] [PASSED] drm_test_cmdline_rotate_90
[20:51:25] [PASSED] drm_test_cmdline_rotate_180
[20:51:25] [PASSED] drm_test_cmdline_rotate_270
[20:51:25] [PASSED] drm_test_cmdline_hmirror
[20:51:25] [PASSED] drm_test_cmdline_vmirror
[20:51:25] [PASSED] drm_test_cmdline_margin_options
[20:51:25] [PASSED] drm_test_cmdline_multiple_options
[20:51:25] [PASSED] drm_test_cmdline_bpp_extra_and_option
[20:51:25] [PASSED] drm_test_cmdline_extra_and_option
[20:51:25] [PASSED] drm_test_cmdline_freestanding_options
[20:51:25] [PASSED] drm_test_cmdline_freestanding_force_e_and_options
[20:51:25] [PASSED] drm_test_cmdline_panel_orientation
[20:51:25] ================ drm_test_cmdline_invalid  =================
[20:51:25] [PASSED] margin_only
[20:51:25] [PASSED] interlace_only
[20:51:25] [PASSED] res_missing_x
[20:51:25] [PASSED] res_missing_y
[20:51:25] [PASSED] res_bad_y
[20:51:25] [PASSED] res_missing_y_bpp
[20:51:25] [PASSED] res_bad_bpp
[20:51:25] [PASSED] res_bad_refresh
[20:51:25] [PASSED] res_bpp_refresh_force_on_off
[20:51:25] [PASSED] res_invalid_mode
[20:51:25] [PASSED] res_bpp_wrong_place_mode
[20:51:25] [PASSED] name_bpp_refresh
[20:51:25] [PASSED] name_refresh
[20:51:25] [PASSED] name_refresh_wrong_mode
[20:51:25] [PASSED] name_refresh_invalid_mode
[20:51:25] [PASSED] rotate_multiple
[20:51:25] [PASSED] rotate_invalid_val
[20:51:25] [PASSED] rotate_truncated
[20:51:25] [PASSED] invalid_option
[20:51:25] [PASSED] invalid_tv_option
[20:51:25] [PASSED] truncated_tv_option
[20:51:25] ============ [PASSED] drm_test_cmdline_invalid =============
[20:51:25] =============== drm_test_cmdline_tv_options  ===============
[20:51:25] [PASSED] NTSC
[20:51:25] [PASSED] NTSC_443
[20:51:25] [PASSED] NTSC_J
[20:51:25] [PASSED] PAL
[20:51:25] [PASSED] PAL_M
[20:51:25] [PASSED] PAL_N
[20:51:25] [PASSED] SECAM
[20:51:25] [PASSED] MONO_525
[20:51:25] [PASSED] MONO_625
[20:51:25] =========== [PASSED] drm_test_cmdline_tv_options ===========
[20:51:25] =============== [PASSED] drm_cmdline_parser ================
[20:51:25] ========== drmm_connector_hdmi_init (20 subtests) ==========
[20:51:25] [PASSED] drm_test_connector_hdmi_init_valid
[20:51:25] [PASSED] drm_test_connector_hdmi_init_bpc_8
[20:51:25] [PASSED] drm_test_connector_hdmi_init_bpc_10
[20:51:25] [PASSED] drm_test_connector_hdmi_init_bpc_12
[20:51:25] [PASSED] drm_test_connector_hdmi_init_bpc_invalid
[20:51:25] [PASSED] drm_test_connector_hdmi_init_bpc_null
[20:51:25] [PASSED] drm_test_connector_hdmi_init_formats_empty
[20:51:25] [PASSED] drm_test_connector_hdmi_init_formats_no_rgb
[20:51:25] === drm_test_connector_hdmi_init_formats_yuv420_allowed  ===
[20:51:25] [PASSED] supported_formats=0x9 yuv420_allowed=1
[20:51:25] [PASSED] supported_formats=0x9 yuv420_allowed=0
[20:51:25] [PASSED] supported_formats=0x5 yuv420_allowed=1
[20:51:25] [PASSED] supported_formats=0x5 yuv420_allowed=0
[20:51:25] === [PASSED] drm_test_connector_hdmi_init_formats_yuv420_allowed ===
[20:51:25] [PASSED] drm_test_connector_hdmi_init_null_ddc
[20:51:25] [PASSED] drm_test_connector_hdmi_init_null_product
[20:51:25] [PASSED] drm_test_connector_hdmi_init_null_vendor
[20:51:25] [PASSED] drm_test_connector_hdmi_init_product_length_exact
[20:51:25] [PASSED] drm_test_connector_hdmi_init_product_length_too_long
[20:51:25] [PASSED] drm_test_connector_hdmi_init_product_valid
[20:51:25] [PASSED] drm_test_connector_hdmi_init_vendor_length_exact
[20:51:25] [PASSED] drm_test_connector_hdmi_init_vendor_length_too_long
[20:51:25] [PASSED] drm_test_connector_hdmi_init_vendor_valid
[20:51:25] ========= drm_test_connector_hdmi_init_type_valid  =========
[20:51:25] [PASSED] HDMI-A
[20:51:25] [PASSED] HDMI-B
[20:51:25] ===== [PASSED] drm_test_connector_hdmi_init_type_valid =====
[20:51:25] ======== drm_test_connector_hdmi_init_type_invalid  ========
[20:51:25] [PASSED] Unknown
[20:51:25] [PASSED] VGA
[20:51:25] [PASSED] DVI-I
[20:51:25] [PASSED] DVI-D
[20:51:25] [PASSED] DVI-A
[20:51:25] [PASSED] Composite
[20:51:25] [PASSED] SVIDEO
[20:51:25] [PASSED] LVDS
[20:51:25] [PASSED] Component
[20:51:25] [PASSED] DIN
[20:51:25] [PASSED] DP
[20:51:25] [PASSED] TV
[20:51:25] [PASSED] eDP
[20:51:25] [PASSED] Virtual
[20:51:25] [PASSED] DSI
[20:51:25] [PASSED] DPI
[20:51:25] [PASSED] Writeback
[20:51:25] [PASSED] SPI
[20:51:25] [PASSED] USB
[20:51:25] ==== [PASSED] drm_test_connector_hdmi_init_type_invalid ====
[20:51:25] ============ [PASSED] drmm_connector_hdmi_init =============
[20:51:25] ============= drmm_connector_init (3 subtests) =============
[20:51:25] [PASSED] drm_test_drmm_connector_init
[20:51:25] [PASSED] drm_test_drmm_connector_init_null_ddc
[20:51:25] ========= drm_test_drmm_connector_init_type_valid  =========
[20:51:25] [PASSED] Unknown
[20:51:25] [PASSED] VGA
[20:51:25] [PASSED] DVI-I
[20:51:25] [PASSED] DVI-D
[20:51:25] [PASSED] DVI-A
[20:51:25] [PASSED] Composite
[20:51:25] [PASSED] SVIDEO
[20:51:25] [PASSED] LVDS
[20:51:25] [PASSED] Component
[20:51:25] [PASSED] DIN
[20:51:25] [PASSED] DP
[20:51:25] [PASSED] HDMI-A
[20:51:25] [PASSED] HDMI-B
[20:51:25] [PASSED] TV
[20:51:25] [PASSED] eDP
[20:51:25] [PASSED] Virtual
[20:51:25] [PASSED] DSI
[20:51:25] [PASSED] DPI
[20:51:25] [PASSED] Writeback
[20:51:25] [PASSED] SPI
[20:51:25] [PASSED] USB
[20:51:25] ===== [PASSED] drm_test_drmm_connector_init_type_valid =====
[20:51:25] =============== [PASSED] drmm_connector_init ===============
[20:51:25] ========= drm_connector_dynamic_init (6 subtests) ==========
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_init
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_init_null_ddc
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_init_not_added
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_init_properties
[20:51:25] ===== drm_test_drm_connector_dynamic_init_type_valid  ======
[20:51:25] [PASSED] Unknown
[20:51:25] [PASSED] VGA
[20:51:25] [PASSED] DVI-I
[20:51:25] [PASSED] DVI-D
[20:51:25] [PASSED] DVI-A
[20:51:25] [PASSED] Composite
[20:51:25] [PASSED] SVIDEO
[20:51:25] [PASSED] LVDS
[20:51:25] [PASSED] Component
[20:51:25] [PASSED] DIN
[20:51:25] [PASSED] DP
[20:51:25] [PASSED] HDMI-A
[20:51:25] [PASSED] HDMI-B
[20:51:25] [PASSED] TV
[20:51:25] [PASSED] eDP
[20:51:25] [PASSED] Virtual
[20:51:25] [PASSED] DSI
[20:51:25] [PASSED] DPI
[20:51:25] [PASSED] Writeback
[20:51:25] [PASSED] SPI
[20:51:25] [PASSED] USB
[20:51:25] = [PASSED] drm_test_drm_connector_dynamic_init_type_valid ==
[20:51:25] ======== drm_test_drm_connector_dynamic_init_name  =========
[20:51:25] [PASSED] Unknown
[20:51:25] [PASSED] VGA
[20:51:25] [PASSED] DVI-I
[20:51:25] [PASSED] DVI-D
[20:51:25] [PASSED] DVI-A
[20:51:25] [PASSED] Composite
[20:51:25] [PASSED] SVIDEO
[20:51:25] [PASSED] LVDS
[20:51:25] [PASSED] Component
[20:51:25] [PASSED] DIN
[20:51:25] [PASSED] DP
[20:51:25] [PASSED] HDMI-A
[20:51:25] [PASSED] HDMI-B
[20:51:25] [PASSED] TV
[20:51:25] [PASSED] eDP
[20:51:25] [PASSED] Virtual
[20:51:25] [PASSED] DSI
[20:51:25] [PASSED] DPI
[20:51:25] [PASSED] Writeback
[20:51:25] [PASSED] SPI
[20:51:25] [PASSED] USB
[20:51:25] ==== [PASSED] drm_test_drm_connector_dynamic_init_name =====
[20:51:25] =========== [PASSED] drm_connector_dynamic_init ============
[20:51:25] ==== drm_connector_dynamic_register_early (4 subtests) =====
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_early_on_list
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_early_defer
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_early_no_init
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_early_no_mode_object
[20:51:25] ====== [PASSED] drm_connector_dynamic_register_early =======
[20:51:25] ======= drm_connector_dynamic_register (7 subtests) ========
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_on_list
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_no_defer
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_no_init
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_mode_object
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_sysfs
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_sysfs_name
[20:51:25] [PASSED] drm_test_drm_connector_dynamic_register_debugfs
[20:51:25] ========= [PASSED] drm_connector_dynamic_register ==========
[20:51:25] = drm_connector_attach_broadcast_rgb_property (2 subtests) =
[20:51:25] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property
[20:51:25] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector
[20:51:25] === [PASSED] drm_connector_attach_broadcast_rgb_property ===
[20:51:25] ========== drm_get_tv_mode_from_name (2 subtests) ==========
[20:51:25] ========== drm_test_get_tv_mode_from_name_valid  ===========
[20:51:25] [PASSED] NTSC
[20:51:25] [PASSED] NTSC-443
[20:51:25] [PASSED] NTSC-J
[20:51:25] [PASSED] PAL
[20:51:25] [PASSED] PAL-M
[20:51:25] [PASSED] PAL-N
[20:51:25] [PASSED] SECAM
[20:51:25] [PASSED] Mono
[20:51:25] ====== [PASSED] drm_test_get_tv_mode_from_name_valid =======
[20:51:25] [PASSED] drm_test_get_tv_mode_from_name_truncated
[20:51:25] ============ [PASSED] drm_get_tv_mode_from_name ============
[20:51:25] = drm_test_connector_hdmi_compute_mode_clock (12 subtests) =
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1
[20:51:25] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_double
[20:51:25] = drm_test_connector_hdmi_compute_mode_clock_yuv420_valid  =
[20:51:25] [PASSED] VIC 96
[20:51:25] [PASSED] VIC 97
[20:51:25] [PASSED] VIC 101
[20:51:25] [PASSED] VIC 102
[20:51:25] [PASSED] VIC 106
[20:51:25] [PASSED] VIC 107
[20:51:25] === [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_valid ===
[20:51:25] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc
[20:51:25] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc
[20:51:25] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc
[20:51:25] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc
[20:51:25] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc
[20:51:25] === [PASSED] drm_test_connector_hdmi_compute_mode_clock ====
[20:51:25] == drm_hdmi_connector_get_broadcast_rgb_name (2 subtests) ==
[20:51:25] === drm_test_drm_hdmi_connector_get_broadcast_rgb_name  ====
[20:51:25] [PASSED] Automatic
[20:51:25] [PASSED] Full
[20:51:25] [PASSED] Limited 16:235
[20:51:25] === [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name ===
[20:51:25] [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name_invalid
[20:51:25] ==== [PASSED] drm_hdmi_connector_get_broadcast_rgb_name ====
[20:51:25] == drm_hdmi_connector_get_output_format_name (2 subtests) ==
[20:51:25] === drm_test_drm_hdmi_connector_get_output_format_name  ====
[20:51:25] [PASSED] RGB
[20:51:25] [PASSED] YUV 4:2:0
[20:51:25] [PASSED] YUV 4:2:2
[20:51:25] [PASSED] YUV 4:4:4
[20:51:25] === [PASSED] drm_test_drm_hdmi_connector_get_output_format_name ===
[20:51:25] [PASSED] drm_test_drm_hdmi_connector_get_output_format_name_invalid
[20:51:25] ==== [PASSED] drm_hdmi_connector_get_output_format_name ====
[20:51:25] ============= drm_damage_helper (21 subtests) ==============
[20:51:25] [PASSED] drm_test_damage_iter_no_damage
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_fractional_src
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_src_moved
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_fractional_src_moved
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_not_visible
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_no_crtc
[20:51:25] [PASSED] drm_test_damage_iter_no_damage_no_fb
[20:51:25] [PASSED] drm_test_damage_iter_simple_damage
[20:51:25] [PASSED] drm_test_damage_iter_single_damage
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_intersect_src
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_outside_src
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_fractional_src
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_intersect_fractional_src
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_outside_fractional_src
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_src_moved
[20:51:25] [PASSED] drm_test_damage_iter_single_damage_fractional_src_moved
[20:51:25] [PASSED] drm_test_damage_iter_damage
[20:51:25] [PASSED] drm_test_damage_iter_damage_one_intersect
[20:51:25] [PASSED] drm_test_damage_iter_damage_one_outside
[20:51:25] [PASSED] drm_test_damage_iter_damage_src_moved
[20:51:25] [PASSED] drm_test_damage_iter_damage_not_visible
[20:51:25] ================ [PASSED] drm_damage_helper ================
[20:51:25] ============== drm_dp_mst_helper (3 subtests) ==============
[20:51:25] ============== drm_test_dp_mst_calc_pbn_mode  ==============
[20:51:25] [PASSED] Clock 154000 BPP 30 DSC disabled
[20:51:25] [PASSED] Clock 234000 BPP 30 DSC disabled
[20:51:25] [PASSED] Clock 297000 BPP 24 DSC disabled
[20:51:25] [PASSED] Clock 332880 BPP 24 DSC enabled
[20:51:25] [PASSED] Clock 324540 BPP 24 DSC enabled
[20:51:25] ========== [PASSED] drm_test_dp_mst_calc_pbn_mode ==========
[20:51:25] ============== drm_test_dp_mst_calc_pbn_div  ===============
[20:51:25] [PASSED] Link rate 2000000 lane count 4
[20:51:25] [PASSED] Link rate 2000000 lane count 2
[20:51:25] [PASSED] Link rate 2000000 lane count 1
[20:51:25] [PASSED] Link rate 1350000 lane count 4
[20:51:25] [PASSED] Link rate 1350000 lane count 2
[20:51:25] [PASSED] Link rate 1350000 lane count 1
[20:51:25] [PASSED] Link rate 1000000 lane count 4
[20:51:25] [PASSED] Link rate 1000000 lane count 2
[20:51:25] [PASSED] Link rate 1000000 lane count 1
[20:51:25] [PASSED] Link rate 810000 lane count 4
[20:51:25] [PASSED] Link rate 810000 lane count 2
[20:51:25] [PASSED] Link rate 810000 lane count 1
[20:51:25] [PASSED] Link rate 540000 lane count 4
[20:51:25] [PASSED] Link rate 540000 lane count 2
[20:51:25] [PASSED] Link rate 540000 lane count 1
[20:51:25] [PASSED] Link rate 270000 lane count 4
[20:51:25] [PASSED] Link rate 270000 lane count 2
[20:51:25] [PASSED] Link rate 270000 lane count 1
[20:51:25] [PASSED] Link rate 162000 lane count 4
[20:51:25] [PASSED] Link rate 162000 lane count 2
[20:51:25] [PASSED] Link rate 162000 lane count 1
[20:51:25] ========== [PASSED] drm_test_dp_mst_calc_pbn_div ===========
[20:51:25] ========= drm_test_dp_mst_sideband_msg_req_decode  =========
[20:51:25] [PASSED] DP_ENUM_PATH_RESOURCES with port number
[20:51:25] [PASSED] DP_POWER_UP_PHY with port number
[20:51:25] [PASSED] DP_POWER_DOWN_PHY with port number
[20:51:25] [PASSED] DP_ALLOCATE_PAYLOAD with SDP stream sinks
[20:51:25] [PASSED] DP_ALLOCATE_PAYLOAD with port number
[20:51:25] [PASSED] DP_ALLOCATE_PAYLOAD with VCPI
[20:51:25] [PASSED] DP_ALLOCATE_PAYLOAD with PBN
[20:51:25] [PASSED] DP_QUERY_PAYLOAD with port number
[20:51:25] [PASSED] DP_QUERY_PAYLOAD with VCPI
[20:51:25] [PASSED] DP_REMOTE_DPCD_READ with port number
[20:51:25] [PASSED] DP_REMOTE_DPCD_READ with DPCD address
[20:51:25] [PASSED] DP_REMOTE_DPCD_READ with max number of bytes
[20:51:25] [PASSED] DP_REMOTE_DPCD_WRITE with port number
[20:51:25] [PASSED] DP_REMOTE_DPCD_WRITE with DPCD address
[20:51:25] [PASSED] DP_REMOTE_DPCD_WRITE with data array
[20:51:25] [PASSED] DP_REMOTE_I2C_READ with port number
[20:51:25] [PASSED] DP_REMOTE_I2C_READ with I2C device ID
[20:51:25] [PASSED] DP_REMOTE_I2C_READ with transactions array
[20:51:25] [PASSED] DP_REMOTE_I2C_WRITE with port number
[20:51:25] [PASSED] DP_REMOTE_I2C_WRITE with I2C device ID
[20:51:25] [PASSED] DP_REMOTE_I2C_WRITE with data array
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream ID
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with client ID
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream event
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with valid stream event
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream behavior
[20:51:25] [PASSED] DP_QUERY_STREAM_ENC_STATUS with a valid stream behavior
[20:51:25] ===== [PASSED] drm_test_dp_mst_sideband_msg_req_decode =====
[20:51:25] ================ [PASSED] drm_dp_mst_helper ================
[20:51:25] ================== drm_exec (7 subtests) ===================
[20:51:25] [PASSED] sanitycheck
[20:51:25] [PASSED] test_lock
[20:51:25] [PASSED] test_lock_unlock
[20:51:25] [PASSED] test_duplicates
[20:51:25] [PASSED] test_prepare
[20:51:25] [PASSED] test_prepare_array
[20:51:25] [PASSED] test_multiple_loops
[20:51:25] ==================== [PASSED] drm_exec =====================
[20:51:25] =========== drm_format_helper_test (17 subtests) ===========
[20:51:25] ============== drm_test_fb_xrgb8888_to_gray8  ==============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========== [PASSED] drm_test_fb_xrgb8888_to_gray8 ==========
[20:51:25] ============= drm_test_fb_xrgb8888_to_rgb332  ==============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb332 ==========
[20:51:25] ============= drm_test_fb_xrgb8888_to_rgb565  ==============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb565 ==========
[20:51:25] ============ drm_test_fb_xrgb8888_to_xrgb1555  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_xrgb1555 =========
[20:51:25] ============ drm_test_fb_xrgb8888_to_argb1555  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_argb1555 =========
[20:51:25] ============ drm_test_fb_xrgb8888_to_rgba5551  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_rgba5551 =========
[20:51:25] ============= drm_test_fb_xrgb8888_to_rgb888  ==============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb888 ==========
[20:51:25] ============= drm_test_fb_xrgb8888_to_bgr888  ==============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========= [PASSED] drm_test_fb_xrgb8888_to_bgr888 ==========
[20:51:25] ============ drm_test_fb_xrgb8888_to_argb8888  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_argb8888 =========
[20:51:25] =========== drm_test_fb_xrgb8888_to_xrgb2101010  ===========
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======= [PASSED] drm_test_fb_xrgb8888_to_xrgb2101010 =======
[20:51:25] =========== drm_test_fb_xrgb8888_to_argb2101010  ===========
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======= [PASSED] drm_test_fb_xrgb8888_to_argb2101010 =======
[20:51:25] ============== drm_test_fb_xrgb8888_to_mono  ===============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ========== [PASSED] drm_test_fb_xrgb8888_to_mono ===========
[20:51:25] ==================== drm_test_fb_swab  =====================
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ================ [PASSED] drm_test_fb_swab =================
[20:51:25] ============ drm_test_fb_xrgb8888_to_xbgr8888  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_xbgr8888 =========
[20:51:25] ============ drm_test_fb_xrgb8888_to_abgr8888  =============
[20:51:25] [PASSED] single_pixel_source_buffer
[20:51:25] [PASSED] single_pixel_clip_rectangle
[20:51:25] [PASSED] well_known_colors
[20:51:25] [PASSED] destination_pitch
[20:51:25] ======== [PASSED] drm_test_fb_xrgb8888_to_abgr8888 =========
[20:51:25] ================= drm_test_fb_clip_offset  =================
[20:51:25] [PASSED] pass through
[20:51:25] [PASSED] horizontal offset
[20:51:25] [PASSED] vertical offset
[20:51:25] [PASSED] horizontal and vertical offset
[20:51:25] [PASSED] horizontal offset (custom pitch)
[20:51:25] [PASSED] vertical offset (custom pitch)
[20:51:25] [PASSED] horizontal and vertical offset (custom pitch)
[20:51:25] ============= [PASSED] drm_test_fb_clip_offset =============
[20:51:25] =================== drm_test_fb_memcpy  ====================
[20:51:25] [PASSED] single_pixel_source_buffer: XR24 little-endian (0x34325258)
[20:51:25] [PASSED] single_pixel_source_buffer: XRA8 little-endian (0x38415258)
[20:51:25] [PASSED] single_pixel_source_buffer: YU24 little-endian (0x34325559)
[20:51:25] [PASSED] single_pixel_clip_rectangle: XB24 little-endian (0x34324258)
[20:51:25] [PASSED] single_pixel_clip_rectangle: XRA8 little-endian (0x38415258)
[20:51:25] [PASSED] single_pixel_clip_rectangle: YU24 little-endian (0x34325559)
[20:51:25] [PASSED] well_known_colors: XB24 little-endian (0x34324258)
[20:51:25] [PASSED] well_known_colors: XRA8 little-endian (0x38415258)
[20:51:25] [PASSED] well_known_colors: YU24 little-endian (0x34325559)
[20:51:25] [PASSED] destination_pitch: XB24 little-endian (0x34324258)
[20:51:25] [PASSED] destination_pitch: XRA8 little-endian (0x38415258)
[20:51:25] [PASSED] destination_pitch: YU24 little-endian (0x34325559)
[20:51:25] =============== [PASSED] drm_test_fb_memcpy ================
[20:51:25] ============= [PASSED] drm_format_helper_test ==============
[20:51:25] ================= drm_format (18 subtests) =================
[20:51:25] [PASSED] drm_test_format_block_width_invalid
[20:51:25] [PASSED] drm_test_format_block_width_one_plane
[20:51:25] [PASSED] drm_test_format_block_width_two_plane
[20:51:25] [PASSED] drm_test_format_block_width_three_plane
[20:51:25] [PASSED] drm_test_format_block_width_tiled
[20:51:25] [PASSED] drm_test_format_block_height_invalid
[20:51:25] [PASSED] drm_test_format_block_height_one_plane
[20:51:25] [PASSED] drm_test_format_block_height_two_plane
[20:51:25] [PASSED] drm_test_format_block_height_three_plane
[20:51:25] [PASSED] drm_test_format_block_height_tiled
[20:51:25] [PASSED] drm_test_format_min_pitch_invalid
[20:51:25] [PASSED] drm_test_format_min_pitch_one_plane_8bpp
[20:51:25] [PASSED] drm_test_format_min_pitch_one_plane_16bpp
[20:51:25] [PASSED] drm_test_format_min_pitch_one_plane_24bpp
[20:51:25] [PASSED] drm_test_format_min_pitch_one_plane_32bpp
[20:51:25] [PASSED] drm_test_format_min_pitch_two_plane
[20:51:25] [PASSED] drm_test_format_min_pitch_three_plane_8bpp
[20:51:25] [PASSED] drm_test_format_min_pitch_tiled
[20:51:25] =================== [PASSED] drm_format ====================
[20:51:25] ============== drm_framebuffer (10 subtests) ===============
[20:51:25] ========== drm_test_framebuffer_check_src_coords  ==========
[20:51:25] [PASSED] Success: source fits into fb
[20:51:25] [PASSED] Fail: overflowing fb with x-axis coordinate
[20:51:25] [PASSED] Fail: overflowing fb with y-axis coordinate
[20:51:25] [PASSED] Fail: overflowing fb with source width
[20:51:25] [PASSED] Fail: overflowing fb with source height
[20:51:25] ====== [PASSED] drm_test_framebuffer_check_src_coords ======
[20:51:25] [PASSED] drm_test_framebuffer_cleanup
[20:51:25] =============== drm_test_framebuffer_create  ===============
[20:51:25] [PASSED] ABGR8888 normal sizes
[20:51:25] [PASSED] ABGR8888 max sizes
[20:51:25] [PASSED] ABGR8888 pitch greater than min required
[20:51:25] [PASSED] ABGR8888 pitch less than min required
[20:51:25] [PASSED] ABGR8888 Invalid width
[20:51:25] [PASSED] ABGR8888 Invalid buffer handle
[20:51:25] [PASSED] No pixel format
[20:51:25] [PASSED] ABGR8888 Width 0
[20:51:25] [PASSED] ABGR8888 Height 0
[20:51:25] [PASSED] ABGR8888 Out of bound height * pitch combination
[20:51:25] [PASSED] ABGR8888 Large buffer offset
[20:51:25] [PASSED] ABGR8888 Buffer offset for inexistent plane
[20:51:25] [PASSED] ABGR8888 Invalid flag
[20:51:25] [PASSED] ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers
[20:51:25] [PASSED] ABGR8888 Valid buffer modifier
[20:51:25] [PASSED] ABGR8888 Invalid buffer modifier(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
[20:51:25] [PASSED] ABGR8888 Extra pitches without DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] ABGR8888 Extra pitches with DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] NV12 Normal sizes
[20:51:25] [PASSED] NV12 Max sizes
[20:51:25] [PASSED] NV12 Invalid pitch
[20:51:25] [PASSED] NV12 Invalid modifier/missing DRM_MODE_FB_MODIFIERS flag
[20:51:25] [PASSED] NV12 different  modifier per-plane
[20:51:25] [PASSED] NV12 with DRM_FORMAT_MOD_SAMSUNG_64_32_TILE
[20:51:25] [PASSED] NV12 Valid modifiers without DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] NV12 Modifier for inexistent plane
[20:51:25] [PASSED] NV12 Handle for inexistent plane
[20:51:25] [PASSED] NV12 Handle for inexistent plane without DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] YVU420 DRM_MODE_FB_MODIFIERS set without modifier
[20:51:25] [PASSED] YVU420 Normal sizes
[20:51:25] [PASSED] YVU420 Max sizes
[20:51:25] [PASSED] YVU420 Invalid pitch
[20:51:25] [PASSED] YVU420 Different pitches
[20:51:25] [PASSED] YVU420 Different buffer offsets/pitches
[20:51:25] [PASSED] YVU420 Modifier set just for plane 0, without DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] YVU420 Modifier set just for planes 0, 1, without DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] YVU420 Modifier set just for plane 0, 1, with DRM_MODE_FB_MODIFIERS
[20:51:25] [PASSED] YVU420 Valid modifier
[20:51:25] [PASSED] YVU420 Different modifiers per plane
[20:51:25] [PASSED] YVU420 Modifier for inexistent plane
[20:51:25] [PASSED] YUV420_10BIT Invalid modifier(DRM_FORMAT_MOD_LINEAR)
[20:51:25] [PASSED] X0L2 Normal sizes
[20:51:25] [PASSED] X0L2 Max sizes
[20:51:25] [PASSED] X0L2 Invalid pitch
[20:51:25] [PASSED] X0L2 Pitch greater than minimum required
[20:51:25] [PASSED] X0L2 Handle for inexistent plane
[20:51:25] [PASSED] X0L2 Offset for inexistent plane, without DRM_MODE_FB_MODIFIERS set
[20:51:25] [PASSED] X0L2 Modifier without DRM_MODE_FB_MODIFIERS set
[20:51:25] [PASSED] X0L2 Valid modifier
[20:51:25] [PASSED] X0L2 Modifier for inexistent plane
[20:51:25] =========== [PASSED] drm_test_framebuffer_create ===========
[20:51:25] [PASSED] drm_test_framebuffer_free
[20:51:25] [PASSED] drm_test_framebuffer_init
[20:51:25] [PASSED] drm_test_framebuffer_init_bad_format
[20:51:25] [PASSED] drm_test_framebuffer_init_dev_mismatch
[20:51:25] [PASSED] drm_test_framebuffer_lookup
[20:51:25] [PASSED] drm_test_framebuffer_lookup_inexistent
[20:51:25] [PASSED] drm_test_framebuffer_modifiers_not_supported
[20:51:25] ================= [PASSED] drm_framebuffer =================
[20:51:25] ================ drm_gem_shmem (8 subtests) ================
[20:51:25] [PASSED] drm_gem_shmem_test_obj_create
[20:51:25] [PASSED] drm_gem_shmem_test_obj_create_private
[20:51:25] [PASSED] drm_gem_shmem_test_pin_pages
[20:51:25] [PASSED] drm_gem_shmem_test_vmap
[20:51:25] [PASSED] drm_gem_shmem_test_get_sg_table
[20:51:25] [PASSED] drm_gem_shmem_test_get_pages_sgt
[20:51:25] [PASSED] drm_gem_shmem_test_madvise
[20:51:25] [PASSED] drm_gem_shmem_test_purge
[20:51:25] ================== [PASSED] drm_gem_shmem ==================
[20:51:25] === drm_atomic_helper_connector_hdmi_check (29 subtests) ===
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode_vic_1
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode_vic_1
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode_vic_1
[20:51:25] ====== drm_test_check_broadcast_rgb_cea_mode_yuv420  =======
[20:51:25] [PASSED] Automatic
[20:51:25] [PASSED] Full
[20:51:25] [PASSED] Limited 16:235
[20:51:25] == [PASSED] drm_test_check_broadcast_rgb_cea_mode_yuv420 ===
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_changed
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_not_changed
[20:51:25] [PASSED] drm_test_check_disable_connector
[20:51:25] [PASSED] drm_test_check_hdmi_funcs_reject_rate
[20:51:25] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_rgb
[20:51:25] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_yuv420
[20:51:25] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422
[20:51:25] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420
[20:51:25] [PASSED] drm_test_check_driver_unsupported_fallback_yuv420
[20:51:25] [PASSED] drm_test_check_output_bpc_crtc_mode_changed
[20:51:25] [PASSED] drm_test_check_output_bpc_crtc_mode_not_changed
[20:51:25] [PASSED] drm_test_check_output_bpc_dvi
[20:51:25] [PASSED] drm_test_check_output_bpc_format_vic_1
[20:51:25] [PASSED] drm_test_check_output_bpc_format_display_8bpc_only
[20:51:25] [PASSED] drm_test_check_output_bpc_format_display_rgb_only
[20:51:25] [PASSED] drm_test_check_output_bpc_format_driver_8bpc_only
[20:51:25] [PASSED] drm_test_check_output_bpc_format_driver_rgb_only
[20:51:25] [PASSED] drm_test_check_tmds_char_rate_rgb_8bpc
[20:51:25] [PASSED] drm_test_check_tmds_char_rate_rgb_10bpc
[20:51:25] [PASSED] drm_test_check_tmds_char_rate_rgb_12bpc
[20:51:25] ============ drm_test_check_hdmi_color_format  =============
[20:51:25] [PASSED] AUTO -> RGB
[20:51:25] [PASSED] YCBCR422 -> YUV422
[20:51:25] [PASSED] YCBCR420 -> YUV420
[20:51:25] [PASSED] YCBCR444 -> YUV444
[20:51:25] [PASSED] RGB -> RGB
[20:51:25] ======== [PASSED] drm_test_check_hdmi_color_format =========
[20:51:25] ======== drm_test_check_hdmi_color_format_420_only  ========
[20:51:25] [PASSED] RGB should fail
[20:51:25] [PASSED] YUV444 should fail
[20:51:25] [PASSED] YUV422 should fail
[20:51:25] [PASSED] YUV420 should work
[20:51:25] ==== [PASSED] drm_test_check_hdmi_color_format_420_only ====
[20:51:25] ===== [PASSED] drm_atomic_helper_connector_hdmi_check ======
[20:51:25] === drm_atomic_helper_connector_hdmi_reset (6 subtests) ====
[20:51:25] [PASSED] drm_test_check_broadcast_rgb_value
[20:51:25] [PASSED] drm_test_check_bpc_8_value
[20:51:25] [PASSED] drm_test_check_bpc_10_value
[20:51:25] [PASSED] drm_test_check_bpc_12_value
[20:51:25] [PASSED] drm_test_check_format_value
[20:51:25] [PASSED] drm_test_check_tmds_char_value
[20:51:25] ===== [PASSED] drm_atomic_helper_connector_hdmi_reset ======
[20:51:25] = drm_atomic_helper_connector_hdmi_mode_valid (7 subtests) =
[20:51:25] [PASSED] drm_test_check_mode_valid
[20:51:25] [PASSED] drm_test_check_mode_valid_reject
[20:51:25] [PASSED] drm_test_check_mode_valid_reject_rate
[20:51:25] [PASSED] drm_test_check_mode_valid_reject_max_clock
[20:51:25] [PASSED] drm_test_check_mode_valid_yuv420_only_max_clock
[20:51:25] [PASSED] drm_test_check_mode_valid_reject_yuv420_only_connector
[20:51:25] [PASSED] drm_test_check_mode_valid_accept_yuv420_also_connector_rgb
[20:51:25] === [PASSED] drm_atomic_helper_connector_hdmi_mode_valid ===
[20:51:25] = drm_atomic_helper_connector_hdmi_infoframes (5 subtests) =
[20:51:25] [PASSED] drm_test_check_infoframes
[20:51:25] [PASSED] drm_test_check_reject_avi_infoframe
[20:51:25] [PASSED] drm_test_check_reject_hdr_infoframe_bpc_8
[20:51:25] [PASSED] drm_test_check_reject_hdr_infoframe_bpc_10
[20:51:25] [PASSED] drm_test_check_reject_audio_infoframe
[20:51:25] === [PASSED] drm_atomic_helper_connector_hdmi_infoframes ===
[20:51:25] ================= drm_managed (2 subtests) =================
[20:51:25] [PASSED] drm_test_managed_release_action
[20:51:25] [PASSED] drm_test_managed_run_action
[20:51:25] =================== [PASSED] drm_managed ===================
[20:51:25] =================== drm_mm (6 subtests) ====================
[20:51:25] [PASSED] drm_test_mm_init
[20:51:25] [PASSED] drm_test_mm_debug
[20:51:25] [PASSED] drm_test_mm_align32
[20:51:25] [PASSED] drm_test_mm_align64
[20:51:25] [PASSED] drm_test_mm_lowest
[20:51:25] [PASSED] drm_test_mm_highest
[20:51:25] ===================== [PASSED] drm_mm ======================
[20:51:25] ============= drm_modes_analog_tv (5 subtests) =============
[20:51:25] [PASSED] drm_test_modes_analog_tv_mono_576i
[20:51:25] [PASSED] drm_test_modes_analog_tv_ntsc_480i
[20:51:25] [PASSED] drm_test_modes_analog_tv_ntsc_480i_inlined
[20:51:25] [PASSED] drm_test_modes_analog_tv_pal_576i
[20:51:25] [PASSED] drm_test_modes_analog_tv_pal_576i_inlined
[20:51:25] =============== [PASSED] drm_modes_analog_tv ===============
[20:51:25] ============== drm_panic_helper (3 subtests) ===============
[20:51:25] ============= drm_test_panic_screen_user_map  ==============
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] ========= [PASSED] drm_test_panic_screen_user_map ==========
[20:51:25] ============= drm_test_panic_screen_user_page  =============
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] ========= [PASSED] drm_test_panic_screen_user_page =========
[20:51:25] ========== drm_test_panic_screen_user_set_pixel  ===========
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen user, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 494 x 494 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1920 x 1080 	XR24 little-endian (0x34325258)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG16 little-endian (0x36314752)
[20:51:25] [PASSED] Panic screen kmsg, mode: 1024 x 768 	RG24 little-endian (0x34324752)
[20:51:25] ====== [PASSED] drm_test_panic_screen_user_set_pixel =======
[20:51:25] ================ [PASSED] drm_panic_helper =================
[20:51:25] ============== drm_plane_helper (2 subtests) ===============
[20:51:25] =============== drm_test_check_plane_state  ================
[20:51:25] [PASSED] clipping_simple
[20:51:25] [PASSED] clipping_rotate_reflect
[20:51:25] [PASSED] positioning_simple
[20:51:25] [PASSED] upscaling
[20:51:25] [PASSED] downscaling
[20:51:25] [PASSED] rounding1
[20:51:25] [PASSED] rounding2
[20:51:25] [PASSED] rounding3
[20:51:25] [PASSED] rounding4
[20:51:25] =========== [PASSED] drm_test_check_plane_state ============
[20:51:25] =========== drm_test_check_invalid_plane_state  ============
[20:51:25] [PASSED] positioning_invalid
[20:51:25] [PASSED] upscaling_invalid
[20:51:25] [PASSED] downscaling_invalid
[20:51:25] ======= [PASSED] drm_test_check_invalid_plane_state ========
[20:51:25] ================ [PASSED] drm_plane_helper =================
[20:51:25] ====== drm_connector_helper_tv_get_modes (1 subtest) =======
[20:51:25] ====== drm_test_connector_helper_tv_get_modes_check  =======
[20:51:25] [PASSED] None
[20:51:25] [PASSED] PAL
[20:51:25] [PASSED] NTSC
[20:51:25] [PASSED] Both, NTSC Default
[20:51:25] [PASSED] Both, PAL Default
[20:51:25] [PASSED] Both, NTSC Default, with PAL on command-line
[20:51:25] [PASSED] Both, PAL Default, with NTSC on command-line
[20:51:25] == [PASSED] drm_test_connector_helper_tv_get_modes_check ===
[20:51:25] ======== [PASSED] drm_connector_helper_tv_get_modes ========
[20:51:25] ================== drm_rect (9 subtests) ===================
[20:51:25] [PASSED] drm_test_rect_clip_scaled_div_by_zero
[20:51:25] [PASSED] drm_test_rect_clip_scaled_not_clipped
[20:51:25] [PASSED] drm_test_rect_clip_scaled_clipped
[20:51:25] [PASSED] drm_test_rect_clip_scaled_signed_vs_unsigned
[20:51:25] ================= drm_test_rect_intersect  =================
[20:51:25] [PASSED] top-left x bottom-right: 2x2+1+1 x 2x2+0+0
[20:51:25] [PASSED] top-right x bottom-left: 2x2+0+0 x 2x2+1-1
[20:51:25] [PASSED] bottom-left x top-right: 2x2+1-1 x 2x2+0+0
[20:51:25] [PASSED] bottom-right x top-left: 2x2+0+0 x 2x2+1+1
[20:51:25] [PASSED] right x left: 2x1+0+0 x 3x1+1+0
[20:51:25] [PASSED] left x right: 3x1+1+0 x 2x1+0+0
[20:51:25] [PASSED] up x bottom: 1x2+0+0 x 1x3+0-1
[20:51:25] [PASSED] bottom x up: 1x3+0-1 x 1x2+0+0
[20:51:25] [PASSED] touching corner: 1x1+0+0 x 2x2+1+1
[20:51:25] [PASSED] touching side: 1x1+0+0 x 1x1+1+0
[20:51:25] [PASSED] equal rects: 2x2+0+0 x 2x2+0+0
[20:51:25] [PASSED] inside another: 2x2+0+0 x 1x1+1+1
[20:51:25] [PASSED] far away: 1x1+0+0 x 1x1+3+6
[20:51:25] [PASSED] points intersecting: 0x0+5+10 x 0x0+5+10
[20:51:25] [PASSED] points not intersecting: 0x0+0+0 x 0x0+5+10
[20:51:25] ============= [PASSED] drm_test_rect_intersect =============
[20:51:25] ================ drm_test_rect_calc_hscale  ================
[20:51:25] [PASSED] normal use
[20:51:25] [PASSED] out of max range
[20:51:25] [PASSED] out of min range
[20:51:25] [PASSED] zero dst
[20:51:25] [PASSED] negative src
[20:51:25] [PASSED] negative dst
[20:51:25] ============ [PASSED] drm_test_rect_calc_hscale ============
[20:51:25] ================ drm_test_rect_calc_vscale  ================
[20:51:25] [PASSED] normal use
[20:51:25] [PASSED] out of max range
[20:51:25] [PASSED] out of min range
[20:51:25] [PASSED] zero dst
[20:51:25] [PASSED] negative src
[20:51:25] [PASSED] negative dst
[20:51:25] ============ [PASSED] drm_test_rect_calc_vscale ============
[20:51:25] ================== drm_test_rect_rotate  ===================
[20:51:25] [PASSED] reflect-x
[20:51:25] [PASSED] reflect-y
[20:51:25] [PASSED] rotate-0
[20:51:25] [PASSED] rotate-90
[20:51:25] [PASSED] rotate-180
[20:51:25] [PASSED] rotate-270
[20:51:25] ============== [PASSED] drm_test_rect_rotate ===============
[20:51:25] ================ drm_test_rect_rotate_inv  =================
[20:51:25] [PASSED] reflect-x
[20:51:25] [PASSED] reflect-y
[20:51:25] [PASSED] rotate-0
[20:51:25] [PASSED] rotate-90
[20:51:25] [PASSED] rotate-180
[20:51:25] [PASSED] rotate-270
[20:51:25] ============ [PASSED] drm_test_rect_rotate_inv =============
[20:51:25] ==================== [PASSED] drm_rect =====================
[20:51:25] ============ drm_sysfb_modeset_test (1 subtest) ============
[20:51:25] ============ drm_test_sysfb_build_fourcc_list  =============
[20:51:25] [PASSED] no native formats
[20:51:25] [PASSED] XRGB8888 as native format
[20:51:25] [PASSED] remove duplicates
[20:51:25] [PASSED] convert alpha formats
[20:51:25] [PASSED] random formats
[20:51:25] ======== [PASSED] drm_test_sysfb_build_fourcc_list =========
[20:51:25] ============= [PASSED] drm_sysfb_modeset_test ==============
[20:51:25] ================== drm_fixp (2 subtests) ===================
[20:51:25] [PASSED] drm_test_int2fixp
[20:51:25] [PASSED] drm_test_sm2fixp
[20:51:25] ==================== [PASSED] drm_fixp =====================
[20:51:25] ============================================================
[20:51:25] Testing complete. Ran 667 tests: passed: 667
[20:51:25] Elapsed time: 28.287s total, 2.509s configuring, 25.463s building, 0.289s running

+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/drm/ttm/tests/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/ttm/tests/.kunitconfig
[20:51:25] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[20:51:28] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[20:51:38] Starting KUnit Kernel (1/1)...
[20:51:38] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[20:51:38] ================= ttm_device (5 subtests) ==================
[20:51:38] [PASSED] ttm_device_init_basic
[20:51:38] [PASSED] ttm_device_init_multiple
[20:51:38] [PASSED] ttm_device_fini_basic
[20:51:38] [PASSED] ttm_device_init_no_vma_man
[20:51:38] ================== ttm_device_init_pools  ==================
[20:51:38] [PASSED] No DMA allocations, no DMA32 required
[20:51:38] [PASSED] DMA allocations, DMA32 required
[20:51:38] [PASSED] No DMA allocations, DMA32 required
[20:51:38] [PASSED] DMA allocations, no DMA32 required
[20:51:38] ============== [PASSED] ttm_device_init_pools ==============
[20:51:38] =================== [PASSED] ttm_device ====================
[20:51:38] ================== ttm_pool (8 subtests) ===================
[20:51:38] ================== ttm_pool_alloc_basic  ===================
[20:51:38] [PASSED] One page
[20:51:38] [PASSED] More than one page
[20:51:38] [PASSED] Above the allocation limit
[20:51:38] [PASSED] One page, with coherent DMA mappings enabled
[20:51:38] [PASSED] Above the allocation limit, with coherent DMA mappings enabled
[20:51:38] ============== [PASSED] ttm_pool_alloc_basic ===============
[20:51:38] ============== ttm_pool_alloc_basic_dma_addr  ==============
[20:51:38] [PASSED] One page
[20:51:38] [PASSED] More than one page
[20:51:38] [PASSED] Above the allocation limit
[20:51:38] [PASSED] One page, with coherent DMA mappings enabled
[20:51:38] [PASSED] Above the allocation limit, with coherent DMA mappings enabled
[20:51:38] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
[20:51:38] [PASSED] ttm_pool_alloc_order_caching_match
[20:51:38] [PASSED] ttm_pool_alloc_caching_mismatch
[20:51:38] [PASSED] ttm_pool_alloc_order_mismatch
[20:51:38] [PASSED] ttm_pool_free_dma_alloc
[20:51:38] [PASSED] ttm_pool_free_no_dma_alloc
[20:51:38] [PASSED] ttm_pool_fini_basic
[20:51:38] ==================== [PASSED] ttm_pool =====================
[20:51:38] ================ ttm_resource (8 subtests) =================
[20:51:38] ================= ttm_resource_init_basic  =================
[20:51:38] [PASSED] Init resource in TTM_PL_SYSTEM
[20:51:38] [PASSED] Init resource in TTM_PL_VRAM
[20:51:38] [PASSED] Init resource in a private placement
[20:51:38] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags
[20:51:38] ============= [PASSED] ttm_resource_init_basic =============
[20:51:38] [PASSED] ttm_resource_init_pinned
[20:51:38] [PASSED] ttm_resource_fini_basic
[20:51:38] [PASSED] ttm_resource_manager_init_basic
[20:51:38] [PASSED] ttm_resource_manager_usage_basic
[20:51:38] [PASSED] ttm_resource_manager_set_used_basic
[20:51:38] [PASSED] ttm_sys_man_alloc_basic
[20:51:38] [PASSED] ttm_sys_man_free_basic
[20:51:38] ================== [PASSED] ttm_resource ===================
[20:51:38] =================== ttm_tt (15 subtests) ===================
[20:51:38] ==================== ttm_tt_init_basic  ====================
[20:51:38] [PASSED] Page-aligned size
[20:51:38] [PASSED] Extra pages requested
[20:51:38] ================ [PASSED] ttm_tt_init_basic ================
[20:51:38] [PASSED] ttm_tt_init_misaligned
[20:51:38] [PASSED] ttm_tt_fini_basic
[20:51:38] [PASSED] ttm_tt_fini_sg
[20:51:38] [PASSED] ttm_tt_fini_shmem
[20:51:38] [PASSED] ttm_tt_create_basic
[20:51:38] [PASSED] ttm_tt_create_invalid_bo_type
[20:51:38] [PASSED] ttm_tt_create_ttm_exists
[20:51:38] [PASSED] ttm_tt_create_failed
[20:51:38] [PASSED] ttm_tt_destroy_basic
[20:51:38] [PASSED] ttm_tt_populate_null_ttm
[20:51:38] [PASSED] ttm_tt_populate_populated_ttm
[20:51:38] [PASSED] ttm_tt_unpopulate_basic
[20:51:38] [PASSED] ttm_tt_unpopulate_empty_ttm
[20:51:38] [PASSED] ttm_tt_swapin_basic
[20:51:38] ===================== [PASSED] ttm_tt ======================
[20:51:38] =================== ttm_bo (14 subtests) ===================
[20:51:38] =========== ttm_bo_reserve_optimistic_no_ticket  ===========
[20:51:38] [PASSED] Cannot be interrupted and sleeps
[20:51:38] [PASSED] Cannot be interrupted, locks straight away
[20:51:38] [PASSED] Can be interrupted, sleeps
[20:51:38] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket =======
[20:51:38] [PASSED] ttm_bo_reserve_locked_no_sleep
[20:51:38] [PASSED] ttm_bo_reserve_no_wait_ticket
[20:51:38] [PASSED] ttm_bo_reserve_double_resv
[20:51:38] [PASSED] ttm_bo_reserve_interrupted
[20:51:38] [PASSED] ttm_bo_reserve_deadlock
[20:51:38] [PASSED] ttm_bo_unreserve_basic
[20:51:38] [PASSED] ttm_bo_unreserve_pinned
[20:51:38] [PASSED] ttm_bo_unreserve_bulk
[20:51:38] [PASSED] ttm_bo_fini_basic
[20:51:38] [PASSED] ttm_bo_fini_shared_resv
[20:51:38] [PASSED] ttm_bo_pin_basic
[20:51:38] [PASSED] ttm_bo_pin_unpin_resource
[20:51:38] [PASSED] ttm_bo_multiple_pin_one_unpin
[20:51:38] ===================== [PASSED] ttm_bo ======================
[20:51:38] ============== ttm_bo_validate (22 subtests) ===============
[20:51:38] ============== ttm_bo_init_reserved_sys_man  ===============
[20:51:38] [PASSED] Buffer object for userspace
[20:51:38] [PASSED] Kernel buffer object
[20:51:38] [PASSED] Shared buffer object
[20:51:38] ========== [PASSED] ttm_bo_init_reserved_sys_man ===========
[20:51:38] ============== ttm_bo_init_reserved_mock_man  ==============
[20:51:38] [PASSED] Buffer object for userspace
[20:51:38] [PASSED] Kernel buffer object
[20:51:38] [PASSED] Shared buffer object
[20:51:38] ========== [PASSED] ttm_bo_init_reserved_mock_man ==========
[20:51:38] [PASSED] ttm_bo_init_reserved_resv
[20:51:38] ================== ttm_bo_validate_basic  ==================
[20:51:38] [PASSED] Buffer object for userspace
[20:51:38] [PASSED] Kernel buffer object
[20:51:38] [PASSED] Shared buffer object
[20:51:38] ============== [PASSED] ttm_bo_validate_basic ==============
[20:51:38] [PASSED] ttm_bo_validate_invalid_placement
[20:51:38] ============= ttm_bo_validate_same_placement  ==============
[20:51:38] [PASSED] System manager
[20:51:38] [PASSED] VRAM manager
[20:51:38] ========= [PASSED] ttm_bo_validate_same_placement ==========
[20:51:38] [PASSED] ttm_bo_validate_failed_alloc
[20:51:38] [PASSED] ttm_bo_validate_pinned
[20:51:38] [PASSED] ttm_bo_validate_busy_placement
[20:51:38] ================ ttm_bo_validate_multihop  =================
[20:51:38] [PASSED] Buffer object for userspace
[20:51:38] [PASSED] Kernel buffer object
[20:51:38] [PASSED] Shared buffer object
[20:51:38] ============ [PASSED] ttm_bo_validate_multihop =============
[20:51:38] ========== ttm_bo_validate_no_placement_signaled  ==========
[20:51:38] [PASSED] Buffer object in system domain, no page vector
[20:51:38] [PASSED] Buffer object in system domain with an existing page vector
[20:51:38] ====== [PASSED] ttm_bo_validate_no_placement_signaled ======
[20:51:38] ======== ttm_bo_validate_no_placement_not_signaled  ========
[20:51:38] [PASSED] Buffer object for userspace
[20:51:38] [PASSED] Kernel buffer object
[20:51:38] [PASSED] Shared buffer object
[20:51:38] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ====
[20:51:38] [PASSED] ttm_bo_validate_move_fence_signaled
[20:51:38] ========= ttm_bo_validate_move_fence_not_signaled  =========
[20:51:38] [PASSED] Waits for GPU
[20:51:38] [PASSED] Tries to lock straight away
[20:51:38] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled =====
[20:51:38] [PASSED] ttm_bo_validate_swapout
[20:51:38] [PASSED] ttm_bo_validate_happy_evict
[20:51:38] [PASSED] ttm_bo_validate_all_pinned_evict
[20:51:38] [PASSED] ttm_bo_validate_allowed_only_evict
[20:51:38] [PASSED] ttm_bo_validate_deleted_evict
[20:51:38] [PASSED] ttm_bo_validate_busy_domain_evict
[20:51:38] [PASSED] ttm_bo_validate_evict_gutting
[20:51:38] [PASSED] ttm_bo_validate_recursive_evict
[20:51:38] ================= [PASSED] ttm_bo_validate =================
[20:51:38] ============================================================
[20:51:38] Testing complete. Ran 102 tests: passed: 102
[20:51:38] Elapsed time: 13.021s total, 2.524s configuring, 10.282s building, 0.183s running

+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/dma-buf/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/dma-buf/.kunitconfig
[20:51:38] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[20:51:41] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[20:51:50] Starting KUnit Kernel (1/1)...
[20:51:50] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[20:51:50] =============== dma-buf-fence (12 subtests) ================
[20:51:50] [PASSED] test_sanitycheck
[20:51:50] [PASSED] test_signaling
[20:51:50] [PASSED] test_add_callback
[20:51:50] [PASSED] test_late_add_callback
[20:51:50] [PASSED] test_rm_callback
[20:51:50] [PASSED] test_late_rm_callback
[20:51:50] [PASSED] test_status
[20:51:50] [PASSED] test_error
[20:51:50] [PASSED] test_wait
[20:51:50] [PASSED] test_wait_timeout
[20:51:50] [PASSED] test_stub
[20:51:50] [SKIPPED] test_race_signal_callback (requires at least 2 CPUs)
[20:51:50] ================== [PASSED] dma-buf-fence ==================
[20:51:50] ============ dma-buf-fence-chain (11 subtests) =============
[20:51:50] [PASSED] test_sanitycheck
[20:51:50] [PASSED] test_find_seqno
[20:51:50] [PASSED] test_find_signaled
[20:51:50] [PASSED] test_find_out_of_order
[20:51:55] [PASSED] test_find_gap
[20:51:55] [PASSED] test_find_race
[20:51:55] [PASSED] test_signal_forward
[20:51:55] [PASSED] test_signal_backward
[20:51:55] [PASSED] test_wait_forward
[20:51:55] [PASSED] test_wait_backward
[20:51:55] [PASSED] test_wait_random
[20:51:55] =============== [PASSED] dma-buf-fence-chain ===============
[20:51:55] ============ dma-buf-fence-unwrap (11 subtests) ============
[20:51:55] [PASSED] test_sanitycheck
[20:51:55] [PASSED] test_unwrap_array
[20:51:55] [PASSED] test_unwrap_chain
[20:51:55] [PASSED] test_unwrap_chain_array
[20:51:55] [PASSED] test_unwrap_merge
[20:51:55] [PASSED] test_unwrap_merge_duplicate
[20:51:55] [PASSED] test_unwrap_merge_seqno
[20:51:55] [PASSED] test_unwrap_merge_order
[20:51:55] [PASSED] test_unwrap_merge_complex
[20:51:55] [PASSED] test_unwrap_merge_complex_seqno
[20:51:55] [PASSED] test_dedup_empty
[20:51:55] ============== [PASSED] dma-buf-fence-unwrap ===============
[20:51:55] ================ dma-buf-resv (5 subtests) =================
[20:51:55] [PASSED] test_sanitycheck
[20:51:55] ===================== test_signaling  ======================
[20:51:55] [PASSED] kernel
[20:51:55] [PASSED] write
[20:51:55] [PASSED] read
[20:51:55] [PASSED] bookkeep
[20:51:55] ================= [PASSED] test_signaling ==================
[20:51:55] ====================== test_for_each  ======================
[20:51:55] [PASSED] kernel
[20:51:55] [PASSED] write
[20:51:55] [PASSED] read
[20:51:55] [PASSED] bookkeep
[20:51:55] ================== [PASSED] test_for_each ==================
[20:51:55] ================= test_for_each_unlocked  ==================
[20:51:55] [PASSED] kernel
[20:51:55] [PASSED] write
[20:51:55] [PASSED] read
[20:51:55] [PASSED] bookkeep
[20:51:55] ============= [PASSED] test_for_each_unlocked ==============
[20:51:55] ===================== test_get_fences  =====================
[20:51:55] [PASSED] kernel
[20:51:55] [PASSED] write
[20:51:55] [PASSED] read
[20:51:55] [PASSED] bookkeep
[20:51:55] ================= [PASSED] test_get_fences =================
[20:51:55] ================== [PASSED] dma-buf-resv ===================
[20:51:55] ============================================================
[20:51:55] Testing complete. Ran 51 tests: passed: 50, skipped: 1
[20:51:55] Elapsed time: 16.695s total, 2.577s configuring, 8.745s building, 5.335s running

+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper
  2026-11-30 18:50 ` [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
@ 2026-11-30 20:59   ` Rodrigo Vivi
  0 siblings, 0 replies; 17+ messages in thread
From: Rodrigo Vivi @ 2026-11-30 20:59 UTC (permalink / raw)
  To: Karthik Poosa
  Cc: intel-xe, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro,
	sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri

On Tue, Dec 01, 2026 at 12:20:43AM +0530, Karthik Poosa wrote:
> Add a pcode helper that issues an ordered sequence of mailbox writes
> while holding the pcode lock, so no other mailbox command can be
> interleaved.
> 
> Some pcode interfaces keep state across mailbox commands. A fan table is
> written one point at a time with FSC_WRITE_FAN_TABLE and loaded by a
> final FSC_WRITE_NUM_FAN_CONTROL_POINTS write. pcode does not tie the
> staged points to a requester, so fan table writes from another caller
> in the middle of the sequence can be merged into it, and the commit then
> either fails with illegal data or loads a wrong table.
> 
> Serialize all fan control table writes, for every fan, on the pcode
> lock rather than per fan. Caller-side locks such as the hwmon lock only
> order callers that take them; the pcode lock orders every mailbox user
> in the driver.
> 
> Lock hold time is the sum of the pcode response times of the batch. Each
> write is bounded by PCODE_DEFAULT_TIMEOUT_MS, and a write that times out
> ends the batch, so the worst case is count * PCODE_DEFAULT_TIMEOUT_MS
> (110 ms for the largest fan table of 10 points plus the count write).
> Other pcode users wait on the lock with mutex_lock() and start their own
> mailbox timeout only after acquiring it, so a batch delays them but does
> not make them time out. This is in line with existing pcode lock users:
> xe_pcode_request() holds the lock for up to its base timeout plus 50 ms,
> and xe_pcode_init_min_freq_table() holds it across a loop of writes.
> 
> This will be used to write fan tables atomically with respect to other
> pcode users.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
> 
> v2:
>  - Explain why pcode needs the writes without interleaving, and the
>    lock hold time impact on other pcode users. (sashiko)
> 
>  drivers/gpu/drm/xe/xe_pcode.c | 49 +++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_pcode.h | 12 +++++++++
>  2 files changed, 61 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> index fa9f45d565cb..f465decbf946 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.c
> +++ b/drivers/gpu/drm/xe/xe_pcode.c
> @@ -124,6 +124,55 @@ int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 data, int timeout
>  	return err;
>  }
>  
> +/**
> + * xe_pcode_write_batch - issue pcode writes in order under the mailbox lock
> + * @tile: tile
> + * @writes: mailbox/data pairs to write
> + * @count: number of entries in @writes
> + *
> + * Some pcode interfaces keep state across mailbox commands; e.g. a fan table
> + * is written point by point and loaded by a final point count write. Holding
> + * the pcode lock across all writes keeps each such sequence atomic with
> + * respect to every other mailbox user, including fan table writes for any
> + * other fan, independent of caller-side locks.
> + *
> + * The lock is held for the sum of the pcode response times, bounded by
> + * @count * PCODE_DEFAULT_TIMEOUT_MS; a write that times out ends the batch.
> + * Other pcode users sleep on the lock and start their own mailbox timeout only
> + * once they own it, so they are delayed but do not time out. Keep @count small.
> + *
> + * Stops at the first failure; earlier writes are not reverted.
> + *
> + * Context: Process context. Takes and releases the pcode lock.
> + * Return: 0 on success, negative error code otherwise.
> + */
> +int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
> +			 unsigned int count)
> +{
> +	unsigned int i;
> +	int err = 0;
> +
> +	if (!count)
> +		return -EINVAL;
> +
> +	mutex_lock(&tile->pcode.lock);
> +	for (i = 0; i < count; i++) {
> +		u32 data = writes[i].data;
> +
> +		err = pcode_mailbox_rw(tile, writes[i].mbox, &data, NULL, PCODE_DEFAULT_TIMEOUT_MS,
> +				       false, false);
> +		if (err) {
> +			xe_err(tile_to_xe(tile),
> +			       "pcode batch write %u/%u failed: mbox 0x%08x data 0x%08x, ret %pe\n",
> +			       i + 1, count, writes[i].mbox, writes[i].data, ERR_PTR(err));
> +			break;
> +		}
> +	}
> +	mutex_unlock(&tile->pcode.lock);
> +
> +	return err;
> +}
> +
>  int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0, u32 data1, int timeout)
>  {
>  	int err;
> diff --git a/drivers/gpu/drm/xe/xe_pcode.h b/drivers/gpu/drm/xe/xe_pcode.h
> index 7e43792b0037..c601a12baba6 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.h
> +++ b/drivers/gpu/drm/xe/xe_pcode.h
> @@ -18,6 +18,16 @@ struct xe_pcode_version {
>  	u32 engg;
>  };
>  
> +/**
> + * struct xe_pcode_write - single pcode mailbox write
> + * @mbox: mailbox command
> + * @data: value written to PCODE_DATA0
> + */
> +struct xe_pcode_write {
> +	u32 mbox;
> +	u32 data;
> +};
> +
>  #define PCODE_DEFAULT_TIMEOUT_MS	10
>  
>  int xe_pcode_init_early(struct xe_tile *tile);
> @@ -28,6 +38,8 @@ int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,
>  int xe_pcode_read(struct xe_tile *tile, u32 mbox, u32 *val0, u32 *val1);
>  int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 val,
>  			   int timeout_ms);
> +int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
> +			 unsigned int count);
>  int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0,
>  			     u32 data1, int timeout);
>  int xe_get_pcode_version(struct xe_device *xe, struct xe_pcode_version *version);
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support
  2026-11-30 18:50 ` [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
@ 2026-11-30 21:00   ` Rodrigo Vivi
  0 siblings, 0 replies; 17+ messages in thread
From: Rodrigo Vivi @ 2026-11-30 21:00 UTC (permalink / raw)
  To: Karthik Poosa
  Cc: intel-xe, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro,
	sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri

On Tue, Dec 01, 2026 at 12:20:46AM +0530, Karthik Poosa wrote:
> Expose curve-point temperature and pwm controls via
> pwmF_auto_point[P]_temp and pwmF_auto_point[P]_pwm, where
> F is the fan number and P is the fan curve point number.
> Each fan curve point has a temperature and a pwm attribute.
> 
> Update Xe hwmon ABI documentation for pwm auto point temperature
> attributes.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
> 
> v2:
>  - Use xe helpers for dmesg logs.
>  - Update kernel version in Xe hwmon documentation.
>  - Correct debug level of some dmesg logs.
> 
> v3:
>  - Allow variable fan curve points from >=2 to MAX_FAN_CONTROL_POINTS.
>  - Expose all MAX_FAN_CONTROL_POINTS fan-curve slots so users can extend
>    a short fan table.
>  - Stage temp/PWM pairs without changing the active curve. Commit at a
>    (0, 0) end marker or after all MAX_FAN_CONTROL_POINTS pairs.
>  - Write the points together, verify the firmware count, then update the
>    active cache.
> 
> v4:
>  - Use the two-argument IS_FAN_ENABLED() after rebase.
>  - Fix kernel-doc for nested staged fan_table members.
>  - Use "speed" for percent values and "pwm" only for the 0..255 sysfs
>    value. (Soham)
>  - Use u32 for the point index in xe_hwmon_commit_user_fan_table(). (Soham)
>  - Fix comment to say curve points must not decrease. (Soham)
>  - Add debug logs before -EINVAL returns. (Soham)
>  - Drop inline from xe_hwmon_get_active_fan_table(). (Soham)
>  - Use reverse xmas tree ordering for local variables. (Soham)
>  - Rename xe_hwmon_get_u8_from_sysfs() to xe_hwmon_sysfs_to_hw_val().
>    (Soham)
>  - Use if/else if/else for value selection in pwm auto point show. (Soham)
>  - Create the fan curve sensor attributes at probe time instead of 60
>    static definitions. (Soham)
>  - Clamp min PWM to 100% and reject pwm values above 100% speed.
>  - Use xe helpers for logs in the auto point store functions.
> 
> v5:
>  - Address review comments from Sashiko.
>  - Remove min_pwm as it is not available.
>  - Read back the user point count after curve programming and fall back
>    to stock control when firmware does not accept it.
> 
> v6:
>  - Require strictly increasing temperatures across curve points, as
>    firmware rejects equal temperatures.
>  - Reject tables with fewer than MIN_FAN_CONTROL_POINTS before writing
>    to firmware.
>  - Expose pwmN_auto_point* only when the fan has a stock table, like
>    pwmN_enable.
>  - Return -ENODATA from pwmN_auto_point* reads while the fan control
>    mode is not established, like pwmN and pwmN_enable.
>  - Add the missing ABI documentation for pwm[1-3]_auto_point[1-10]_temp
>    and pwm[1-3]_auto_point[1-10]_pwm.
>  - Use reverse xmas tree ordering in xe_hwmon_activate_user_fan_table().
>    (Soham)
>  - Drop the else after return in xe_hwmon_get_active_fan_table().
>    (Soham)
>  - Keep staged curve points when the user table is re-applied on
>    resume or after late binding; clear them only on pwm_enable writes.
>    (sashiko)
>  - Document that a failed completing curve write drops all staged
>    points. (Soham)
> 
>  .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  46 ++
>  drivers/gpu/drm/xe/xe_hwmon.c                 | 513 +++++++++++++++---
>  2 files changed, 475 insertions(+), 84 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> index dbf2c6d01376..81c0c8217d4a 100644
> --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> @@ -374,3 +374,49 @@ Description:	RW. Fan control mode selector.
>  		from the firmware stock curve.
>  
>  		Only supported for particular Intel Xe graphics platforms.
> +
> +What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_auto_point[1-10]_temp
> +Date:		December 2026
> +KernelVersion:	7.5

This will have to change if we miss this round.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +Contact:	intel-xe@lists.freedesktop.org
> +Description:	RW. Temperature of fan curve point in millidegree Celsius.
> +
> +		Reads return the point of the stock fan curve when
> +		pwm[1-3]_enable is 2 and of the user fan curve otherwise. Unused
> +		points read 0. Reads fail with -ENODATA while the fan control
> +		mode is not established.
> +
> +		Writes stage the user curve point and require pwm[1-3]_enable
> +		to be 1; otherwise they are rejected with -EINVAL. See
> +		pwm[1-3]_auto_point[1-10]_pwm for how the curve is committed.
> +
> +		Only supported for particular Intel Xe graphics platforms.
> +
> +What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_auto_point[1-10]_pwm
> +Date:		December 2026
> +KernelVersion:	7.5
> +Contact:	intel-xe@lists.freedesktop.org
> +Description:	RW. Fan PWM duty of fan curve point in the range 0..255, where
> +		255 is 100% fan speed. Firmware stores the duty in percent, so
> +		reads return the value rounded to the nearest percent step.
> +
> +		Reads return the point of the stock fan curve when
> +		pwm[1-3]_enable is 2 and of the user fan curve otherwise. Unused
> +		points read 0. Reads fail with -ENODATA while the fan control
> +		mode is not established.
> +
> +		Writes stage the user curve point and require pwm[1-3]_enable
> +		to be 1; otherwise they are rejected with -EINVAL. Nonzero
> +		values are kept at least 1%.
> +
> +		The staged curve is programmed once points 1..K all have both a
> +		temperature and a PWM value and either point K+1 is set to
> +		temperature 0 and PWM 0, or K is 10. The end marker is not part
> +		of the curve. The curve needs at least two points, temperature
> +		must increase and PWM must not decrease from one point to the
> +		next; otherwise the completing write fails with -EINVAL. A
> +		completing write that fails drops all staged points. If
> +		firmware does not accept the curve, the fan falls back to
> +		pwm[1-3]_enable 2 and the write fails.
> +
> +		Only supported for particular Intel Xe graphics platforms.
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 1ef9c12b7110..857c9d293f09 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -174,6 +174,11 @@ enum fan_table_type {
>  /* Minimum number of points required for a user fan table. */
>  #define MIN_FAN_CONTROL_POINTS	2
>  
> +/* pwmN_auto_pointM_temp and pwmN_auto_pointM_pwm for every curve point of a fan. */
> +#define XE_CURVE_ATTRS_PER_FAN	(2 * MAX_FAN_CONTROL_POINTS)
> +#define XE_CURVE_ATTRS		(FAN_MAX * XE_CURVE_ATTRS_PER_FAN)
> +#define XE_CURVE_ATTR_NAME_LEN	sizeof("pwmN_auto_pointNN_temp")
> +
>  /* Fan control point index: bit31 selects fan table type; bits30:0 control point index. */
>  #define FCP_INDEX(table_type, point_num) (((u32)(table_type) << 31) | \
>  						((u32)(point_num) & GENMASK(30, 0)))
> @@ -201,6 +206,12 @@ struct xe_hwmon_fan_info {
>  			/** @fan_table.fcp.speed: fan speed in percentage */
>  			u8 speed;
>  		} fcp[MAX_FAN_CONTROL_POINTS];
> +		/** @fan_table.staged_fcp: curve supplied via sysfs but not yet committed */
> +		struct fan_control_point staged_fcp[MAX_FAN_CONTROL_POINTS];
> +		/** @fan_table.temp_staged: bitmask of temperature fields supplied via sysfs */
> +		u16 temp_staged;
> +		/** @fan_table.speed_staged: bitmask of speed fields supplied via sysfs */
> +		u16 speed_staged;
>  	} fan_table[FAN_TABLE_MAX];
>  	/** @max_rps: maximum fan RPS */
>  	u32 max_rps;
> @@ -266,6 +277,16 @@ struct xe_hwmon {
>  	u32 pl2_on_boot[CHANNEL_MAX];
>  	/** @temp: Temperature info */
>  	struct xe_hwmon_thermal_info temp;
> +	/** @curve_sda: fan curve sensor attributes */
> +	struct sensor_device_attribute curve_sda[XE_CURVE_ATTRS];
> +	/** @curve_names: names of the fan curve sensor attributes */
> +	char curve_names[XE_CURVE_ATTRS][XE_CURVE_ATTR_NAME_LEN];
> +	/** @curve_attrs: NULL-terminated list of fan curve attributes */
> +	struct attribute *curve_attrs[XE_CURVE_ATTRS + 1];
> +	/** @curve_group: fan curve attribute group */
> +	struct attribute_group curve_group;
> +	/** @groups: NULL-terminated list of extra attribute groups */
> +	const struct attribute_group *groups[3];
>  };
>  
>  static inline int prepare_power_limit_param2(const struct xe_hwmon *hwmon, int channel)
> @@ -910,11 +931,6 @@ static const struct attribute_group hwmon_attrgroup = {
>  	.is_visible = xe_hwmon_attributes_visible,
>  };
>  
> -static const struct attribute_group *hwmon_groups[] = {
> -	&hwmon_attrgroup,
> -	NULL
> -};
> -
>  static const u32 hwmon_temp_config[CHANNEL_MAX + 1] = {
>  	[CHANNEL_CARD] = HWMON_T_LABEL,
>  	[CHANNEL_PKG] = HWMON_T_CRIT | HWMON_T_EMERGENCY | HWMON_T_INPUT |
> @@ -1240,55 +1256,65 @@ static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
>  	return ret;
>  }
>  
> -static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
> -					    bool is_full_speed, enum fan_table_type table_source)
> +static int xe_hwmon_commit_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
> +					  const struct fan_control_point *points, u32 point_count)
>  {
> +	/* The extra write is for the final write that sets the number of fan control points */
>  	struct xe_pcode_write writes[MAX_FAN_CONTROL_POINTS + 1];
> -	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> -	struct fan_table *source_table;
> -	u32 expected_count, point_count;
> -	int ret, write_ret, verify_ret;
> +	u32 accepted_count = 0;
>  	u32 point;
> +	int ret, write_ret, verify_ret;
>  
> -	source_table = &fi->fan_table[table_source];
> -
> -	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
> -	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
> -
> -	point_count = source_table->point_count;
> -	if (!point_count || point_count > MAX_FAN_CONTROL_POINTS) {
> -		xe_err(hwmon->xe,
> -		       "fan %d %s table point count %d is invalid, cannot activate user table\n",
> -		       fan, (table_source == USER_FAN_TABLE) ? "user" : "stock", point_count);
> +	if (point_count < MIN_FAN_CONTROL_POINTS) {
> +		xe_err(hwmon->xe, "fan %d table needs at least %d points, got %u\n", fan,
> +		       MIN_FAN_CONTROL_POINTS, point_count);
>  		return -EINVAL;
>  	}
> -	expected_count = point_count;
>  
>  	for (point = 0; point < point_count; point++) {
> -		u8 temp = source_table->fcp[point].temp;
> -		u8 speed = is_full_speed ? 100 : min_t(u8, source_table->fcp[point].speed, 100);
> +		u8 temp = points[point].temp;
> +		u8 speed = points[point].speed;
> +
> +		/* Firmware requires increasing temperature and non-decreasing speed. */
> +		if (point > 0) {
> +			u8 prev_temp = points[point - 1].temp;
> +			u8 prev_speed = points[point - 1].speed;
> +
> +			if (temp <= prev_temp || speed < prev_speed) {
> +				xe_dbg(hwmon->xe,
> +				       "fan %d point %u not monotonic: %u/%u%% after %u/%u%%\n",
> +				       fan, point, temp, speed, prev_temp, prev_speed);
> +				return -EINVAL;
> +			}
> +		}
>  
> -		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
> +		/* Prepare the write for this fan control point */
> +		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE,
> +						fan);
>  		writes[point].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, temp) |
> -					FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
> +				FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
>  	}
>  
> +	xe_dbg(hwmon->xe, "committing fan %d user table with %u points\n", fan, point_count);
> +
> +	/* pcode fills the user table from point 0 in write order; the count write commits it. */
>  	writes[point_count].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS,
>  					      fan);
>  	writes[point_count].data = point_count;
> +
>  	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
>  					 point_count + 1);
>  	if (write_ret)
>  		xe_dbg(hwmon->xe, "failed to write fan %d user table, ret=%d\n", fan, write_ret);
>  
> -	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
> -	if (write_ret || verify_ret || point_count != expected_count) {
> +	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &accepted_count, USER_FAN_TABLE);
> +	if (write_ret || verify_ret || accepted_count != point_count) {
>  		int failure_ret = write_ret ?: verify_ret ?: -EIO;
>  
> -		if (verify_ret || point_count != expected_count)
> +		if (verify_ret || accepted_count != point_count)
>  			xe_err(hwmon->xe,
> -			       "fan %d user table count mismatch: ret=%d, expected=%u, got=%u\n",
> -			       fan, verify_ret, expected_count, point_count);
> +			       "fan %d table count verification failed: ret=%d, expected=%u, got=%u\n",
> +			       fan, verify_ret, point_count, accepted_count);
>  		/* Firmware may have accepted only part of the table; fall back to stock. */
>  		ret = xe_hwmon_fan_set_auto(hwmon, fan);
>  		if (ret)
> @@ -1297,15 +1323,45 @@ static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
>  		return failure_ret;
>  	}
>  
> +	xe_dbg(hwmon->xe, "fan %d user table committed successfully with %u points\n", fan,
> +	       point_count);
> +	return 0;
> +}
> +
> +static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
> +					    bool is_full_speed, enum fan_table_type table_source)
> +{
> +	struct fan_control_point points[MAX_FAN_CONTROL_POINTS];
> +	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +	struct fan_table *source_table, *user_table;
> +	u32 point_count, point;
> +	int ret;
> +
> +	source_table = &fi->fan_table[table_source];
> +	user_table = &fi->fan_table[USER_FAN_TABLE];
> +	point_count = source_table->point_count;
> +
> +	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
> +	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
> +
> +	for (point = 0; point < point_count; point++) {
> +		points[point].temp = source_table->fcp[point].temp;
> +		points[point].speed = is_full_speed ? 100 :
> +				      min_t(u8, source_table->fcp[point].speed, 100);
> +	}
> +
> +	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, points, point_count);
> +	if (ret)
> +		return ret;
> +
>  	/* Full speed only overrides firmware; the cache keeps the manual curve. */
>  	if (table_source == STOCK_FAN_TABLE) {
>  		for (point = 0; point < point_count; point++) {
> -			fi->fan_table[USER_FAN_TABLE].fcp[point].temp =
> -				source_table->fcp[point].temp;
> -			fi->fan_table[USER_FAN_TABLE].fcp[point].speed =
> -				min_t(u8, source_table->fcp[point].speed, 100);
> +			user_table->fcp[point].temp = source_table->fcp[point].temp;
> +			user_table->fcp[point].speed = min_t(u8, source_table->fcp[point].speed,
> +							     100);
>  		}
> -		fi->fan_table[USER_FAN_TABLE].point_count = point_count;
> +		user_table->point_count = point_count;
>  	}
>  
>  	fi->pwm_enable_mode = is_full_speed ? XE_FAN_PWM_FULL_SPEED :
> @@ -1319,10 +1375,10 @@ static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
>  
>  static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
>  {
> -	struct xe_pcode_write writes[MIN_FAN_CONTROL_POINTS + 1];
>  	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> -	int ret, write_ret, verify_ret, i;
> -	u32 point_count = 0;
> +	struct fan_table *user_table = &fi->fan_table[USER_FAN_TABLE];
> +	struct fan_control_point points[MIN_FAN_CONTROL_POINTS];
> +	int ret, i;
>  	u8 speed;
>  
>  	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
> @@ -1331,58 +1387,341 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
>  	}
>  
>  	/* Fan table speed are in percent. */
> -	speed = DIV_ROUND_CLOSEST(pwm * 100, U8_MAX);
> -	speed = min_t(u32, speed, 100);
> +	speed = min_t(u32, DIV_ROUND_CLOSEST(pwm * 100, U8_MAX), 100);
>  
>  	/* Fan control needs at least two points; program them all at the same speed. */
>  	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
> -		writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
> -		writes[i].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, FIXED_PWM_TEMP + i) |
> -				 FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
> -		xe_dbg(hwmon->xe, "prepared fan control point %d with temp=%d, speed=%u%%\n", i,
> -		       FIXED_PWM_TEMP + i, speed);
> +		points[i].temp = FIXED_PWM_TEMP + i;
> +		points[i].speed = speed;
>  	}
>  
> -	/* pcode fills the user table from point 0 in write order; the count write commits it. */
> -	writes[i].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan);
> -	writes[i].data = MIN_FAN_CONTROL_POINTS;
> -	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
> -					 ARRAY_SIZE(writes));
> -	if (write_ret)
> -		xe_err(hwmon->xe, "failed to write pwm %u (%u%%) for fan %d, ret=%d\n",
> -		       pwm, speed, fan, write_ret);
> +	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, points, MIN_FAN_CONTROL_POINTS);
> +	if (ret) {
> +		xe_err(hwmon->xe, "failed to set pwm %u (%u%%) for fan %d, ret=%d\n",
> +		       pwm, speed, fan, ret);
> +		return ret;
> +	}
> +
> +	memcpy(user_table->fcp, points, sizeof(points));
> +	user_table->point_count = MIN_FAN_CONTROL_POINTS;
> +	user_table->temp_staged = 0;
> +	user_table->speed_staged = 0;
> +	xe_dbg(hwmon->xe, "applied pwm %u (%u%%) for fan %d\n", pwm, speed, fan);
> +
> +	return 0;
> +}
> +
> +#define XE_CURVE_IDX(fan, point)	(((fan) << 8) | (point))
> +#define XE_CURVE_FAN(idx)		((u8)(((idx) >> 8) & 0xff))
> +#define XE_CURVE_POINT(idx)		((u8)((idx) & 0xff))
> +
> +static int
> +xe_hwmon_decode_curve_index(struct xe_hwmon *hwmon, u32 index, u8 *fan, u8 *point)
> +{
> +	u8 local_fan = XE_CURVE_FAN(index);
> +	u8 local_point = XE_CURVE_POINT(index);
> +
> +	if (local_fan >= FAN_MAX || local_point >= MAX_FAN_CONTROL_POINTS) {
> +		xe_dbg(hwmon->xe, "invalid fan curve index 0x%x: fan %u point %u\n",
> +		       index, local_fan, local_point);
> +		return -EINVAL;
> +	}
> +
> +	*fan = local_fan;
> +	*point = local_point;
> +
> +	return 0;
> +}
> +
> +static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
> +{
> +	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
> +			USER_FAN_TABLE;
> +}
> +
> +static ssize_t
> +xe_hwmon_pwm_auto_point_temp_show(struct device *dev,
> +				  struct device_attribute *attr, char *buf)
> +{
> +	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
> +	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
> +	enum fan_table_type active_table;
> +	struct xe_hwmon_fan_info *fi;
> +	u32 point_count;
> +	u8 point;
> +	u8 temp;
> +	int ret;
> +	u8 fan;
> +
> +	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
> +	if (ret)
> +		return ret;
> +
> +	guard(mutex)(&hwmon->hwmon_lock);
> +
> +	fi = &hwmon->fi[fan];
> +	if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
> +		return -ENODATA;
> +
> +	active_table = xe_hwmon_get_active_fan_table(hwmon, fan);
> +
> +	point_count = fi->fan_table[active_table].point_count;
> +
> +	if (point >= point_count)
> +		temp = 0;
>  	else
> -		xe_dbg(hwmon->xe, "applied pwm %u (%u%%) for fan %d\n", pwm, speed, fan);
> +		temp = fi->fan_table[active_table].fcp[point].temp;
> +	return sysfs_emit(buf, "%u\n", temp * MILLIDEGREE_PER_DEGREE);
> +}
>  
> -	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
> -	if (write_ret || verify_ret || point_count != MIN_FAN_CONTROL_POINTS) {
> -		int failure_ret = write_ret ?: verify_ret ?: -EIO;
> +static int xe_hwmon_update_user_fan_point(struct xe_hwmon *hwmon, u8 fan, u32 point,
> +					  bool is_temp, u8 value)
> +{
> +	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +	struct fan_table *table;
> +	u32 point_count;
> +	int ret;
>  
> -		if (verify_ret || point_count != MIN_FAN_CONTROL_POINTS)
> -			xe_err(hwmon->xe,
> -			       "fan %d PWM table count verification failed: ret=%d, count=%u\n",
> -			       fan, verify_ret, point_count);
> -		/* Firmware may have accepted only part of the table; fall back to stock. */
> -		ret = xe_hwmon_fan_set_auto(hwmon, fan);
> -		if (ret)
> -			xe_err(hwmon->xe, "failed to restore fan %d to auto mode ret=%d\n",
> -			       fan, ret);
> -		return failure_ret;
> +	table = &fi->fan_table[USER_FAN_TABLE];
> +
> +	if (is_temp) {
> +		table->staged_fcp[point].temp = value;
> +		table->temp_staged |= BIT(point);
> +	} else {
> +		table->staged_fcp[point].speed = value;
> +		table->speed_staged |= BIT(point);
>  	}
>  
> -	/* Update the user fan table cache. */
> -	for (i = 0; i < MIN_FAN_CONTROL_POINTS; i++) {
> -		fi->fan_table[USER_FAN_TABLE].fcp[i].temp = FIXED_PWM_TEMP + i;
> -		fi->fan_table[USER_FAN_TABLE].fcp[i].speed = speed;
> -		xe_dbg(hwmon->xe, "fan %d user table cache point %d with temp=%d, speed=%u%%\n",
> -		       fan, i, fi->fan_table[USER_FAN_TABLE].fcp[i].temp,
> -		       fi->fan_table[USER_FAN_TABLE].fcp[i].speed);
> +	/* Wait for a complete prefix; (0, 0) ends the curve without becoming a point. */
> +	for (point_count = 0; point_count < MAX_FAN_CONTROL_POINTS; point_count++) {
> +		if (!(table->temp_staged & BIT(point_count)) ||
> +		    !(table->speed_staged & BIT(point_count)))
> +			return 0;
> +		if (!table->staged_fcp[point_count].temp &&
> +		    !table->staged_fcp[point_count].speed)
> +			break;
> +	}
> +
> +	if (point_count < MIN_FAN_CONTROL_POINTS) {
> +		xe_dbg(hwmon->xe, "fan %d curve needs at least %d points, got %u\n",
> +		       fan, MIN_FAN_CONTROL_POINTS, point_count);
> +		ret = -EINVAL;
> +		goto clear_staged;
>  	}
> -	fi->fan_table[USER_FAN_TABLE].point_count = MIN_FAN_CONTROL_POINTS;
> +
> +	ret = xe_hwmon_commit_user_fan_table(hwmon, fan, table->staged_fcp, point_count);
> +	if (ret)
> +		goto clear_staged;
> +
> +	/* Publish the new curve only after firmware accepts its point count. */
> +	memcpy(table->fcp, table->staged_fcp, point_count * sizeof(table->fcp[0]));
> +	table->point_count = point_count;
> +	fi->pwm_enable_mode = XE_FAN_PWM_MANUAL_USER_TABLE;
> +
> +clear_staged:
> +	table->temp_staged = 0;
> +	table->speed_staged = 0;
> +	return ret;
> +}
> +
> +static int xe_hwmon_sysfs_to_hw_val(struct xe_hwmon *hwmon, long val, bool is_temp, u8 *out)
> +{
> +	long max = is_temp ? U8_MAX * MILLIDEGREE_PER_DEGREE : U8_MAX;
> +	long hw_val;
> +
> +	if (val < 0 || val > max) {
> +		xe_dbg(hwmon->xe, "%s value %ld out of range\n", is_temp ? "temp" : "pwm", val);
> +		return -EINVAL;
> +	}
> +
> +	/* Temperature is in degrees Celsius, speed in percent. */
> +	if (is_temp)
> +		hw_val = DIV_ROUND_CLOSEST(val, MILLIDEGREE_PER_DEGREE);
> +	else
> +		hw_val = DIV_ROUND_CLOSEST(val * 100, U8_MAX);
> +
> +	if (!is_temp && val && !hw_val)
> +		hw_val = 1;
> +
> +	*out = hw_val;
>  
>  	return 0;
>  }
>  
> +static ssize_t
> +xe_hwmon_pwm_auto_point_temp_store(struct device *dev,
> +				   struct device_attribute *attr,
> +				   const char *buf, size_t count)
> +{
> +	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
> +	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
> +	struct xe_hwmon_fan_info *fi;
> +	long val;
> +	u8 point;
> +	u8 temp;
> +	int ret;
> +	u8 fan;
> +
> +	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
> +	if (ret)
> +		return ret;
> +
> +	ret = kstrtol(buf, 10, &val);
> +	if (ret)
> +		return ret;
> +
> +	ret = xe_hwmon_sysfs_to_hw_val(hwmon, val, true, &temp);
> +	if (ret)
> +		return ret;
> +
> +	guard(xe_pm_runtime)(hwmon->xe);
> +
> +	guard(mutex)(&hwmon->hwmon_lock);
> +	fi = &hwmon->fi[fan];
> +
> +	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
> +		xe_dbg(hwmon->xe, "pwm%d_enable not in manual mode; cannot update temp point %d\n",
> +		       fan + 1, point + 1);
> +		return -EINVAL;
> +	}
> +
> +	xe_dbg(hwmon->xe, "staging fan %d point %d temp to %u\n", fan, point, temp);
> +	ret = xe_hwmon_update_user_fan_point(hwmon, fan, point, true, temp);
> +
> +	return ret ? ret : count;
> +}
> +
> +static ssize_t
> +xe_hwmon_pwm_auto_point_pwm_show(struct device *dev,
> +				 struct device_attribute *attr,
> +				 char *buf)
> +{
> +	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
> +	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
> +	enum fan_table_type active_table;
> +	struct xe_hwmon_fan_info *fi;
> +	u32 point_count;
> +	u8 point;
> +	u8 speed;
> +	int ret;
> +	u8 fan;
> +
> +	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
> +	if (ret)
> +		return ret;
> +
> +	guard(mutex)(&hwmon->hwmon_lock);
> +
> +	fi = &hwmon->fi[fan];
> +	if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
> +		return -ENODATA;
> +
> +	active_table = xe_hwmon_get_active_fan_table(hwmon, fan);
> +
> +	point_count = fi->fan_table[active_table].point_count;
> +
> +	if (point >= point_count)
> +		speed = 0;
> +	else
> +		speed = fi->fan_table[active_table].fcp[point].speed;
> +	return sysfs_emit(buf, "%u\n", DIV_ROUND_CLOSEST(speed * U8_MAX, 100));
> +}
> +
> +static ssize_t
> +xe_hwmon_pwm_auto_point_pwm_store(struct device *dev,
> +				  struct device_attribute *attr,
> +				  const char *buf, size_t count)
> +{
> +	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
> +	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
> +	struct xe_hwmon_fan_info *fi;
> +	long val;
> +	u8 point;
> +	u8 speed;
> +	int ret;
> +	u8 fan;
> +
> +	ret = xe_hwmon_decode_curve_index(hwmon, sattr->index, &fan, &point);
> +	if (ret)
> +		return ret;
> +
> +	ret = kstrtol(buf, 10, &val);
> +	if (ret)
> +		return ret;
> +
> +	ret = xe_hwmon_sysfs_to_hw_val(hwmon, val, false, &speed);
> +	if (ret)
> +		return ret;
> +
> +	guard(xe_pm_runtime)(hwmon->xe);
> +
> +	guard(mutex)(&hwmon->hwmon_lock);
> +	fi = &hwmon->fi[fan];
> +
> +	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
> +		xe_dbg(hwmon->xe,
> +		       "pwm%d_enable is not in manual user mode, cannot update pwm point %d\n",
> +		       fan + 1, point + 1);
> +		return -EINVAL;
> +	}
> +
> +	xe_dbg(hwmon->xe, "staging fan %d point %d speed to %u%%\n", fan, point, speed);
> +	ret = xe_hwmon_update_user_fan_point(hwmon, fan, point, false, speed);
> +
> +	return ret ? ret : count;
> +}
> +
> +static umode_t xe_hwmon_curve_attributes_visible(struct kobject *kobj,
> +						 struct attribute *attr, int index)
> +{
> +	struct device *dev = kobj_to_dev(kobj);
> +	struct xe_hwmon *hwmon = dev_get_drvdata(dev);
> +	u32 fan = index / XE_CURVE_ATTRS_PER_FAN;
> +
> +	/* Manual mode, and thus curve writes, need a stock table, as for pwmN_enable. */
> +	if (!hwmon->xe->info.has_fan_control || !IS_FAN_ENABLED(hwmon, fan) ||
> +	    !hwmon->fi[fan].fan_table[STOCK_FAN_TABLE].point_count)
> +		return 0;
> +
> +	/* All slots must exist at registration, before the user curve has been staged. */
> +	return attr->mode;
> +}
> +
> +static void xe_hwmon_init_curve_attrs(struct xe_hwmon *hwmon)
> +{
> +	int fan, kind, point, i = 0;
> +
> +	/* Per fan: all temp points then all pwm points; is_visible relies on this layout. */
> +	for (fan = 0; fan < FAN_MAX; fan++) {
> +		for (kind = 0; kind < 2; kind++) {
> +			bool is_temp = !kind;
> +
> +			for (point = 0; point < MAX_FAN_CONTROL_POINTS; point++, i++) {
> +				struct sensor_device_attribute *sda = &hwmon->curve_sda[i];
> +
> +				snprintf(hwmon->curve_names[i], XE_CURVE_ATTR_NAME_LEN,
> +					 "pwm%d_auto_point%d_%s", fan + 1, point + 1,
> +					 is_temp ? "temp" : "pwm");
> +				sysfs_attr_init(&sda->dev_attr.attr);
> +				sda->dev_attr.attr.name = hwmon->curve_names[i];
> +				sda->dev_attr.attr.mode = 0644;
> +				if (is_temp) {
> +					sda->dev_attr.show = xe_hwmon_pwm_auto_point_temp_show;
> +					sda->dev_attr.store = xe_hwmon_pwm_auto_point_temp_store;
> +				} else {
> +					sda->dev_attr.show = xe_hwmon_pwm_auto_point_pwm_show;
> +					sda->dev_attr.store = xe_hwmon_pwm_auto_point_pwm_store;
> +				}
> +				sda->index = XE_CURVE_IDX(fan, point);
> +				hwmon->curve_attrs[i] = &sda->dev_attr.attr;
> +			}
> +		}
> +	}
> +
> +	hwmon->curve_group.attrs = hwmon->curve_attrs;
> +	hwmon->curve_group.is_visible = xe_hwmon_curve_attributes_visible;
> +}
> +
>  static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
>  {
>  	int point;
> @@ -2075,12 +2414,6 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
>  	}
>  }
>  
> -static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
> -{
> -	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
> -			USER_FAN_TABLE;
> -}
> -
>  /**
>   * xe_hwmon_get_active_table_pwm - Calculate PWM from the active fan curve
>   * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
> @@ -2278,9 +2611,13 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
>  				USER_FAN_TABLE : STOCK_FAN_TABLE;
>  
>  			ret = xe_hwmon_activate_user_fan_table(hwmon, channel, full_speed, source);
> -			if (ret)
> +			if (ret) {
>  				xe_warn(hwmon->xe, "failed to set fan %d pwm_enable %ld, ret=%d\n",
>  					channel, val, ret);
> +				break;
> +			}
> +			fi->fan_table[USER_FAN_TABLE].temp_staged = 0;
> +			fi->fan_table[USER_FAN_TABLE].speed_staged = 0;
>  		} else if (val == XE_FAN_PWM_AUTO_STOCK_TABLE) {
>  			ret = xe_hwmon_fan_set_auto(hwmon, channel);
>  			if (ret) {
> @@ -2292,6 +2629,8 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
>  			xe_dbg(hwmon->xe,
>  			       "automatic control enabled for fan %d using stock table\n",
>  			       channel);
> +			fi->fan_table[USER_FAN_TABLE].temp_staged = 0;
> +			fi->fan_table[USER_FAN_TABLE].speed_staged = 0;
>  		} else {
>  			xe_dbg(hwmon->xe, "invalid pwm%d_enable value %ld\n", channel + 1, val);
>  			ret = -EINVAL;
> @@ -2543,10 +2882,16 @@ int xe_hwmon_register(struct xe_device *xe)
>  
>  	drm_dbg(&xe->drm, "Register xe hwmon interface\n");
>  
> +	hwmon->groups[0] = &hwmon_attrgroup;
> +	if (xe->info.has_fan_control) {
> +		xe_hwmon_init_curve_attrs(hwmon);
> +		hwmon->groups[1] = &hwmon->curve_group;
> +	}
> +
>  	/*  hwmon_dev points to device hwmon<i> */
>  	hwmon->hwmon_dev = hwmon_device_register_with_info(dev, "xe", hwmon,
>  							   &hwmon_chip_info,
> -							   hwmon_groups);
> +							   hwmon->groups);
>  	if (IS_ERR(hwmon->hwmon_dev)) {
>  		ret = PTR_ERR(hwmon->hwmon_dev);
>  		xe_log_err(xe, HWMON, ret, "Failed to register xe hwmon\n");
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume
  2026-11-30 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
@ 2026-11-30 21:03   ` Rodrigo Vivi
  0 siblings, 0 replies; 17+ messages in thread
From: Rodrigo Vivi @ 2026-11-30 21:03 UTC (permalink / raw)
  To: Karthik Poosa
  Cc: intel-xe, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro,
	sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri

On Tue, Dec 01, 2026 at 12:20:47AM +0530, Karthik Poosa wrote:
> Preserve active manual and full-speed fan tables across system suspend,
> runtime D3cold, and FLR.
> 
> On resume, restore the cached table without waiting for the late-bound
> fan-control firmware, which reloads asynchronously. Waiting for it from
> the resume path can deadlock against the resume of the MEI device that
> loads it. If restoration fails, fall back to stock fan control.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
> 
> v2: Use xe_pcode_read() instead of xe_pcode_read_timeout().
> 
> v3:
>  - Use u32 for the point index. (Soham)
>  - Say "user table point" in suspend warnings. (Soham)
>  - Sort the xe_hwmon.h include. (Soham)
>  - Call the system PM hooks from xe_device_suspend() and
>    xe_device_resume() after the upstream refactor, so FLR also
>    restores the table.
>  - Check d3cold.allowed only for runtime PM; system suspend always
>    loses the table.
>  - Pass hwmon to IS_FAN_ENABLED().
> 
> v4:
>  - Avoid fan-table reads during suspend.
>  - Fall back to the stock fan table on user-table restore failure.
> 
> v5:
>  - Do not flush the late-binding work from xe_late_bind_pm_resume();
>    it can deadlock against the MEI device resume. (sashiko)
>  - Drop the duplicate stock fallback in xe_hwmon_resume(). (sashiko)
> 
>  drivers/gpu/drm/xe/xe_device.c |   3 +
>  drivers/gpu/drm/xe/xe_hwmon.c  | 101 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_hwmon.h  |   4 ++
>  drivers/gpu/drm/xe/xe_pm.c     |  11 +++-
>  4 files changed, 116 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index fccb0eff54ee..066949bee1ac 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -1428,6 +1428,8 @@ int xe_device_suspend(struct xe_device *xe, bool hibernate, bool flr)
>  
>  	xe_late_bind_pm_suspend(&xe->late_bind);
>  
> +	xe_hwmon_suspend(xe, false);
> +
>  	for_each_gt(gt, xe, id)
>  		xe_gt_suspend_prepare(gt);
>  
> @@ -1558,6 +1560,7 @@ int xe_device_resume(struct xe_device *xe, bool flr)
>  	xe_pxp_pm_resume(xe->pxp);
>  
>  	xe_late_bind_pm_resume(&xe->late_bind);
> +	xe_hwmon_resume(xe, false);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 857c9d293f09..ea342f12a756 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -217,6 +217,8 @@ struct xe_hwmon_fan_info {
>  	u32 max_rps;
>  	/** @pwm_enable_mode: current xe_fan_pwm_enable_mode */
>  	u8 pwm_enable_mode;
> +	/** @restore_user_table: restore user fan table on next resume */
> +	bool restore_user_table;
>  };
>  
>  /**
> @@ -2920,4 +2922,103 @@ void xe_hwmon_unregister(struct xe_device *xe)
>  	hwmon_device_unregister(xe->hwmon->hwmon_dev);
>  	xe->hwmon = NULL;
>  }
> +
> +/**
> + * xe_hwmon_suspend - Save hwmon state before suspend
> + * @xe: xe device instance
> + * @runtime: true for runtime suspend, false for system suspend or FLR prepare
> + *
> + * Save any hwmon runtime state that must survive PM suspend transitions.
> + */
> +void xe_hwmon_suspend(struct xe_device *xe, bool runtime)
> +{
> +	struct xe_hwmon *hwmon = READ_ONCE(xe->hwmon);
> +	int fan;
> +
> +	if (!hwmon || !xe->info.has_fan_control)
> +		return;
> +
> +	/* Runtime suspend keeps the fan tables unless the device enters d3cold. */
> +	if (runtime && !xe->d3cold.allowed) {
> +		xe_dbg(xe, "d3cold not allowed, skipping fan user-table snapshot\n");
> +		return;
> +	}
> +
> +	mutex_lock(&hwmon->hwmon_lock);
> +
> +	for (fan = 0; fan < FAN_MAX; fan++) {
> +		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +		u32 point_count = fi->fan_table[USER_FAN_TABLE].point_count;
> +
> +		if (!IS_FAN_ENABLED(hwmon, fan))
> +			continue;
> +
> +		fi->restore_user_table = false;
> +		if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE &&
> +		    fi->pwm_enable_mode != XE_FAN_PWM_FULL_SPEED)
> +			continue;
> +
> +		if (point_count < MIN_FAN_CONTROL_POINTS ||
> +		    point_count > MAX_FAN_CONTROL_POINTS)
> +			continue;
> +		fi->restore_user_table = true;
> +		xe_dbg(hwmon->xe,
> +		       "fan %d cached user table marked for restore, point_count=%u\n", fan,
> +		       point_count);
> +	}
> +
> +	mutex_unlock(&hwmon->hwmon_lock);
> +}
> +
> +/**
> + * xe_hwmon_resume - Restore hwmon state after resume
> + * @xe: xe device instance
> + * @runtime: true for runtime resume, false for system resume or FLR done
> + *
> + * Restore any hwmon runtime state that was saved across suspend.
> + */
> +void xe_hwmon_resume(struct xe_device *xe, bool runtime)
> +{
> +	struct xe_hwmon *hwmon = READ_ONCE(xe->hwmon);
> +	int fan;
> +
> +	if (!hwmon || !xe->info.has_fan_control)
> +		return;
> +
> +	if (runtime && !xe->d3cold.allowed) {
> +		xe_dbg(xe, "d3cold not allowed, skipping fan user-table restore\n");
> +		return;
> +	}
> +
> +	mutex_lock(&hwmon->hwmon_lock);
> +
> +	for (fan = 0; fan < FAN_MAX; fan++) {
> +		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +		int ret;
> +
> +		if (!IS_FAN_ENABLED(hwmon, fan))
> +			continue;
> +
> +		if (!fi->restore_user_table) {
> +			xe_dbg(xe, "fan %d user table restore not required\n", fan);
> +			continue;
> +		}
> +
> +		/* Re-program cached user-table settings for fans active before suspend. */
> +		ret = xe_hwmon_activate_user_fan_table(hwmon, fan,
> +						       fi->pwm_enable_mode == XE_FAN_PWM_FULL_SPEED,
> +						       USER_FAN_TABLE);
> +		fi->restore_user_table = false;
> +		if (ret) {
> +			xe_warn(xe, "failed to restore fan %d user table after resume, ret=%d\n",
> +				fan, ret);
> +			continue;
> +		}
> +
> +		xe_dbg(xe, "fan %d user table restored\n", fan);
> +	}
> +
> +	mutex_unlock(&hwmon->hwmon_lock);


We should prefer guard() or scoped_guard() rather than explicit
lock/unlock, here and in xe_hwmon_suspend().

I'm not blocking on it, but since there will likely be a v7 anyway, please
change it there.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +}
> +
>  MODULE_IMPORT_NS("INTEL_PMT_TELEMETRY");
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.h b/drivers/gpu/drm/xe/xe_hwmon.h
> index e67e0134f02a..50874b6b6527 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.h
> +++ b/drivers/gpu/drm/xe/xe_hwmon.h
> @@ -13,9 +13,13 @@ struct xe_device;
>  #if IS_REACHABLE(CONFIG_HWMON)
>  int xe_hwmon_register(struct xe_device *xe);
>  void xe_hwmon_unregister(struct xe_device *xe);
> +void xe_hwmon_suspend(struct xe_device *xe, bool runtime);
> +void xe_hwmon_resume(struct xe_device *xe, bool runtime);
>  #else
>  static inline int xe_hwmon_register(struct xe_device *xe) { return 0; };
>  static inline void xe_hwmon_unregister(struct xe_device *xe) { }
> +static inline void xe_hwmon_suspend(struct xe_device *xe, bool runtime) {}
> +static inline void xe_hwmon_resume(struct xe_device *xe, bool runtime) {}
>  #endif
>  
>  #endif /* _XE_HWMON_H_ */
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index f73f68bd449b..4d4b398cbeda 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -20,6 +20,7 @@
>  #include "xe_ggtt.h"
>  #include "xe_gt.h"
>  #include "xe_gt_idle.h"
> +#include "xe_hwmon.h"
>  #include "xe_i2c.h"
>  #include "xe_irq.h"
>  #include "xe_late_bind_fw.h"
> @@ -567,6 +568,8 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
>  	if (err)
>  		goto out;
>  
> +	xe_hwmon_suspend(xe, true);
> +
>  	/*
>  	 * Applying lock for entire list op as xe_ttm_bo_destroy and xe_bo_move_notify
>  	 * also checks and deletes bo entry from user fault list.
> @@ -683,12 +686,14 @@ int xe_pm_runtime_resume(struct xe_device *xe)
>  
>  	xe_pxp_pm_resume(xe->pxp);
>  
> -	if (IS_VF_CCS_READY(xe))
> -		xe_sriov_vf_ccs_register_context(xe);
> -
>  	if (xe->d3cold.allowed)
>  		xe_late_bind_pm_resume(&xe->late_bind);
>  
> +	xe_hwmon_resume(xe, true);
> +
> +	if (IS_VF_CCS_READY(xe))
> +		xe_sriov_vf_ccs_register_context(xe);
> +
>  out:
>  	xe_rpm_lockmap_release(xe);
>  	xe_pm_write_callback_task(xe, NULL);
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control
  2026-11-30 18:50 ` [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
@ 2026-11-30 21:04   ` Rodrigo Vivi
  0 siblings, 0 replies; 17+ messages in thread
From: Rodrigo Vivi @ 2026-11-30 21:04 UTC (permalink / raw)
  To: Karthik Poosa
  Cc: intel-xe, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro,
	sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri

On Tue, Dec 01, 2026 at 12:20:50AM +0530, Karthik Poosa wrote:
> Add kernel-doc for xe hwmon fan control and describe the fan control
> model built around firmware stock tables and driver-managed user tables.
> 
> Document the exposed sysfs files for fan speed, maximum speed, pwm
> control, pwm mode selection, and per-point fan curve temperature/PWM
> programming.
> 
> This makes the hwmon fan control userspace interface easier to discover
> and understand.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
> 
> v2:
>  - Clarify the registration-time visibility requirements.
>  - Document how late binding affects existing fan attributes.
> 
> v3:
>  - Document that curve files need a stock table and that tables
>    programmed by pwmN_enable modes 0 and 1 follow the curve rules.
>  - Document that a failed stock table refresh after late binding keeps
>    the previous table.
>  - Document -ENODATA reads when the fan control mode is not
>    established.
>  - Document that a failed completing curve write drops all staged
>    points. (Soham)
> 
>  drivers/gpu/drm/xe/xe_hwmon.c | 70 +++++++++++++++++++++++++++++++++++
>  1 file changed, 70 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 4ee51cfc9283..70a4e4941390 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -140,6 +140,76 @@ struct xe_hwmon_energy_info {
>  	long accum_energy;
>  };
>  
> +/**
> + * DOC: Xe fan control
> + *
> + * Xe fan control is exposed through the hwmon pwm and fan interfaces when the
> + * platform advertises PCODE-backed fan management support.
> + *
> + * Attribute visibility is determined during hwmon registration. ``fanN_max``
> + * requires maximum fan speed data, while ``pwmN``, ``pwmN_enable`` and the
> + * ``pwmN_auto_pointM_*`` curve files require a readable stock fan table. Late
> + * binding refreshes cached data for existing fans but does not create
> + * attributes that were hidden at registration. The stock table can change with
> + * the late bound firmware; if a complete table cannot be read, the previous one
> + * is kept.
> + *
> + * The implementation tracks two fan tables per fan:
> + *
> + * - A stock table read from firmware through PCODE.
> + * - A user table cached in the driver and programmed back through PCODE.
> + *
> + * The pwmN_enable sysfs value selects how those tables are used:
> + *
> + * - 0 (``XE_FAN_PWM_FULL_SPEED``) programs the user table at 100 percent duty
> + *   cycle as a full-speed override. The cached user curve is kept.
> + * - 1 (``XE_FAN_PWM_MANUAL_USER_TABLE``) enables the user table for manual
> + *   control. Without a cached user curve, it starts from the stock table.
> + * - 2 (``XE_FAN_PWM_AUTO_STOCK_TABLE``) restores automatic control using the
> + *   stock firmware table. The cached user curve is kept for a later switch to
> + *   mode 1.
> + *
> + * Any table programmed by modes 0 and 1 must meet the curve rules below;
> + * otherwise the mode switch fails with -EINVAL.
> + *
> + * The fan-control sysfs files are:
> + *
> + * - ``fanN_input`` reports the measured fan speed in RPM.
> + * - ``fanN_max`` reports the maximum supported fan speed in RPM.
> + * - ``pwmN`` reads or sets the manual PWM duty cycle in the hwmon 0..255
> + *   range.
> + * - ``pwmN_enable`` selects the mode described above.
> + * - ``pwmN_auto_pointM_temp`` reports the temperature of point ``M`` of the
> + *   stock table in mode 2 or of the user table otherwise, in millidegrees
> + *   Celsius. Writes stage the user-table point.
> + * - ``pwmN_auto_pointM_pwm`` reports the PWM value of point ``M`` of the same
> + *   table in the hwmon 0..255 range. Writes stage the user-table point.
> + *
> + * Writes to ``pwmN``, ``pwmN_auto_pointM_temp`` and ``pwmN_auto_pointM_pwm``
> + * are accepted only while ``pwmN_enable`` is 1; otherwise they fail with
> + * -EINVAL. Firmware stores duty cycle in percent, so PWM values read back
> + * rounded to the nearest percent step. Nonzero curve PWM writes are kept at
> + * least 1 percent so rounding cannot turn them into an end marker.
> + *
> + * Writes to ``pwmN_auto_pointM_temp`` and ``pwmN_auto_pointM_pwm`` are staged
> + * in the driver, so intermediate writes never reach firmware as a partial
> + * curve. The staged curve is committed once points 1..K all have both a
> + * temperature and a PWM value and either point K+1 is set to (0, 0) or K is
> + * the last supported point. The (0, 0) end marker is not part of the curve.
> + * A curve must have at least two points, temperature must increase and PWM
> + * must not decrease from one point to the next; otherwise the completing write
> + * fails with -EINVAL. A completing write that fails drops all staged points.
> + *
> + * Writes to ``pwmN`` replace the user table with a two-point table at a
> + * constant duty cycle.
> + *
> + * If a user-table write is not accepted by firmware, the fan falls back to
> + * mode 2 and the previously cached user curve is kept. If that fallback also
> + * fails, the fan control mode is not established and reads of ``pwmN``,
> + * ``pwmN_enable`` and ``pwmN_auto_pointM_*`` fail with -ENODATA until a mode
> + * is written again.
> + */
> +
>  /**
>   * enum xe_fan_pwm_enable_mode - fan PWM enable modes
>   */
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-11-30 21:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-30 19:04   ` sashiko-bot
2026-11-30 18:50 ` [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-30 20:59   ` Rodrigo Vivi
2026-11-30 18:50 ` [PATCH v6 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-30 21:00   ` Rodrigo Vivi
2026-11-30 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
2026-11-30 21:03   ` Rodrigo Vivi
2026-11-30 18:50 ` [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-30 21:04   ` Rodrigo Vivi
2026-11-30 20:52 ` ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox