Re: [Intel-gfx] [PATCH RESEND v7 11/12] drm/i915: Use to_gt() helper for GGTT accesses

Andi Shyti
2021-12-13T18:16:39Z

Hi Matt,

> > diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> > index 95174938b160..2619bb17b6eb 100644
> > --- a/drivers/gpu/drm/i915/i915_driver.c
> > +++ b/drivers/gpu/drm/i915/i915_driver.c
> > @@ -571,6 +571,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
> >
> > i915_perf_init(dev_priv);
> >
> > + intel_gt_init_hw_early(to_gt(dev_priv), to_gt(dev_priv)->ggtt);
>
> intel_gt_init_hw_early is defined as
>
> void intel_gt_init_hw_early(struct intel_gt *gt, struct i915_ggtt *ggtt)
> {
> gt->ggtt = ggtt;
> }
>
> so this call is now essentially doing
>
> to_gt(dev_priv)->ggtt = to_gt(dev_priv)->ggtt
>
> which isn't what you intended. It might be better to just drop the
> function completely and instead assign the gt's ggtt pointer here to a
> drmm_kzalloc() dynamic allocation.

ehehe... yes, I actually had this fixed (in mock device it's
indeed correct), but I might have brought it back by mistake.
Thanks for noticing it.

The next patch removes it.

Andi