From: sashiko-bot@kernel.org
To: tilak.tirumalesh.tangudu@intel.com
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms
Date: Tue, 08 Sep 2026 08:49:53 +0000 [thread overview]
Message-ID: <20260908084954.36A571F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908083656.51704-1-tilak.tirumalesh.tangudu@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Potential division by zero in DIV_ROUND_CLOSEST if the GT crystal clock frequency is invalid or unrecognized.
- [High] 32-bit integer overflow during nanosecond unit conversions for `idledly` causes incorrect delay calculations and erroneous hardware timer programming.
- [High] Integer underflow when maxcnt is zero leads to a massive delay calculation that subsequently overflows.
--
commit 36b72781bea702adafa74030ffeb7bc9ba2efaf8
Author: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms
Avoid IDLEDLY timer programming lessthan 5 micro secs.
Apply wa_14025941587 to Graphics Versions 20.01 to 35.11
and Media Versions 13.01 to 35.03
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index 010499766fce2..5a87f26d7dd4a 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -588,25 +588,57 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
> static void adjust_idledly(struct xe_hw_engine *hwe)
> {
[ ... ]
> - inhibit_switch = idledly & INHIBIT_SWITCH_UNTIL_PREEMPTED;
> - idledly = REG_FIELD_GET(IDLE_DELAY, idledly);
> + inhibit_switch = idledly_reg_val & INHIBIT_SWITCH_UNTIL_PREEMPTED;
> + idledly = REG_FIELD_GET(IDLE_DELAY, idledly_reg_val);
> idledly = DIV_ROUND_CLOSEST(idledly * idledly_units_ps, 1000);
[Severity: High]
This is a pre-existing issue, but does this multiplication overflow 32 bits?
With idledly capable of being up to 21-bits and idledly_units_ps typically
around 666,664, the multiplication can reach ~1.4 trillion, which
overflows the 32-bit limit before DIV_ROUND_CLOSEST is evaluated. This wrap
around could cause an incorrect delay calculation.
> maxcnt = REG_FIELD_GET(IDLE_WAIT_TIME, maxcnt);
> maxcnt *= maxcnt_units_ns;
[ ... ]
> + if (XE_GT_WA(gt, 16023105232) &&
> + xe_gt_WARN_ON(gt, idledly >= maxcnt || inhibit_switch)) {
> + idledly = (maxcnt - 1);
[Severity: High]
This is a pre-existing issue, but does this subtraction underflow if maxcnt
evaluates to 0?
If the hardware initializes with 0 in the IDLE_WAIT_TIME field, maxcnt will
be 0. Because idledly is unsigned, idledly >= maxcnt will be true, causing
idledly to underflow to U32_MAX.
> + wa_applied = true;
> + /* inhibit_switch override to keep
> + * semantics of Wa_16023105232
> + */
> + if (inhibit_switch)
> + idledly_reg_val &= ~INHIBIT_SWITCH_UNTIL_PREEMPTED;
> + }
> +
> + if (wa_applied) {
> + idledly_reg_val &= ~IDLE_DELAY;
> + idledly_reg_val |= REG_FIELD_PREP(IDLE_DELAY,
> + DIV_ROUND_CLOSEST(idledly * 1000,
> + idledly_units_ps));
[Severity: High]
This is a pre-existing issue, but does this code suffer from a division by
zero panic?
If the hardware register RPM_CONFIG0 contains an unrecognized crystal clock
frequency, xe_gt_clock_init() sets gt->info.timestamp_base to 0. This makes
idledly_units_ps evaluate to 0, which triggers a panic here.
Also, does the idledly * 1000 multiplication overflow the 32-bit limit?
If maxcnt was 0 and idledly underflowed to U32_MAX earlier, this
multiplication reaches ~4.29 trillion, causing another silent overflow
before the division and programming an incorrect delay into the hardware.
> + xe_gt_dbg(gt, "idledly %s: set %u max=%u inh=%u ts=%u\n",
> + hwe->name, idledly, maxcnt,
> + !!inhibit_switch, gt->info.timestamp_base);
> + xe_mmio_write32(>->mmio,
> + RING_IDLEDLY(hwe->mmio_base),
> + idledly_reg_val);
> }
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908083656.51704-1-tilak.tirumalesh.tangudu@intel.com?part=1
next prev parent reply other threads:[~2026-09-08 8:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 8:36 [PATCH] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms tilak.tirumalesh.tangudu
2026-09-08 8:49 ` sashiko-bot [this message]
2026-09-08 9:05 ` ✓ CI.KUnit: success for drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms (rev6) Patchwork
2026-09-08 9:48 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-08 12:47 ` ✗ Xe.CI.FULL: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-09-08 16:52 [PATCH] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms tilak.tirumalesh.tangudu
2026-09-08 17:09 ` sashiko-bot
2026-06-16 12:34 tilak.tirumalesh.tangudu
2026-06-11 10:30 tilak.tirumalesh.tangudu
2026-06-03 18:47 tilak.tirumalesh.tangudu
2026-06-05 11:14 ` Vivekanandan, Balasubramani
2026-06-05 11:43 ` Tangudu, Tilak Tirumalesh
2026-06-02 4:32 tilak.tirumalesh.tangudu
2026-06-03 7:57 ` Vivekanandan, Balasubramani
2026-06-03 8:24 ` Tangudu, Tilak Tirumalesh
2026-06-03 10:00 ` Vivekanandan, Balasubramani
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=20260908084954.36A571F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tilak.tirumalesh.tangudu@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