Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Chris Wilson <chris.p.wilson@intel.com>,
	Matthew Auld <matthew.auld@intel.com>,
	dri-devel@lists.freedesktop.org,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: Fix __gen125_emit_bb_start() without WA
Date: Fri, 30 Sep 2022 10:49:06 -0700	[thread overview]
Message-ID: <YzcsElCoVApN+7RA@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20220930050903.3479619-2-lucas.demarchi@intel.com>

On Thu, Sep 29, 2022 at 10:09:01PM -0700, Lucas De Marchi wrote:
> ce->wa_bb_page is allocated only for graphics version 12. However
> __gen125_emit_bb_start() is used for any graphics version >= 12.50. For
> the currently supported platforms this is not an issue, but for future
> ones there's a mismatch causing the jump to
> `wa_offset + DG2_PREDICATE_RESULT_BB` to be invalid since wa_offset is
> not correct.
> 
> As in other places in the driver, check for graphics version "greater or
> equal" to future-proof the support for new platforms.
> 
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

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

> ---
>  drivers/gpu/drm/i915/gt/gen8_engine_cs.c |  2 ++
>  drivers/gpu/drm/i915/gt/intel_lrc.c      | 19 +++++++++----------
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
> index 31a2fbd8c4a8..e000eaf8abed 100644
> --- a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
> @@ -405,6 +405,8 @@ static int __gen125_emit_bb_start(struct i915_request *rq,
>  	u32 wa_offset = lrc_indirect_bb(ce);
>  	u32 *cs;
>  
> +	GEM_BUG_ON(!ce->wa_bb_page);
> +
>  	cs = intel_ring_begin(rq, 12);
>  	if (IS_ERR(cs))
>  		return PTR_ERR(cs);
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index e84ef3859934..3515882a91fb 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -825,19 +825,18 @@ static int lrc_ring_cmd_buf_cctl(const struct intel_engine_cs *engine)
>  static u32
>  lrc_ring_indirect_offset_default(const struct intel_engine_cs *engine)
>  {
> -	switch (GRAPHICS_VER(engine->i915)) {
> -	default:
> -		MISSING_CASE(GRAPHICS_VER(engine->i915));
> -		fallthrough;
> -	case 12:
> +	if (GRAPHICS_VER(engine->i915) >= 12)
>  		return GEN12_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
> -	case 11:
> +	else if (GRAPHICS_VER(engine->i915) >= 11)
>  		return GEN11_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
> -	case 9:
> +	else if (GRAPHICS_VER(engine->i915) >= 9)
>  		return GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
> -	case 8:
> +	else if (GRAPHICS_VER(engine->i915) >= 8)
>  		return GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
> -	}
> +
> +	GEM_BUG_ON(GRAPHICS_VER(engine->i915) < 8);
> +
> +	return 0;
>  }
>  
>  static void
> @@ -1092,7 +1091,7 @@ __lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine)
>  	if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
>  		context_size += I915_GTT_PAGE_SIZE; /* for redzone */
>  
> -	if (GRAPHICS_VER(engine->i915) == 12) {
> +	if (GRAPHICS_VER(engine->i915) >= 12) {
>  		ce->wa_bb_page = context_size / PAGE_SIZE;
>  		context_size += PAGE_SIZE;
>  	}
> -- 
> 2.37.3
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation

  reply	other threads:[~2022-09-30 17:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30  5:09 [Intel-gfx] [PATCH 0/3] drm/i915: Improve register state context init Lucas De Marchi
2022-09-30  5:09 ` [Intel-gfx] [PATCH 1/3] drm/i915: Fix __gen125_emit_bb_start() without WA Lucas De Marchi
2022-09-30 17:49   ` Matt Roper [this message]
2022-09-30  5:09 ` [Intel-gfx] [PATCH 2/3] drm/i915/gt: Document function to decode register state context Lucas De Marchi
2022-09-30 17:55   ` Matt Roper
2022-09-30  5:09 ` [Intel-gfx] [PATCH 3/3] drm/i915/gt: Fix platform prefix Lucas De Marchi
2022-09-30 17:56   ` Matt Roper
2022-09-30  6:13 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Improve register state context init Patchwork
2022-09-30 18:51 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Improve register state context init (rev2) Patchwork
2022-10-01 16:00 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=YzcsElCoVApN+7RA@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.auld@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