Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karthik Poosa" <karthik.poosa@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache
Date: Mon, 30 Nov 2026 19:04:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-241897@kernel.org> (raw)
In-Reply-To: <20261130185050.36979-2-karthik.poosa@intel.com>

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

  reply	other threads:[~2026-11-30 19:04 UTC|newest]

Thread overview: 12+ 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 [this message]
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 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 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
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

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=sashiko-outbox-241897@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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