Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Purkait, Soham" <soham.purkait@intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <rodrigo.vivi@intel.com>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <raag.jadav@intel.com>,
	<riana.tauro@intel.com>, <sk.anirban@intel.com>,
	<mallesh.koujalagi@intel.com>,
	<ravi.kishore.koppuravuri@intel.com>
Subject: Re: [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max
Date: Tue, 1 Dec 2026 13:40:06 +0530	[thread overview]
Message-ID: <9fd89f15-a3ce-4863-8df2-95ef68ab8d84@intel.com> (raw)
In-Reply-To: <20261130185050.36979-3-karthik.poosa@intel.com>


On 01-12-2026 00:20, Karthik Poosa wrote:
> 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

LGTM

Reviewed-by: Soham Purkait <soham.purkait@intel.com>


  reply	other threads:[~2026-12-01  8:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-12-01  5:10     ` Poosa, Karthik
2026-12-01  8:09   ` Purkait, Soham
2026-11-30 18:50 ` [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-12-01  8:10   ` Purkait, Soham [this message]
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-12-01 12:06     ` Purkait, Soham
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-12-01  4:55   ` Nilawar, Badal
2026-12-01  5:13     ` Poosa, Karthik
2026-11-30 18:50 ` [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-12-01  5:32   ` Nilawar, Badal
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-12-01  8:13   ` Purkait, Soham
2026-11-30 20:52 ` ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3) Patchwork
2026-11-30 21:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-01  9:17 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fd89f15-a3ce-4863-8df2-95ef68ab8d84@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sk.anirban@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox