Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3 10/14] drm/i915/guc: Handle save/restore of MCR registers explicitly
Date: Mon, 17 Oct 2022 22:24:25 +0530	[thread overview]
Message-ID: <Y02IwZHnyKt0lnwe@bala-ubuntu> (raw)
In-Reply-To: <20221014230239.1023689-11-matthew.d.roper@intel.com>

On 14.10.2022 16:02, Matt Roper wrote:
> MCR registers can be placed on the GuC's save/restore list, but at the
> moment they are always handled in a multicast manner (i.e., the GuC
> reads one instance to save the value and then does a multicast write to
> restore that single value to all instances).  In the future the GuC will
> probably give us an alternate interface to do unicast per-instance
> save/restore operations, so we should be very clear about which
> registers on the list are MCR registers (and in the future which
> save/restore behavior we want for them).
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 55 +++++++++++++---------
>  1 file changed, 34 insertions(+), 21 deletions(-)

Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>

Regards,
Bala
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> index cc357fa0c270..de923fb82301 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> @@ -278,24 +278,16 @@ __mmio_reg_add(struct temp_regset *regset, struct guc_mmio_reg *reg)
>  	return slot;
>  }
>  
> -#define GUC_REGSET_STEERING(group, instance) ( \
> -	FIELD_PREP(GUC_REGSET_STEERING_GROUP, (group)) | \
> -	FIELD_PREP(GUC_REGSET_STEERING_INSTANCE, (instance)) | \
> -	GUC_REGSET_NEEDS_STEERING \
> -)
> -
>  static long __must_check guc_mmio_reg_add(struct intel_gt *gt,
>  					  struct temp_regset *regset,
> -					  i915_reg_t reg, u32 flags)
> +					  u32 offset, u32 flags)
>  {
>  	u32 count = regset->storage_used - (regset->registers - regset->storage);
> -	u32 offset = i915_mmio_reg_offset(reg);
>  	struct guc_mmio_reg entry = {
>  		.offset = offset,
>  		.flags = flags,
>  	};
>  	struct guc_mmio_reg *slot;
> -	u8 group, inst;
>  
>  	/*
>  	 * The mmio list is built using separate lists within the driver.
> @@ -307,17 +299,6 @@ static long __must_check guc_mmio_reg_add(struct intel_gt *gt,
>  		    sizeof(entry), guc_mmio_reg_cmp))
>  		return 0;
>  
> -	/*
> -	 * The GuC doesn't have a default steering, so we need to explicitly
> -	 * steer all registers that need steering. However, we do not keep track
> -	 * of all the steering ranges, only of those that have a chance of using
> -	 * a non-default steering from the i915 pov. Instead of adding such
> -	 * tracking, it is easier to just program the default steering for all
> -	 * regs that don't need a non-default one.
> -	 */
> -	intel_gt_mcr_get_nonterminated_steering(gt, reg, &group, &inst);
> -	entry.flags |= GUC_REGSET_STEERING(group, inst);
> -
>  	slot = __mmio_reg_add(regset, &entry);
>  	if (IS_ERR(slot))
>  		return PTR_ERR(slot);
> @@ -335,6 +316,38 @@ static long __must_check guc_mmio_reg_add(struct intel_gt *gt,
>  
>  #define GUC_MMIO_REG_ADD(gt, regset, reg, masked) \
>  	guc_mmio_reg_add(gt, \
> +			 regset, \
> +			 i915_mmio_reg_offset(reg), \
> +			 (masked) ? GUC_REGSET_MASKED : 0)
> +
> +#define GUC_REGSET_STEERING(group, instance) ( \
> +	FIELD_PREP(GUC_REGSET_STEERING_GROUP, (group)) | \
> +	FIELD_PREP(GUC_REGSET_STEERING_INSTANCE, (instance)) | \
> +	GUC_REGSET_NEEDS_STEERING \
> +)
> +
> +static long __must_check guc_mcr_reg_add(struct intel_gt *gt,
> +					 struct temp_regset *regset,
> +					 i915_reg_t reg, u32 flags)
> +{
> +	u8 group, inst;
> +
> +	/*
> +	 * The GuC doesn't have a default steering, so we need to explicitly
> +	 * steer all registers that need steering. However, we do not keep track
> +	 * of all the steering ranges, only of those that have a chance of using
> +	 * a non-default steering from the i915 pov. Instead of adding such
> +	 * tracking, it is easier to just program the default steering for all
> +	 * regs that don't need a non-default one.
> +	 */
> +	intel_gt_mcr_get_nonterminated_steering(gt, reg, &group, &inst);
> +	flags |= GUC_REGSET_STEERING(group, inst);
> +
> +	return guc_mmio_reg_add(gt, regset, i915_mmio_reg_offset(reg), flags);
> +}
> +
> +#define GUC_MCR_REG_ADD(gt, regset, reg, masked) \
> +	guc_mcr_reg_add(gt, \
>  			 regset, \
>  			 (reg), \
>  			 (masked) ? GUC_REGSET_MASKED : 0)
> @@ -375,7 +388,7 @@ static int guc_mmio_regset_init(struct temp_regset *regset,
>  	/* add in local MOCS registers */
>  	for (i = 0; i < LNCFCMOCS_REG_COUNT; i++)
>  		if (GRAPHICS_VER_FULL(engine->i915) >= IP_VER(12, 50))
> -			ret |= GUC_MMIO_REG_ADD(gt, regset, XEHP_LNCFCMOCS(i), false);
> +			ret |= GUC_MCR_REG_ADD(gt, regset, XEHP_LNCFCMOCS(i), false);
>  		else
>  			ret |= GUC_MMIO_REG_ADD(gt, regset, GEN9_LNCFCMOCS(i), false);
>  
> -- 
> 2.37.3
> 

  reply	other threads:[~2022-10-17 16:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 23:02 [Intel-gfx] [PATCH v3 00/14] Explicit MCR handling and MTL steering Matt Roper
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 01/14] drm/i915/gen8: Create separate reg definitions for new MCR registers Matt Roper
2022-10-17 16:49   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 02/14] drm/i915/xehp: " Matt Roper
2022-10-17 16:49   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 03/14] drm/i915/gt: Drop a few unused register definitions Matt Roper
2022-10-17 16:50   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 04/14] drm/i915/gt: Correct prefix on a few registers Matt Roper
2022-10-17 16:51   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 05/14] drm/i915/gt: Add intel_gt_mcr_multicast_rmw() operation Matt Roper
2022-10-17 16:51   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 06/14] drm/i915/xehp: Check for faults on primary GAM Matt Roper
2022-10-17 16:52   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 07/14] drm/i915/gt: Add intel_gt_mcr_wait_for_reg_fw() Matt Roper
2022-10-17 16:52   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 08/14] drm/i915: Define MCR registers explicitly Matt Roper
2022-10-17 16:53   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 09/14] drm/i915/gt: Always use MCR functions on multicast registers Matt Roper
2022-10-17 16:53   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 10/14] drm/i915/guc: Handle save/restore of MCR registers explicitly Matt Roper
2022-10-17 16:54   ` Balasubramani Vivekanandan [this message]
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 11/14] drm/i915/gt: Add MCR-specific workaround initializers Matt Roper
2022-10-17 16:54   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 12/14] drm/i915: Define multicast registers as a new type Matt Roper
2022-10-17 16:59   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 13/14] drm/i915/xelpg: Add multicast steering Matt Roper
2022-10-17 17:01   ` Balasubramani Vivekanandan
2022-10-14 23:02 ` [Intel-gfx] [PATCH v3 14/14] drm/i915/xelpmp: Add multicast steering for media GT Matt Roper
2022-10-17 17:02   ` Balasubramani Vivekanandan
2022-10-14 23:20 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Explicit MCR handling and MTL steering (rev4) Patchwork
2022-10-14 23:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-14 23:40 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-15  1:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-17 16:17   ` Matt Roper
2022-10-17 17:40     ` Matt Roper
2022-10-17 18:10     ` Vudum, Lakshminarayana

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=Y02IwZHnyKt0lnwe@bala-ubuntu \
    --to=balasubramani.vivekanandan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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