public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>,
	Intel GFX <intel-gfx@lists.freedesktop.org>,
	DRI Devel <dri-devel@lists.freedesktop.org>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Chris Wilson" <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH v6 01/11] drm/i915: Store backpointer to GT in uncore
Date: Thu, 09 Dec 2021 19:06:02 +0200	[thread overview]
Message-ID: <87ilvx3dz9.fsf@intel.com> (raw)
In-Reply-To: <20211209132512.47241-2-andi.shyti@linux.intel.com>

On Thu, 09 Dec 2021, Andi Shyti <andi.shyti@linux.intel.com> wrote:
> From: Michał Winiarski <michal.winiarski@intel.com>
>
> We now support a per-gt uncore, yet we're not able to infer which GT
> we're operating upon.  Let's store a backpointer for now.
>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c               | 11 +++++++----
>  drivers/gpu/drm/i915/gt/intel_gt.h               |  1 +
>  drivers/gpu/drm/i915/i915_driver.c               |  5 +++--
>  drivers/gpu/drm/i915/intel_uncore.c              |  9 +++++----
>  drivers/gpu/drm/i915/intel_uncore.h              |  3 ++-
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c |  4 ++--
>  drivers/gpu/drm/i915/selftests/mock_uncore.c     |  2 +-
>  7 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index f2422d48be32..f98f0fb21efb 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -25,11 +25,8 @@
>  #include "shmem_utils.h"
>  #include "pxp/intel_pxp.h"
>  
> -void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
> +void __intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
>  {
> -	gt->i915 = i915;
> -	gt->uncore = &i915->uncore;
> -
>  	spin_lock_init(&gt->irq_lock);
>  
>  	INIT_LIST_HEAD(&gt->closed_vma);
> @@ -48,6 +45,12 @@ void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
>  	intel_rps_init_early(&gt->rps);
>  }
>  
> +void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
> +{
> +	gt->i915 = i915;
> +	gt->uncore = &i915->uncore;
> +}
> +
>  int intel_gt_probe_lmem(struct intel_gt *gt)
>  {
>  	struct drm_i915_private *i915 = gt->i915;
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
> index 74e771871a9b..3ace129eb2af 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -35,6 +35,7 @@ static inline struct intel_gt *huc_to_gt(struct intel_huc *huc)
>  }
>  
>  void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915);
> +void __intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915);
>  void intel_gt_init_hw_early(struct intel_gt *gt, struct i915_ggtt *ggtt);
>  int intel_gt_probe_lmem(struct intel_gt *gt);
>  int intel_gt_init_mmio(struct intel_gt *gt);
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index e9125f14b3d1..42ae5a12040d 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -314,8 +314,9 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
>  	intel_device_info_subplatform_init(dev_priv);
>  	intel_step_init(dev_priv);
>  
> +	intel_gt_init_early(&dev_priv->gt, dev_priv);
>  	intel_uncore_mmio_debug_init_early(&dev_priv->mmio_debug);
> -	intel_uncore_init_early(&dev_priv->uncore, dev_priv);
> +	intel_uncore_init_early(&dev_priv->uncore, &dev_priv->gt);
>  
>  	spin_lock_init(&dev_priv->irq_lock);
>  	spin_lock_init(&dev_priv->gpu_error.lock);
> @@ -346,7 +347,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
>  
>  	intel_wopcm_init_early(&dev_priv->wopcm);
>  
> -	intel_gt_init_early(&dev_priv->gt, dev_priv);
> +	__intel_gt_init_early(&dev_priv->gt, dev_priv);

Why double underscores here? It looks like it's supposed to be internal
to intel_gt, not to be called by anyone else.

BR,
Jani.



