Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karthik Poosa" <karthik.poosa@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/xe/hwmon: Use shared pcode default timeout for power limit write
Date: Mon, 07 Sep 2026 08:44:17 +0000	[thread overview]
Message-ID: <20260907084418.1720E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907083520.192418-3-karthik.poosa@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing early return on PCODE mailbox read failure causes hardware misconfiguration and corruption of pcode registers.
--

commit d67ad2da2fb13ff7d9f642e82666f4e587b00a48
Author: Karthik Poosa <karthik.poosa@intel.com>
drm/xe/hwmon: Use shared pcode default timeout for power limit write

This commit drops the local PL_WRITE_MBX_TIMEOUT_MS macro and uses the common
PCODE_DEFAULT_TIMEOUT_MS for the power limit write mailbox command.

> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 5284cab6703d8..5edeac961ec33 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
[ ... ]
> @@ -252,7 +247,7 @@ static int xe_hwmon_pcode_rmw_power_limit(const struct xe_hwmon *hwmon, u32 attr
>  							     (channel == CHANNEL_CARD) ?
>  							     WRITE_PSYSGPU_POWER_LIMIT :
>  							     WRITE_PACKAGE_POWER_LIMIT, 0),

[Severity: High]
This isn't a bug introduced by this patch, but looking at the earlier read
operation in xe_hwmon_pcode_rmw_power_limit() in drivers/gpu/drm/xe/xe_hwmon.c,
is an early return missing upon read failure?

If xe_pcode_read() encounters an error, such as a mailbox timeout, it logs a
debug message but execution falls through without returning. The val0 and val1
variables remain 0, and the read-modify-write operation is applied to them:

        ret = xe_pcode_read(..., &val0, &val1);
        if (ret)
                drm_dbg(...);

        if (attr == PL1_HWMON_ATTR)
                val0 = (val0 & ~clr) | set;
        else if (attr == PL2_HWMON_ATTR)
                val1 = (val1 & ~clr) | set;

Can this fall-through cause the subsequent write to clear all other fields in
the power limit registers, like time windows and enable bits, potentially
leaving the hardware power configuration in a corrupted state?

> -							     val0, val1, PL_WRITE_MBX_TIMEOUT_MS);
> +							     val0, val1, PCODE_DEFAULT_TIMEOUT_MS);
>  	if (ret)
>  		drm_dbg(&hwmon->xe->drm, "write failed ch %d val0 0x%08x, val1 0x%08x, ret %d\n",
>  			channel, val0, val1, ret);

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

  reply	other threads:[~2026-09-07  8:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  8:35 [PATCH v2 0/2] drm/xe/pcode: Increase default mailbox timeout Karthik Poosa
2026-09-07  8:35 ` [PATCH v2 1/2] drm/xe/pcode: Increase default pcode mailbox timeout to 10ms Karthik Poosa
2026-09-10 21:59   ` Rodrigo Vivi
2026-09-07  8:35 ` [PATCH v2 2/2] drm/xe/hwmon: Use shared pcode default timeout for power limit write Karthik Poosa
2026-09-07  8:44   ` sashiko-bot [this message]
2026-09-08  6:06     ` Poosa, Karthik
2026-09-10 21:59   ` Rodrigo Vivi
2026-09-07  8:44 ` ✓ CI.KUnit: success for drm/xe/pcode: Increase default mailbox timeout Patchwork
2026-09-07  9:34 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-07 10:59 ` ✗ 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=20260907084418.1720E1F00A3A@smtp.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