From: "Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>
To: <tilak.tirumalesh.tangudu@intel.com>, <tejas.upadhyay@intel.com>,
<gustavo.sousa@intel.com>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms
Date: Fri, 11 Sep 2026 14:32:58 -0700 [thread overview]
Message-ID: <40ec4b1a-7c13-4a5b-ac33-3bf8c03d12db@intel.com> (raw)
In-Reply-To: <20260909161844.125147-3-tilak.tirumalesh.tangudu@intel.com>
On 9/9/2026 9:18 AM, tilak.tirumalesh.tangudu@intel.com wrote:
> From: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
>
> Avoid programming the IDLEDLY timer to less than 5 microseconds.
> Apply wa_14025941587 to Graphics Versions 20.01 to 35.11
> and Media Versions 13.01 to 35.03
>
> v2: Use xe_rtp_match_not_sriov_vf, move to local variable
> Remove warn and other knits - Matt R
>
> v3: Add verbose comment - Tejas
>
> v4: Restore IDLE_DLY register on engine reset.
> Add it to GUC save-restore list. -Vivek
>
> v5: Extend WA to Media Versions 13.01 to 35.03 - Vinay
>
> v6: Avoid clearing inhibit switch - Bala
> Refactor code accordingly by adding idle_reg_val.
>
> v7: Rebased with the divide-by-zero/overflow guards living in
> a separate hardening patch.
>
> v8: Preserve the Wa_16023105232 floor (DIV_ROUND_DOWN_ULL) and the
> maxcnt == 0 guard from the hardening patch. Round up
> (DIV_ROUND_UP_ULL) the Wa_14025941587 minimum conversion instead,
> so the tick-quantized delay cannot round back below 5 us.
>
> Assisted-by: GitHub_Copilot:claude-opus-4.8
> Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
LGTM,
Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ads.c | 2 +-
> drivers/gpu/drm/xe/xe_hw_engine.c | 69 ++++++++++++++++++++++++------
> drivers/gpu/drm/xe/xe_wa_oob.rules | 2 +
> 3 files changed, 60 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
> index ff8eee3831aa..58a3f6293ce4 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ads.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ads.c
> @@ -864,7 +864,7 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads,
> }
> }
>
> - if (XE_GT_WA(hwe->gt, 16023105232))
> + if (XE_GT_WA(hwe->gt, 16023105232) || XE_GT_WA(hwe->gt, 14025941587))
> guc_mmio_regset_write_one(ads, regset_map,
> RING_IDLEDLY(hwe->mmio_base),
> count++);
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index c86890e09b55..37cd7fe38c2b 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -588,33 +588,78 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
> static void adjust_idledly(struct xe_hw_engine *hwe)
> {
> struct xe_gt *gt = hwe->gt;
> - u32 idledly, maxcnt;
> + u32 idledly, idledly_reg_val, maxcnt;
> u32 idledly_units_ps = 8 * gt->info.timestamp_base;
> u32 maxcnt_units_ns = 640;
> - bool inhibit_switch = 0;
> + bool inhibit_switch = false;
> + bool wa_applied = false;
> + bool clamped_below_maxcnt = false;
> +
> + if ((!IS_SRIOV_VF(gt_to_xe(hwe->gt)) && XE_GT_WA(gt, 16023105232)) ||
> + XE_GT_WA(gt, 14025941587)) {
> + u32 mincnt_idledly_ns = 5000;
>
> - if (!IS_SRIOV_VF(gt_to_xe(hwe->gt)) && XE_GT_WA(gt, 16023105232)) {
> /* xe_gt_clock_init() zeroes timestamp_base on unknown crystal clock. */
> if (!idledly_units_ps) {
> xe_gt_warn(gt, "idledly WA skipped: timestamp_base is 0\n");
> return;
> }
>
> - idledly = xe_mmio_read32(>->mmio, RING_IDLEDLY(hwe->mmio_base));
> + idledly_reg_val = xe_mmio_read32(>->mmio, RING_IDLEDLY(hwe->mmio_base));
> maxcnt = xe_mmio_read32(>->mmio, RING_PWRCTX_MAXCNT(hwe->mmio_base));
>
> - 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_ULL((u64)idledly * idledly_units_ps, 1000);
> maxcnt = REG_FIELD_GET(IDLE_WAIT_TIME, maxcnt);
> maxcnt *= maxcnt_units_ns;
>
> - if (xe_gt_WARN_ON(gt, idledly >= maxcnt || inhibit_switch)) {
> - /* Floor below maxcnt; write 0 to still clear the inhibit bit. */
> - idledly = maxcnt ?
> - DIV_ROUND_DOWN_ULL((u64)(maxcnt - 1) * 1000,
> - idledly_units_ps) : 0;
> - xe_mmio_write32(>->mmio, RING_IDLEDLY(hwe->mmio_base), idledly);
> + /*
> + * Wa_14025941587 is applied before Wa_16023105232, which has
> + * higher priority; the two are not expected to conflict.
> + */
> + if (XE_GT_WA(gt, 14025941587) &&
> + idledly < mincnt_idledly_ns) {
> + idledly = mincnt_idledly_ns;
> + wa_applied = true;
> + }
> +
> + if (XE_GT_WA(gt, 16023105232) &&
> + xe_gt_WARN_ON(gt, idledly >= maxcnt || inhibit_switch)) {
> + /* maxcnt may be 0 if IDLE_WAIT_TIME is unprogrammed. */
> + idledly = maxcnt ? maxcnt - 1 : 0;
> + clamped_below_maxcnt = true;
> + 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) {
> + u32 idledly_ticks;
> +
> + /*
> + * Wa_16023105232 requires idledly < maxcnt, so floor
> + * that clamp; otherwise round up to guarantee the
> + * Wa_14025941587 minimum survives tick quantization.
> + */
> + if (clamped_below_maxcnt)
> + idledly_ticks = DIV_ROUND_DOWN_ULL((u64)idledly * 1000,
> + idledly_units_ps);
> + else
> + idledly_ticks = DIV_ROUND_UP_ULL((u64)idledly * 1000,
> + idledly_units_ps);
> +
> + idledly_reg_val &= ~IDLE_DELAY;
> + idledly_reg_val |= REG_FIELD_PREP(IDLE_DELAY, idledly_ticks);
> + 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);
> }
> }
> }
> diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
> index dd69ad07f7a9..3001155f8d09 100644
> --- a/drivers/gpu/drm/xe/xe_wa_oob.rules
> +++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
> @@ -72,3 +72,5 @@
> 16029897822 MEDIA_VERSION(3500)
> GRAPHICS_VERSION(3510)
> 14027054324 GRAPHICS_VERSION(3511)
> +14025941587 GRAPHICS_VERSION_RANGE(2001, 3511), FUNC(xe_rtp_match_not_sriov_vf)
> + MEDIA_VERSION_RANGE(1301, 3503), FUNC(xe_rtp_match_not_sriov_vf)
next prev parent reply other threads:[~2026-09-11 21:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 16:18 [PATCH 0/2] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms tilak.tirumalesh.tangudu
2026-09-09 16:18 ` [PATCH 1/2] drm/xe: harden adjust_idledly() against divide-by-zero and overflow tilak.tirumalesh.tangudu
2026-09-11 17:39 ` Belgaumkar, Vinay
2026-09-11 17:44 ` Tangudu, Tilak Tirumalesh
2026-09-11 17:47 ` Belgaumkar, Vinay
2026-09-09 16:18 ` [PATCH 2/2] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms tilak.tirumalesh.tangudu
2026-09-09 16:33 ` sashiko-bot
2026-09-09 17:06 ` Tangudu, Tilak Tirumalesh
2026-09-11 21:32 ` Belgaumkar, Vinay [this message]
2026-09-09 17:06 ` ✓ CI.KUnit: success for drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms (rev9) Patchwork
2026-09-09 17:48 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-10 2:45 ` ✓ Xe.CI.FULL: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-09-09 7:25 [PATCH 0/2] drm/xe: Add wa_14025941587 to xe2, xe3 and xe3p platforms tilak.tirumalesh.tangudu
2026-09-09 7:25 ` [PATCH 2/2] " tilak.tirumalesh.tangudu
2026-09-09 7:39 ` sashiko-bot
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=40ec4b1a-7c13-4a5b-ac33-3bf8c03d12db@intel.com \
--to=vinay.belgaumkar@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=tejas.upadhyay@intel.com \
--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 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.