>  
>  	i915_gem_init_early(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index abdac78d3976..fc25ebf1a593 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -2061,12 +2061,13 @@ void intel_uncore_cleanup_mmio(struct intel_uncore *uncore)
>  }
>  
>  void intel_uncore_init_early(struct intel_uncore *uncore,
> -			     struct drm_i915_private *i915)
> +			     struct intel_gt *gt)
>  {
>  	spin_lock_init(&uncore->lock);
> -	uncore->i915 = i915;
> -	uncore->rpm = &i915->runtime_pm;
> -	uncore->debug = &i915->mmio_debug;
> +	uncore->i915 = gt->i915;
> +	uncore->gt = gt;
> +	uncore->rpm = &gt->i915->runtime_pm;
> +	uncore->debug = &gt->i915->mmio_debug;
>  }
>  
>  static void uncore_raw_init(struct intel_uncore *uncore)
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index d1d17b04e29f..210fe2a71612 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -129,6 +129,7 @@ struct intel_uncore {
>  	void __iomem *regs;
>  
>  	struct drm_i915_private *i915;
> +	struct intel_gt *gt;
>  	struct intel_runtime_pm *rpm;
>  
>  	spinlock_t lock; /** lock is also taken in irq contexts. */
> @@ -217,7 +218,7 @@ u32 intel_uncore_read_with_mcr_steering(struct intel_uncore *uncore,
>  void
>  intel_uncore_mmio_debug_init_early(struct intel_uncore_mmio_debug *mmio_debug);
>  void intel_uncore_init_early(struct intel_uncore *uncore,
> -			     struct drm_i915_private *i915);
> +			     struct intel_gt *gt);
>  int intel_uncore_setup_mmio(struct intel_uncore *uncore);
>  int intel_uncore_init_mmio(struct intel_uncore *uncore);
>  void intel_uncore_prune_engine_fw_domains(struct intel_uncore *uncore,
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index d0e2e61de8d4..eeb632aac4a7 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -175,12 +175,12 @@ struct drm_i915_private *mock_gem_device(void)
>  	mkwrite_device_info(i915)->memory_regions = REGION_SMEM;
>  	intel_memory_regions_hw_probe(i915);
>  
> -	mock_uncore_init(&i915->uncore, i915);
> -
>  	spin_lock_init(&i915->gpu_error.lock);
>  
>  	i915_gem_init__mm(i915);
>  	intel_gt_init_early(&i915->gt, i915);
> +	__intel_gt_init_early(&i915->gt, i915);
> +	mock_uncore_init(&i915->uncore, i915);
>  	atomic_inc(&i915->gt.wakeref.count); /* disable; no hw support */
>  	i915->gt.awake = -ENODEV;
>  
> diff --git a/drivers/gpu/drm/i915/selftests/mock_uncore.c b/drivers/gpu/drm/i915/selftests/mock_uncore.c
> index ca57e4008701..b3790ef137e4 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_uncore.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_uncore.c
> @@ -42,7 +42,7 @@ __nop_read(64)
>  void mock_uncore_init(struct intel_uncore *uncore,
>  		      struct drm_i915_private *i915)
>  {
> -	intel_uncore_init_early(uncore, i915);
> +	intel_uncore_init_early(uncore, &i915->gt);
>  
>  	ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, nop);
>  	ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, nop);

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2021-12-09 17:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 13:25 [Intel-gfx] [PATCH v6 00/11] More preparation for multi gt patches Andi Shyti
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 01/11] drm/i915: Store backpointer to GT in uncore Andi Shyti
2021-12-09 17:06   ` Jani Nikula [this message]
2021-12-09 17:26     ` Andi Shyti
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 02/11] drm/i915: Introduce to_gt() helper Andi Shyti
2021-12-09 23:00   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 03/11] drm/i915/display: Use " Andi Shyti
2021-12-09 23:03   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 04/11] drm/i915/gt: " Andi Shyti
2021-12-09 23:33   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 05/11] drm/i915/gem: " Andi Shyti
2021-12-09 23:50   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 06/11] drm/i915/gvt: " Andi Shyti
2021-12-09 23:51   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 07/11] drm/i915/selftests: " Andi Shyti
2021-12-09 23:55   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 08/11] drm/i915/pxp: " Andi Shyti
2021-12-09 23:59   ` Matt Roper
2021-12-10  0:21     ` Andi Shyti
2021-12-10  0:22       ` Matt Roper
2021-12-10  1:07   ` [Intel-gfx] [PATCH v7 " Andi Shyti
2021-12-10 15:27     ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 09/11] drm/i915: " Andi Shyti
2021-12-10  0:02   ` Matt Roper
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 10/11] drm/i915: Use to_gt() helper for GGTT accesses Andi Shyti
2021-12-10  0:18   ` Matt Roper
2021-12-10  2:11     ` Andi Shyti
2021-12-09 13:25 ` [Intel-gfx] [PATCH v6 11/11] drm/i915: Rename i915->gt to i915->gt0 Andi Shyti
2021-12-10  0:19   ` Matt Roper
2021-12-10 10:25 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for More preparation for multi gt patches (rev7) Patchwork
2021-12-10 10:26 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-12-10 10:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-12-11  3:49 ` [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=87ilvx3dz9.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox