Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: extract steered reg access to common function
Date: Tue, 15 Jun 2021 04:48:02 -0400	[thread overview]
Message-ID: <YMhpQsGTxjWzxO7V@intel.com> (raw)
In-Reply-To: <20210615033433.1574397-2-matthew.d.roper@intel.com>

On Mon, Jun 14, 2021 at 08:34:31PM -0700, Matt Roper wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> New steering cases will be added in the follow-up patches, so prepare a
> common helper to avoid code duplication.
> 
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

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

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_cs.c | 41 +----------------
>  drivers/gpu/drm/i915/intel_uncore.c       | 55 +++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_uncore.h       |  6 +++
>  3 files changed, 63 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index 9ceddfbb1687..8b913c6961c3 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -1105,45 +1105,8 @@ static u32
>  read_subslice_reg(const struct intel_engine_cs *engine,
>  		  int slice, int subslice, i915_reg_t reg)
>  {
> -	struct drm_i915_private *i915 = engine->i915;
> -	struct intel_uncore *uncore = engine->uncore;
> -	u32 mcr_mask, mcr_ss, mcr, old_mcr, val;
> -	enum forcewake_domains fw_domains;
> -
> -	if (GRAPHICS_VER(i915) >= 11) {
> -		mcr_mask = GEN11_MCR_SLICE_MASK | GEN11_MCR_SUBSLICE_MASK;
> -		mcr_ss = GEN11_MCR_SLICE(slice) | GEN11_MCR_SUBSLICE(subslice);
> -	} else {
> -		mcr_mask = GEN8_MCR_SLICE_MASK | GEN8_MCR_SUBSLICE_MASK;
> -		mcr_ss = GEN8_MCR_SLICE(slice) | GEN8_MCR_SUBSLICE(subslice);
> -	}
> -
> -	fw_domains = intel_uncore_forcewake_for_reg(uncore, reg,
> -						    FW_REG_READ);
> -	fw_domains |= intel_uncore_forcewake_for_reg(uncore,
> -						     GEN8_MCR_SELECTOR,
> -						     FW_REG_READ | FW_REG_WRITE);
> -
> -	spin_lock_irq(&uncore->lock);
> -	intel_uncore_forcewake_get__locked(uncore, fw_domains);
> -
> -	old_mcr = mcr = intel_uncore_read_fw(uncore, GEN8_MCR_SELECTOR);
> -
> -	mcr &= ~mcr_mask;
> -	mcr |= mcr_ss;
> -	intel_uncore_write_fw(uncore, GEN8_MCR_SELECTOR, mcr);
> -
> -	val = intel_uncore_read_fw(uncore, reg);
> -
> -	mcr &= ~mcr_mask;
> -	mcr |= old_mcr & mcr_mask;
> -
> -	intel_uncore_write_fw(uncore, GEN8_MCR_SELECTOR, mcr);
> -
> -	intel_uncore_forcewake_put__locked(uncore, fw_domains);
> -	spin_unlock_irq(&uncore->lock);
> -
> -	return val;
> +	return intel_uncore_read_with_mcr_steering(engine->uncore, reg,
> +						   slice, subslice);
>  }
>  
>  /* NB: please notice the memset */
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 1bed8f666048..d067524f9162 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -2277,6 +2277,61 @@ intel_uncore_forcewake_for_reg(struct intel_uncore *uncore,
>  	return fw_domains;
>  }
>  
> +u32 intel_uncore_read_with_mcr_steering_fw(struct intel_uncore *uncore,
> +					   i915_reg_t reg,
> +					   int slice, int subslice)
> +{
> +	u32 mcr_mask, mcr_ss, mcr, old_mcr, val;
> +
> +	lockdep_assert_held(&uncore->lock);
> +
> +	if (GRAPHICS_VER(uncore->i915) >= 11) {
> +		mcr_mask = GEN11_MCR_SLICE_MASK | GEN11_MCR_SUBSLICE_MASK;
> +		mcr_ss = GEN11_MCR_SLICE(slice) | GEN11_MCR_SUBSLICE(subslice);
> +	} else {
> +		mcr_mask = GEN8_MCR_SLICE_MASK | GEN8_MCR_SUBSLICE_MASK;
> +		mcr_ss = GEN8_MCR_SLICE(slice) | GEN8_MCR_SUBSLICE(subslice);
> +	}
> +
> +	old_mcr = mcr = intel_uncore_read_fw(uncore, GEN8_MCR_SELECTOR);
> +
> +	mcr &= ~mcr_mask;
> +	mcr |= mcr_ss;
> +	intel_uncore_write_fw(uncore, GEN8_MCR_SELECTOR, mcr);
> +
> +	val = intel_uncore_read_fw(uncore, reg);
> +
> +	mcr &= ~mcr_mask;
> +	mcr |= old_mcr & mcr_mask;
> +
> +	intel_uncore_write_fw(uncore, GEN8_MCR_SELECTOR, mcr);
> +
> +	return val;
> +}
> +
> +u32 intel_uncore_read_with_mcr_steering(struct intel_uncore *uncore,
> +					i915_reg_t reg, int slice, int subslice)
> +{
> +	enum forcewake_domains fw_domains;
> +	u32 val;
> +
> +	fw_domains = intel_uncore_forcewake_for_reg(uncore, reg,
> +						    FW_REG_READ);
> +	fw_domains |= intel_uncore_forcewake_for_reg(uncore,
> +						     GEN8_MCR_SELECTOR,
> +						     FW_REG_READ | FW_REG_WRITE);
> +
> +	spin_lock_irq(&uncore->lock);
> +	intel_uncore_forcewake_get__locked(uncore, fw_domains);
> +
> +	val = intel_uncore_read_with_mcr_steering_fw(uncore, reg, slice, subslice);
> +
> +	intel_uncore_forcewake_put__locked(uncore, fw_domains);
> +	spin_unlock_irq(&uncore->lock);
> +
> +	return val;
> +}
> +
>  #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
>  #include "selftests/mock_uncore.c"
>  #include "selftests/intel_uncore.c"
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index 59f0da8f1fbb..a18bdb57af7b 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -182,6 +182,12 @@ intel_uncore_has_fifo(const struct intel_uncore *uncore)
>  	return uncore->flags & UNCORE_HAS_FIFO;
>  }
>  
> +u32 intel_uncore_read_with_mcr_steering_fw(struct intel_uncore *uncore,
> +					   i915_reg_t reg,
> +					   int slice, int subslice);
> +u32 intel_uncore_read_with_mcr_steering(struct intel_uncore *uncore,
> +					i915_reg_t reg,	int slice, int subslice);
> +
>  void
>  intel_uncore_mmio_debug_init_early(struct intel_uncore_mmio_debug *mmio_debug);
>  void intel_uncore_init_early(struct intel_uncore *uncore,
> -- 
> 2.25.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-06-15  8:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  3:34 [Intel-gfx] [PATCH 0/3] Explicity steer l3bank multicast reads when necessary Matt Roper
2021-06-15  3:34 ` [Intel-gfx] [PATCH 1/3] drm/i915: extract steered reg access to common function Matt Roper
2021-06-15  8:48   ` Rodrigo Vivi [this message]
2021-06-15  3:34 ` [Intel-gfx] [PATCH 2/3] drm/i915: Add GT support for multiple types of multicast steering Matt Roper
2021-06-15  9:08   ` Rodrigo Vivi
2021-06-15  9:11     ` Rodrigo Vivi
2021-06-15 15:30       ` Matt Roper
2021-06-15 19:48         ` Rodrigo Vivi
2021-06-15 20:09           ` Matt Roper
2021-06-15  3:34 ` [Intel-gfx] [PATCH 3/3] drm/i915: Add support for explicit L3BANK steering Matt Roper
2021-06-15 10:14   ` Tvrtko Ursulin
2021-06-15  3:48 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Explicity steer l3bank multicast reads when necessary Patchwork
2021-06-15  4:14 ` [Intel-gfx] ✗ Fi.CI.BAT: 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=YMhpQsGTxjWzxO7V@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@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