All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Stuart Summers <stuart.summers@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	"Riana Tauro" <riana.tauro@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Raag Jadav <raag.jadav@intel.com>
Subject: Re: [PATCH v5 5/7] drm/xe/lrc: Allow INDIRECT_CTX for more engine classes
Date: Wed, 17 Sep 2025 15:52:24 -0400	[thread overview]
Message-ID: <aMsReM70YRm0TtoY@intel.com> (raw)
In-Reply-To: <20250916-wa-bb-cmds-v5-5-306bddbc15da@intel.com>

On Tue, Sep 16, 2025 at 02:15:42PM -0700, Lucas De Marchi wrote:
> Currently it's only allowed for render and compute. Going forward we
> want to enable it for more engine classes. Let the XE_LRC_FLAG_INDIRECT_CTX
> flag (and thus gt_engine_needs_indirect_ctx()) be the deciding factor
> for its availability.
> 
> While at it, add the missing const to rcs_funcs array. Since
> CTX_INDIRECT_CTX_OFFSET_DEFAULT already matches the HW default and
> gt_engine_needs_indirect_ctx() only ever enables it for rcs/ccs, there
> is no change in behavior, it's only preparation for future use case.
> 

thanks for the offline explanation and pointers

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/xe/regs/xe_lrc_layout.h |  3 ---
>  drivers/gpu/drm/xe/xe_lrc.c             | 14 ++++++++++----
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> index 1b101edb838bf..b5eff383902c5 100644
> --- a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> +++ b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
> @@ -40,7 +40,4 @@
>  #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 c706585611d55..0ab99c210d882 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
> @@ -1281,9 +1281,11 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
>  static int
>  setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
>  {
> -	static struct bo_setup rcs_funcs[] = {
> +	static const struct bo_setup rcs_funcs[] = {
>  		{ .setup = setup_timestamp_wa },
>  	};
> +	static const struct bo_setup xcs_funcs[] = {
> +	};
>  	struct bo_setup_state state = {
>  		.lrc = lrc,
>  		.hwe = hwe,
> @@ -1300,6 +1302,9 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
>  	    hwe->class == XE_ENGINE_CLASS_COMPUTE) {
>  		state.funcs = rcs_funcs;
>  		state.num_funcs = ARRAY_SIZE(rcs_funcs);
> +	} else {
> +		state.funcs = xcs_funcs;
> +		state.num_funcs = ARRAY_SIZE(xcs_funcs);
>  	}
>  
>  	if (xe_gt_WARN_ON(lrc->gt, !state.funcs))
> @@ -1326,14 +1331,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));
> -	xe_lrc_write_ctx_reg(lrc,
> -			     CTX_CS_INDIRECT_CTX_OFFSET,
> -			     CTX_INDIRECT_CTX_OFFSET_DEFAULT);
>  
>  	return 0;
>  }
> 
> -- 
> 2.50.1
> 

  reply	other threads:[~2025-09-17 19:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 21:15 [PATCH v5 0/7] drm/xe: Add user commands to WA BB via configfs Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 1/7] drm/xe/configfs: Extract function to parse engine Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 2/7] drm/xe/configfs: Allow to select by class only Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 3/7] drm/xe/lrc: Allow to add user commands on context switch Lucas De Marchi
2025-09-17 16:32   ` Rodrigo Vivi
2025-09-16 21:15 ` [PATCH v5 4/7] drm/xe/configfs: Add post context restore bb Lucas De Marchi
2025-09-24 20:31   ` Kees Bakker
2025-09-24 21:34     ` Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 5/7] drm/xe/lrc: Allow INDIRECT_CTX for more engine classes Lucas De Marchi
2025-09-17 19:52   ` Rodrigo Vivi [this message]
2025-09-16 21:15 ` [PATCH v5 6/7] drm/xe/lrc: Allow to add user commands mid context switch Lucas De Marchi
2025-09-17 19:53   ` Rodrigo Vivi
2025-09-16 21:15 ` [PATCH v5 7/7] drm/xe/configfs: Add mid context restore bb Lucas De Marchi
2025-09-17 19:53   ` Rodrigo Vivi
2025-09-16 21:21 ` ✗ CI.checkpatch: warning for drm/xe: Add user commands to WA BB via configfs Patchwork
2025-09-16 21:23 ` ✓ CI.KUnit: success " Patchwork
2025-09-16 21:58 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-17  1:22 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-17  6:44 ` [PATCH v5 0/7] " Raag Jadav
2025-09-18 21:47 ` Lucas De Marchi

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=aMsReM70YRm0TtoY@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=tursulin@ursulin.net \
    --cc=umesh.nerlige.ramappa@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.