Re: [PATCH v2 1/8] drm/i915: make local-memory probing a GT operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Matthew Auld (2021-01-26 15:12:52)
> Device local memory is very much a GT thing, therefore it should be the
> responsibility of the GT to setup the device local memory region.
> 
> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>
> Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c          | 29 +++++++++++++++++++++
>  drivers/gpu/drm/i915/gt/intel_gt.h          |  1 +
>  drivers/gpu/drm/i915/gt/intel_region_lmem.c |  3 ++-
>  drivers/gpu/drm/i915/gt/intel_region_lmem.h |  4 +--
>  drivers/gpu/drm/i915/i915_drv.c             |  4 +++
>  drivers/gpu/drm/i915/intel_memory_region.c  |  5 ++--
>  6 files changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index d8e1ab412634..989cd2106b09 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -39,6 +39,35 @@ void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
>         intel_uc_init_early(&gt->uc);
>  }
>  
> +int intel_gt_probe_lmem(struct intel_gt *gt)
> +{
> +       struct drm_i915_private *i915 = gt->i915;
> +       struct intel_memory_region *mem;
> +       int id;
> +       int err;
> +
> +       id = INTEL_REGION_LMEM;
> +       if (!HAS_REGION(i915, id))

GEM_WARN_ON() for CI checking?

Feels like something that should only be duplicated by programming
error, so worth the feedback.

> +               return 0;
> +
> +       mem = intel_gt_setup_fake_lmem(gt);
> +       if (IS_ERR(mem)) {
> +               err = PTR_ERR(mem);
> +               drm_err(&i915->drm,
> +                       "Failed to setup region(%d) type=%d\n",
> +                       err, INTEL_MEMORY_LOCAL);
> +               return err;
> +       }
> +
> +       mem->id = id;
> +       mem->type = INTEL_MEMORY_LOCAL;
> +       mem->instance = 0;
> +
> +       i915->mm.regions[id] = mem;
> +
> +       return 0;
> +}

> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 0037b81d991e..7915d0dc7e16 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -574,6 +574,10 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
>         if (ret)
>                 goto err_ggtt;
>  
> +       ret = intel_gt_probe_lmem(&dev_priv->gt);
> +       if (ret)
> +               goto err_mem_regions;
> +
>         intel_gt_init_hw_early(&dev_priv->gt, &dev_priv->ggtt);

We also need hw_early first as that sets gt->i915 and friends.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux