[Intel-gfx] [PATCH 4/7] drm/i915/gt: Allocate i915_fence_reg array

Chris Wilson chris at chris-wilson.co.uk
Mon Mar 16 10:23:39 UTC 2020


Quoting Mika Kuoppala (2020-03-16 07:29:36)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > Since the number of fence regs can vary dramactically between platforms,
> > allocate the array on demand so we don't waste as much space.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/gt/intel_ggtt.c         |  6 ++++--
> >  drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c | 10 ++++++++++
> >  drivers/gpu/drm/i915/gt/intel_ggtt_fencing.h |  1 +
> >  drivers/gpu/drm/i915/gt/intel_gtt.h          |  5 +++--
> >  drivers/gpu/drm/i915/i915_vma.h              |  1 +
> >  5 files changed, 19 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> > index bde4f64a41f7..8fcf14372d7a 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> > @@ -698,11 +698,13 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)
> >   */
> >  void i915_ggtt_driver_release(struct drm_i915_private *i915)
> >  {
> > +     struct i915_ggtt *ggtt = &i915->ggtt;
> >       struct pagevec *pvec;
> >  
> > -     fini_aliasing_ppgtt(&i915->ggtt);
> > +     fini_aliasing_ppgtt(ggtt);
> >  
> > -     ggtt_cleanup_hw(&i915->ggtt);
> > +     intel_ggtt_fini_fences(ggtt);
> > +     ggtt_cleanup_hw(ggtt);
> >  
> >       pvec = &i915->mm.wc_stash.pvec;
> >       if (pvec->nr) {
> > diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
> > index 94af75673a58..b6ba68c42546 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
> > @@ -857,6 +857,11 @@ void intel_ggtt_init_fences(struct i915_ggtt *ggtt)
> >       if (intel_vgpu_active(i915))
> >               num_fences = intel_uncore_read(uncore,
> >                                              vgtif_reg(avail_rs.fence_num));
> > +     ggtt->fence_regs = kcalloc(num_fences,
> > +                                sizeof(*ggtt->fence_regs),
> > +                                GFP_KERNEL);
> > +     if (!ggtt->fence_regs)
> > +             num_fences = 0;
> 
> So unlikely and easily shown in other debug flow that does
> not warrant an err?

Yeah, we get a warn already and it /should/ not be fatal. We should be
able to bring the display up.
-Chris


More information about the Intel-gfx mailing list