All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Intel GFX" <intel-gfx@lists.freedesktop.org>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"DRI Devel" <dri-devel@lists.freedesktop.org>,
	"Andi Shyti" <andi.shyti@linux.intel.com>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915: Rename gt to gt0
Date: Sun, 21 Nov 2021 13:35:32 +0100	[thread overview]
Message-ID: <YZo9FDLwSL52DeeE@intel.intel> (raw)
In-Reply-To: <163715857341.11567.6516227738264680366@build.alporthouse.com>

Hi Chris,

> > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > @@ -817,7 +817,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
> >          * maximum clocks following a vblank miss (see do_rps_boost()).
> >          */
> >         if (!state->rps_interactive) {
> > -               intel_rps_mark_interactive(&dev_priv->gt.rps, true);
> > +               intel_rps_mark_interactive(&dev_priv->gt0.rps, true);
> 
> This should be across all gt, so probably wants a fresh interface that
> takes i915 and does for_each_gt in a later patch. (Since we could be
> rendering on a remote tile to present on a display.)

To make it more generic this can be done by adding in rps a:

  /* the original intel_rps_mark_interactive */
  intel_rps_mark_interactive_gt(struct intel_rps *rps, bool interactive)
  {
  	...
  }
  
  intel_rps_mark_interactive(struct drm_i915_private *i915, bool interactive)
  {
  	for_each_gt(...)
  		intel_rps_mark_interactive_gt(...)
  }

but I think this should go on a different patch.

> >                 state->rps_interactive = true;
> >         }
> >  
> > @@ -851,7 +851,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
> >                 return;
> >  
> >         if (state->rps_interactive) {
> > -               intel_rps_mark_interactive(&dev_priv->gt.rps, false);
> > +               intel_rps_mark_interactive(&dev_priv->gt0.rps, false);
> >                 state->rps_interactive = false;
> >         }
> >  
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 0ceee8ac66717..d4fcd8f236476 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -838,7 +838,7 @@ __intel_display_resume(struct drm_device *dev,
> >  static bool gpu_reset_clobbers_display(struct drm_i915_private *dev_priv)
> >  {
> >         return (INTEL_INFO(dev_priv)->gpu_reset_clobbers_display &&
> > -               intel_has_gpu_reset(&dev_priv->gt));
> > +               intel_has_gpu_reset(&dev_priv->gt0));
> 
> All these display consumers probably want to use
> dev_priv->ggtt->vm.gt, since the scanout capable GGTT would seem to be
> the defining feature.
> 
> to_scanout_gt(i915) ?

OK

> >  static bool pxp_is_borked(struct drm_i915_gem_object *obj)
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > index ebd775cb1661c..c62253d0af044 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > @@ -237,7 +237,7 @@ static int proto_context_set_persistence(struct drm_i915_private *i915,
> >                  * colateral damage, and we should not pretend we can by
> >                  * exposing the interface.
> >                  */
> > -               if (!intel_has_reset_engine(&i915->gt))
> > +               if (!intel_has_reset_engine(&i915->gt0))
> >                         return -ENODEV;
> 
> Prep for all gt. A lot of these need an all-gt interface so we don't
> have for_each_gt spread all other the place.

agree... I think, though, this should go in a different patch.

> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > index ef22d4ed66ad6..69ad407eb15f3 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > @@ -166,7 +166,7 @@ static struct dma_fence *i915_ttm_accel_move(struct ttm_buffer_object *bo,
> >         enum i915_cache_level src_level, dst_level;
> >         int ret;
> >  
> > -       if (!i915->gt.migrate.context || intel_gt_is_wedged(&i915->gt))
> > +       if (!i915->gt0.migrate.context || intel_gt_is_wedged(&i915->gt0))
> 
> This should already be looking at lmem->gt

Thanks... I will note this down for a different patch, as well.

> > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > index 8f8bea08e734d..176ea5c7d422f 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > @@ -116,7 +116,7 @@ static void set_scheduler_caps(struct drm_i915_private *i915)
> >                         disabled |= (I915_SCHEDULER_CAP_ENABLED |
> >                                      I915_SCHEDULER_CAP_PRIORITY);
> >  
> > -               if (intel_uc_uses_guc_submission(&i915->gt.uc))
> > +               if (intel_uc_uses_guc_submission(&i915->gt0.uc))
> 
> This shouldn't be looking at gt at all, but if it must, that information
> must be coming via engine->gt. Kind of renders the mapping moot
> currently.

OK

> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> > index 07ff7ba7b2b71..63089e671a242 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> > @@ -2302,7 +2302,7 @@ unsigned long i915_read_mch_val(void)
> >                 return 0;
> >  
> >         with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
> > -               struct intel_ips *ips = &i915->gt.rps.ips;
> > +               struct intel_ips *ips = &i915->gt0.rps.ips;
> 
> Make mchdev_get() return the gt or rps, at the slight cost of making the
> drm_dev_put() more complicated (but can be pushed into a mchdev_put for
> symmetry).

this is also valid, we mchdev_get is returning i915 only for the
runtime_pm. I will keep it for the next refactoring.

> > diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > index a9727447c0379..4bfedc04f5c70 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > @@ -936,7 +936,7 @@ hsw_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
> >  static void
> >  gen9_wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal)
> >  {
> > -       const struct sseu_dev_info *sseu = &i915->gt.info.sseu;
> > +       const struct sseu_dev_info *sseu = &i915->gt0.info.sseu;
> 
> This feels like it should be pulling from uncore->gt, since the MCR is
> across an uncore.

This might need a better refactoring, rather than seeking for the
gt. Because:

  static void                                                 
  gen9_wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal)
  {                                                           
  	const struct sseu_dev_info *sseu = &i915->gt.info.sseu;
  
  		...
  }

  ...

  static void
  gen9_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
  {
          struct drm_i915_private *i915 = gt->i915;
  
          gen9_wa_init_mcr(i915, wal);
  
  		...
  }

I'll check how this has been handled in the multitile adaptation,
but in any case this is argument for a next patch.

> Overall though, rather than introduce bare &i915->gt0, how about pulling in
> the patch for to_gt(i915)?

As we discussed offline, Matt was suggesting to_root_gt() I will
take that idea.

Thanks a lot for your review!
Andi

WARNING: multiple messages have this Message-ID (diff)
From: Andi Shyti <andi.shyti@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Intel GFX" <intel-gfx@lists.freedesktop.org>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"DRI Devel" <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915: Rename gt to gt0
Date: Sun, 21 Nov 2021 13:35:32 +0100	[thread overview]
Message-ID: <YZo9FDLwSL52DeeE@intel.intel> (raw)
In-Reply-To: <163715857341.11567.6516227738264680366@build.alporthouse.com>

Hi Chris,

> > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > @@ -817,7 +817,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,
> >          * maximum clocks following a vblank miss (see do_rps_boost()).
> >          */
> >         if (!state->rps_interactive) {
> > -               intel_rps_mark_interactive(&dev_priv->gt.rps, true);
> > +               intel_rps_mark_interactive(&dev_priv->gt0.rps, true);
> 
> This should be across all gt, so probably wants a fresh interface that
> takes i915 and does for_each_gt in a later patch. (Since we could be
> rendering on a remote tile to present on a display.)

To make it more generic this can be done by adding in rps a:

  /* the original intel_rps_mark_interactive */
  intel_rps_mark_interactive_gt(struct intel_rps *rps, bool interactive)
  {
  	...
  }
  
  intel_rps_mark_interactive(struct drm_i915_private *i915, bool interactive)
  {
  	for_each_gt(...)
  		intel_rps_mark_interactive_gt(...)
  }

but I think this should go on a different patch.

> >                 state->rps_interactive = true;
> >         }
> >  
> > @@ -851,7 +851,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
> >                 return;
> >  
> >         if (state->rps_interactive) {
> > -               intel_rps_mark_interactive(&dev_priv->gt.rps, false);
> > +               intel_rps_mark_interactive(&dev_priv->gt0.rps, false);
> >                 state->rps_interactive = false;
> >         }
> >  
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 0ceee8ac66717..d4fcd8f236476 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -838,7 +838,7 @@ __intel_display_resume(struct drm_device *dev,
> >  static bool gpu_reset_clobbers_display(struct drm_i915_private *dev_priv)
> >  {
> >         return (INTEL_INFO(dev_priv)->gpu_reset_clobbers_display &&
> > -               intel_has_gpu_reset(&dev_priv->gt));
> > +               intel_has_gpu_reset(&dev_priv->gt0));
> 
> All these display consumers probably want to use
> dev_priv->ggtt->vm.gt, since the scanout capable GGTT would seem to be
> the defining feature.
> 
> to_scanout_gt(i915) ?

OK

> >  static bool pxp_is_borked(struct drm_i915_gem_object *obj)
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > index ebd775cb1661c..c62253d0af044 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > @@ -237,7 +237,7 @@ static int proto_context_set_persistence(struct drm_i915_private *i915,
> >                  * colateral damage, and we should not pretend we can by
> >                  * exposing the interface.
> >                  */
> > -               if (!intel_has_reset_engine(&i915->gt))
> > +               if (!intel_has_reset_engine(&i915->gt0))
> >                         return -ENODEV;
> 
> Prep for all gt. A lot of these need an all-gt interface so we don't
> have for_each_gt spread all other the place.

agree... I think, though, this should go in a different patch.

> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > index ef22d4ed66ad6..69ad407eb15f3 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> > @@ -166,7 +166,7 @@ static struct dma_fence *i915_ttm_accel_move(struct ttm_buffer_object *bo,
> >         enum i915_cache_level src_level, dst_level;
> >         int ret;
> >  
> > -       if (!i915->gt.migrate.context || intel_gt_is_wedged(&i915->gt))
> > +       if (!i915->gt0.migrate.context || intel_gt_is_wedged(&i915->gt0))
> 
> This should already be looking at lmem->gt

Thanks... I will note this down for a different patch, as well.

> > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > index 8f8bea08e734d..176ea5c7d422f 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> > @@ -116,7 +116,7 @@ static void set_scheduler_caps(struct drm_i915_private *i915)
> >                         disabled |= (I915_SCHEDULER_CAP_ENABLED |
> >                                      I915_SCHEDULER_CAP_PRIORITY);
> >  
> > -               if (intel_uc_uses_guc_submission(&i915->gt.uc))
> > +               if (intel_uc_uses_guc_submission(&i915->gt0.uc))
> 
> This shouldn't be looking at gt at all, but if it must, that information
> must be coming via engine->gt. Kind of renders the mapping moot
> currently.

OK

> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> > index 07ff7ba7b2b71..63089e671a242 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> > @@ -2302,7 +2302,7 @@ unsigned long i915_read_mch_val(void)
> >                 return 0;
> >  
> >         with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
> > -               struct intel_ips *ips = &i915->gt.rps.ips;
> > +               struct intel_ips *ips = &i915->gt0.rps.ips;
> 
> Make mchdev_get() return the gt or rps, at the slight cost of making the
> drm_dev_put() more complicated (but can be pushed into a mchdev_put for
> symmetry).

this is also valid, we mchdev_get is returning i915 only for the
runtime_pm. I will keep it for the next refactoring.

> > diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > index a9727447c0379..4bfedc04f5c70 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> > @@ -936,7 +936,7 @@ hsw_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
> >  static void
> >  gen9_wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal)
> >  {
> > -       const struct sseu_dev_info *sseu = &i915->gt.info.sseu;
> > +       const struct sseu_dev_info *sseu = &i915->gt0.info.sseu;
> 
> This feels like it should be pulling from uncore->gt, since the MCR is
> across an uncore.

This might need a better refactoring, rather than seeking for the
gt. Because:

  static void                                                 
  gen9_wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal)
  {                                                           
  	const struct sseu_dev_info *sseu = &i915->gt.info.sseu;
  
  		...
  }

  ...

  static void
  gen9_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
  {
          struct drm_i915_private *i915 = gt->i915;
  
          gen9_wa_init_mcr(i915, wal);
  
  		...
  }

I'll check how this has been handled in the multitile adaptation,
but in any case this is argument for a next patch.

> Overall though, rather than introduce bare &i915->gt0, how about pulling in
> the patch for to_gt(i915)?

As we discussed offline, Matt was suggesting to_root_gt() I will
take that idea.

Thanks a lot for your review!
Andi

  parent reply	other threads:[~2021-11-21 12:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 13:34 [PATCH 0/2] More preparation for multi gt patches Andi Shyti
2021-11-17 13:34 ` [Intel-gfx] " Andi Shyti
2021-11-17 13:34 ` [PATCH 1/2] drm/i915: Store backpointer to GT in uncore Andi Shyti
2021-11-17 13:34   ` [Intel-gfx] " Andi Shyti
2021-11-17 13:34 ` [PATCH 2/2] drm/i915: Rename gt to gt0 Andi Shyti
2021-11-17 13:34   ` [Intel-gfx] " Andi Shyti
2021-11-17 14:16   ` Chris Wilson
2021-11-19 17:32     ` Lucas De Marchi
2021-11-19 17:32       ` Lucas De Marchi
2021-11-21 12:35     ` Andi Shyti [this message]
2021-11-21 12:35       ` Andi Shyti
2021-11-17 18:39 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for More preparation for multi gt patches 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=YZo9FDLwSL52DeeE@intel.intel \
    --to=andi.shyti@linux.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=michal.winiarski@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.