All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <raag.jadav@intel.com>,
	<riana.tauro@intel.com>, <sk.anirban@intel.com>,
	<mallesh.koujalagi@intel.com>, <soham.purkait@intel.com>,
	<ravi.kishore.koppuravuri@intel.com>
Subject: Re: [PATCH v4 02/10] drm/xe/hwmon: Expose fanN_max
Date: Wed, 25 Nov 2026 13:26:01 -0500	[thread overview]
Message-ID: <awcoObOEU30OsURt@intel.com> (raw)
In-Reply-To: <20261124054811.798763-3-karthik.poosa@intel.com>

On Tue, Nov 24, 2026 at 11:18:03AM +0530, 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.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>

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

> ---
> 
> v2: Use xe helper for dmesg logs.
> 
> v3:
>  - Fix indentation of the max_rps struct member. (Soham)
>  - Enable fanN_max only when fanN is supported.
> 
> v4:
>  - Read max RPS independent of stock table availability.
>  - Clear max RPS on pcode read failure.
> 
>  .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  8 +++++++
>  drivers/gpu/drm/xe/xe_hwmon.c                 | 21 +++++++++++++++++--
>  drivers/gpu/drm/xe/xe_pcode_api.h             |  1 +
>  3 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> index 0da739d9a816..1d42ea0639f7 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:		November 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 2ee4f89e7bf7..d06f9dc8a463 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;
>  	/** @min_pwm: minimum fan PWM */
>  	u32 min_pwm;
>  };
> @@ -913,7 +915,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
>  };
>  
> @@ -1163,7 +1166,7 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
>  	int ret;
>  	int err = 0;
>  
> -	/* Stock table failures leave fan_input visible; tach readout doesn't need it. */
> +	/* Stock table failures leave fan_input and fan_max visible; they don't need it. */
>  	for (fan = 0; fan < FAN_MAX; fan++) {
>  		struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
>  		u32 stock_fcp_count = 0;
> @@ -1171,6 +1174,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);
> @@ -1765,6 +1777,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;
>  	}
> @@ -1815,6 +1829,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 0349b24a8259..b8132db0e399 100644
> --- a/drivers/gpu/drm/xe/xe_pcode_api.h
> +++ b/drivers/gpu/drm/xe/xe_pcode_api.h
> @@ -82,6 +82,7 @@
>  #define     PCODE_MBOX_DOMAIN_HBM		0x2
>  
>  #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
> 

  reply	other threads:[~2026-11-25 19:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  5:48 [PATCH v4 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-24  5:48 ` [PATCH v4 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-27 21:31   ` Purkait, Soham
2026-11-24  5:48 ` [PATCH v4 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-11-25 18:26   ` Rodrigo Vivi [this message]
2026-11-24  5:48 ` [PATCH v4 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-25 18:29   ` Rodrigo Vivi
2026-11-26 13:48     ` Poosa, Karthik
2026-11-24  5:48 ` [PATCH v4 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-11-24  5:48 ` [PATCH v4 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-11-24  6:01   ` sashiko-bot
2026-11-25 13:26     ` Poosa, Karthik
2026-11-24  5:48 ` [PATCH v4 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-24  6:02   ` sashiko-bot
2026-11-26 17:05     ` Poosa, Karthik
2026-11-24  5:48 ` [PATCH v4 07/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-24  5:53   ` sashiko-bot
2026-11-26 12:33     ` Poosa, Karthik
2026-11-24  5:48 ` [PATCH v4 08/10] drm/xe/hwmon: Preserve fan user table across suspend resume Karthik Poosa
2026-11-24  6:07   ` sashiko-bot
2026-11-26 13:35     ` Poosa, Karthik
2026-11-24  5:48 ` [PATCH v4 09/10] drm/xe/hwmon: Update fan info after late binding Karthik Poosa
2026-11-24  6:11   ` sashiko-bot
2026-11-24  5:48 ` [PATCH v4 10/10] drm/xe/hwmon: Enable fan support for CRI Karthik Poosa
2026-11-25 18:30   ` Rodrigo Vivi
2026-11-24  5:56 ` ✗ CI.KUnit: failure for drm/xe/hwmon: Add fan control support 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=awcoObOEU30OsURt@intel.com \
    --to=rodrigo.vivi@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=sk.anirban@intel.com \
    --cc=soham.purkait@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.