All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Helen Koike" <koike@igalia.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for ADL
Date: Wed, 30 Sep 2026 17:14:19 +0000	[thread overview]
Message-ID: <20260930171420.53EC01F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260930170434.317671-1-koike@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] xe/lrc: Mismatched platform condition applies ADL workaround to all Gen12
- [High] xe/lrc: Hardware defaults corrupted by hardcoded RCS offset for XCS engines
--

commit 6eb083cb06a370d43050c04bc2d40604dc4f058f
Author: Helen Koike <koike@igalia.com>

drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for ADL

CTX_CS_INDIRECT_CTX_OFFSET default value is not retrieved from the GPU
by inhibit+context save mechanism. Thus, at restore, 0x0 is programed back
to the GPU, which causes sporadic hangs on Alder Lake. Fix it by partially 
reverting commit c9dfd66cb91e and re-adding the programming of 
CTX_CS_INDIRECT_CTX_OFFSET for Alder Lake.

> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> index bf5c2351aed3d..95285ae069290 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
[ ... ]
> @@ -1459,13 +1459,18 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
>  
>  	/*
>  	 * Enable INDIRECT_CTX leaving INDIRECT_CTX_OFFSET at its default: it
> -	 * varies per engine class, but the default is good enough
> +	 * varies per engine class, but the default is good enough, except on
> +	 * Alder Lake.
>  	 */
>  	xe_lrc_write_ctx_reg(lrc,
>  			     CTX_CS_INDIRECT_CTX,
>  			     (xe_bo_ggtt_addr(lrc->bo) + state.offset) |
>  			     /* Size in CLs. */
>  			     (state.written * sizeof(u32) / 64));
> +	if (GRAPHICS_VER(lrc_to_xe(lrc)) < 20)

[Severity: High]
Does this condition apply the ADL-specific fix to all platforms with graphics
version < 20?

The commit message and comments explicitly state the intention to limit this
workaround exclusively to Alder Lake. However, checking for graphics version
< 20 evaluates to true for all Gen12 platforms, including DG2, MTL, and PVC,
during LRC context setup in setup_indirect_ctx().

Could this cause hardware misconfiguration on non-ADL platforms that may not
expect or support the CTX_CS_INDIRECT_CTX_OFFSET rewrite, potentially leading
to sporadic hangs or context corruption?

> +		xe_lrc_write_ctx_reg(lrc,
> +				     CTX_CS_INDIRECT_CTX_OFFSET,
> +				     CTX_INDIRECT_CTX_OFFSET_DEFAULT);

[Severity: High]
Does this code write a hardcoded, RCS-specific default value to all engines
that have INDIRECT_CTX enabled, including non-RCS engines which require a
different offset?

If a non-RCS/CCS engine has indirect context enabled (for example, via
userspace configfs enabling context restore ctx_restore_mid_bb for XCS
engines), setup_indirect_ctx() executes and unconditionally writes
CTX_INDIRECT_CTX_OFFSET_DEFAULT (0xD) without checking the engine class.

As noted in commit c9dfd66cb91e, the correct offset varies per engine class.
Could forcing the RCS-specific 0xD on Video or Copy engines overwrite their
native hardware defaults and cause GPU hangs or context restoration failures?

>  
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930170434.317671-1-koike@igalia.com?part=1

  reply	other threads:[~2026-09-30 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 17:04 [PATCH v2] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for ADL Helen Koike
2026-09-30 17:14 ` sashiko-bot [this message]
2026-09-30 17:38 ` ✓ CI.KUnit: success for " Patchwork
2026-09-30 19:28 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-30 23:29 ` [PATCH v2] " Matt Roper
2026-10-01 14:17   ` Helen Koike
2026-10-01  1:11 ` ✗ Xe.CI.FULL: failure for " Patchwork
2026-10-01  8:45 ` [PATCH v2] " Andi Shyti
2026-10-01 18:00   ` Helen Koike

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=20260930171420.53EC01F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=koike@igalia.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 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.