All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: remove some limited use register access wrappers
Date: Wed, 23 Nov 2022 11:59:07 -0500	[thread overview]
Message-ID: <Y35RW72vp0IoTg3x@intel.com> (raw)
In-Reply-To: <20221123164916.4128733-1-jani.nikula@intel.com>

On Wed, Nov 23, 2022 at 06:49:16PM +0200, Jani Nikula wrote:
> Remove rmw_set(), rmw_clear(), clear_register(), rmw_set_fw(), and
> rmw_clear_fw(). They're just one too many levels of abstraction for
> register access, for very specific purposes.
> 
> clear_register() seems like a micro-optimization bypassing the write
> when the register is already clear, but that trick has ceased to work
> since commit 06b975d58fd6 ("drm/i915: make intel_uncore_rmw() write
> unconditionally"). Just clear the register in the most obvious way.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c    | 29 +++++++--------------------
>  drivers/gpu/drm/i915/gt/intel_reset.c | 18 ++++-------------
>  2 files changed, 11 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index b5ad9caa5537..efd9d722d77f 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -210,21 +210,6 @@ int intel_gt_init_hw(struct intel_gt *gt)
>  	return ret;
>  }
>  
> -static void rmw_set(struct intel_uncore *uncore, i915_reg_t reg, u32 set)
> -{
> -	intel_uncore_rmw(uncore, reg, 0, set);
> -}
> -
> -static void rmw_clear(struct intel_uncore *uncore, i915_reg_t reg, u32 clr)
> -{
> -	intel_uncore_rmw(uncore, reg, clr, 0);
> -}
> -
> -static void clear_register(struct intel_uncore *uncore, i915_reg_t reg)
> -{
> -	intel_uncore_rmw(uncore, reg, 0, 0);
> -}
> -
>  static void gen6_clear_engine_error_register(struct intel_engine_cs *engine)
>  {
>  	GEN6_RING_FAULT_REG_RMW(engine, RING_FAULT_VALID, 0);
> @@ -250,14 +235,14 @@ intel_gt_clear_error_registers(struct intel_gt *gt,
>  	u32 eir;
>  
>  	if (GRAPHICS_VER(i915) != 2)
> -		clear_register(uncore, PGTBL_ER);
> +		intel_uncore_write(uncore, PGTBL_ER, 0);
>  
>  	if (GRAPHICS_VER(i915) < 4)
> -		clear_register(uncore, IPEIR(RENDER_RING_BASE));
> +		intel_uncore_write(uncore, IPEIR(RENDER_RING_BASE), 0);
>  	else
> -		clear_register(uncore, IPEIR_I965);
> +		intel_uncore_write(uncore, IPEIR_I965, 0);
>  
> -	clear_register(uncore, EIR);
> +	intel_uncore_write(uncore, EIR, 0);
>  	eir = intel_uncore_read(uncore, EIR);
>  	if (eir) {
>  		/*
> @@ -265,7 +250,7 @@ intel_gt_clear_error_registers(struct intel_gt *gt,
>  		 * mask them.
>  		 */
>  		drm_dbg(&gt->i915->drm, "EIR stuck: 0x%08x, masking\n", eir);
> -		rmw_set(uncore, EMR, eir);
> +		intel_uncore_rmw(uncore, EMR, 0, eir);
>  		intel_uncore_write(uncore, GEN2_IIR,
>  				   I915_MASTER_ERROR_INTERRUPT);
>  	}
> @@ -275,10 +260,10 @@ intel_gt_clear_error_registers(struct intel_gt *gt,
>  					   RING_FAULT_VALID, 0);
>  		intel_gt_mcr_read_any(gt, XEHP_RING_FAULT_REG);
>  	} else if (GRAPHICS_VER(i915) >= 12) {
> -		rmw_clear(uncore, GEN12_RING_FAULT_REG, RING_FAULT_VALID);
> +		intel_uncore_rmw(uncore, GEN12_RING_FAULT_REG, RING_FAULT_VALID, 0);
>  		intel_uncore_posting_read(uncore, GEN12_RING_FAULT_REG);
>  	} else if (GRAPHICS_VER(i915) >= 8) {
> -		rmw_clear(uncore, GEN8_RING_FAULT_REG, RING_FAULT_VALID);
> +		intel_uncore_rmw(uncore, GEN8_RING_FAULT_REG, RING_FAULT_VALID, 0);
>  		intel_uncore_posting_read(uncore, GEN8_RING_FAULT_REG);
>  	} else if (GRAPHICS_VER(i915) >= 6) {
>  		struct intel_engine_cs *engine;
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index 24736ebee17c..ffde89c5835a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -35,16 +35,6 @@
>  /* XXX How to handle concurrent GGTT updates using tiling registers? */
>  #define RESET_UNDER_STOP_MACHINE 0
>  
> -static void rmw_set_fw(struct intel_uncore *uncore, i915_reg_t reg, u32 set)
> -{
> -	intel_uncore_rmw_fw(uncore, reg, 0, set);
> -}
> -
> -static void rmw_clear_fw(struct intel_uncore *uncore, i915_reg_t reg, u32 clr)
> -{
> -	intel_uncore_rmw_fw(uncore, reg, clr, 0);
> -}
> -
>  static void client_mark_guilty(struct i915_gem_context *ctx, bool banned)
>  {
>  	struct drm_i915_file_private *file_priv = ctx->file_priv;
> @@ -212,7 +202,7 @@ static int g4x_do_reset(struct intel_gt *gt,
>  	int ret;
>  
>  	/* WaVcpClkGateDisableForMediaReset:ctg,elk */
> -	rmw_set_fw(uncore, VDECCLK_GATE_D, VCP_UNIT_CLOCK_GATE_DISABLE);
> +	intel_uncore_rmw_fw(uncore, VDECCLK_GATE_D, 0, VCP_UNIT_CLOCK_GATE_DISABLE);
>  	intel_uncore_posting_read_fw(uncore, VDECCLK_GATE_D);
>  
>  	pci_write_config_byte(pdev, I915_GDRST,
> @@ -234,7 +224,7 @@ static int g4x_do_reset(struct intel_gt *gt,
>  out:
>  	pci_write_config_byte(pdev, I915_GDRST, 0);
>  
> -	rmw_clear_fw(uncore, VDECCLK_GATE_D, VCP_UNIT_CLOCK_GATE_DISABLE);
> +	intel_uncore_rmw_fw(uncore, VDECCLK_GATE_D, VCP_UNIT_CLOCK_GATE_DISABLE, 0);
>  	intel_uncore_posting_read_fw(uncore, VDECCLK_GATE_D);
>  
>  	return ret;
> @@ -448,7 +438,7 @@ static int gen11_lock_sfc(struct intel_engine_cs *engine,
>  	 * to reset it as well (we will unlock it once the reset sequence is
>  	 * completed).
>  	 */
> -	rmw_set_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit);
> +	intel_uncore_rmw_fw(uncore, sfc_lock.lock_reg, 0, sfc_lock.lock_bit);
>  
>  	ret = __intel_wait_for_register_fw(uncore,
>  					   sfc_lock.ack_reg,
> @@ -498,7 +488,7 @@ static void gen11_unlock_sfc(struct intel_engine_cs *engine)
>  
>  	get_sfc_forced_lock_data(engine, &sfc_lock);
>  
> -	rmw_clear_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit);
> +	intel_uncore_rmw_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit, 0);
>  }
>  
>  static int __gen11_reset_engines(struct intel_gt *gt,
> -- 
> 2.34.1
> 

  reply	other threads:[~2022-11-23 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 16:49 [Intel-gfx] [PATCH] drm/i915/gt: remove some limited use register access wrappers Jani Nikula
2022-11-23 16:59 ` Rodrigo Vivi [this message]
2022-11-23 20:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-11-28 18:38 ` [Intel-gfx] [PATCH] " Matt Roper
2022-11-28 21:35 ` Andrzej Hajda
2022-12-05 12:26 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gt: remove some limited use register access wrappers (rev2) Patchwork
2022-12-05 14:35 ` [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=Y35RW72vp0IoTg3x@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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.