mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Helen Koike <koike@igalia.com>
Cc: <rodrigo.vivi@intel.com>, <demarchi@kernel.org>,
	<intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <tvrtko.ursulin@igalia.com>,
	<linux-kernel@vger.kernel.org>, <kernel-dev@igalia.com>
Subject: Re: [PATCH v3] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2
Date: Fri, 16 Oct 2026 15:10:21 -0700	[thread overview]
Message-ID: <20261016221021.GC1329272@mdroper-desk1> (raw)
In-Reply-To: <20261016214112.1647202-1-koike@igalia.com>

On Fri, Oct 16, 2026 at 06:40:50PM -0300, Helen Koike wrote:
> CTX_CS_INDIRECT_CTX_OFFSET default value is not retrieved from the GPU
> by inhibit+context save mechanism since it is not part of the Engine
> Context. Thus, at restore, 0x0 is programmed back to the GPU, which is
> an invalid value according to the PRM.
> 
> This causes sporadic hangs on Alder Lake when executing test
> IntelAngleEnd2EndTestCases (error VK_DEVICE_LOST).
> 
> Fix it by partially reverting commit c9dfd66cb91e ("drm/xe/lrc: Allow
> INDIRECT_CTX for more engine classes"). Re-add the programming of
> CTX_CS_INDIRECT_CTX_OFFSET for pre-Xe2 (in theory it should apply to all
> platforms, but we got an unexpected behaviour on Xe2 that still requires
> investigation).
> 
> Fixes: c9dfd66cb91e ("drm/xe/lrc: Allow INDIRECT_CTX for more engine classes")
> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Signed-off-by: Helen Koike <koike@igalia.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> 
> ---
> 
> v3:
>   - Commit message update:
>     - s/programed/programmed
>     - s/for ADL/for pre-Xe2
>     - Add sentence saying it should apply to Xe2 too, but we got an
>       unexpected behaviour and it requires more investigation.
>   - Remove comment "Enable INDIRECT_CTX leaving..." since it is wrong.
> 
> v2:
>   - according to intel CI results, it seems that this default is not valid for
>     LNL and BMG platforms, so limit the change only to ADL.
>   - program the default only on ADL.
>   - restore the comment, but add note with exception for ADL.
>   - update the commit title/message with "for ADL".
> ---
>  drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 3 +++
>  drivers/gpu/drm/xe/xe_lrc.c             | 8 ++++----
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> index 4ab86fc369fd..e4c7c3549735 100644
> --- a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> +++ b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> @@ -43,4 +43,7 @@
>  #define INDIRECT_CTX_RING_START_UDW	(0x08 + 1)
>  #define INDIRECT_CTX_RING_CTL		(0x0a + 1)
>  
> +#define CTX_INDIRECT_CTX_OFFSET_MASK	REG_GENMASK(15, 6)
> +#define CTX_INDIRECT_CTX_OFFSET_DEFAULT	REG_FIELD_PREP(CTX_INDIRECT_CTX_OFFSET_MASK, 0xd)
> +
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> index 35b4e8289b5f..18f247bc8865 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
> @@ -1449,15 +1449,15 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
>  	finish_bo(&state);
>  	kfree(state.buffer);
>  
> -	/*
> -	 * Enable INDIRECT_CTX leaving INDIRECT_CTX_OFFSET at its default: it
> -	 * varies per engine class, but the default is good enough
> -	 */
>  	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)
> +		xe_lrc_write_ctx_reg(lrc,
> +				     CTX_CS_INDIRECT_CTX_OFFSET,
> +				     CTX_INDIRECT_CTX_OFFSET_DEFAULT);
>  
>  	return 0;
>  }
> -- 
> 2.54.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

      reply	other threads:[~2026-10-16 22:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 21:40 Helen Koike
2026-10-16 22:10 ` Matt Roper [this message]

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=20261016221021.GC1329272@mdroper-desk1 \
    --to=matthew.d.roper@intel.com \
    --cc=demarchi@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=koike@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tvrtko.ursulin@igalia.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

all inboxes | Powered by JetHome®