Re: [PATCH 05/11] drm/i915/gtt: Compute the radix for gen8 page table levels

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

 



Quoting Mika Kuoppala (2019-07-10 10:24:48)
> Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> writes:
> 
> > The radix levels of each page directory are easily determined so replace
> > the numerous hardcoded constants with precomputed derived constants.
> >
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 39 +++++++++++++++++++++++++++++
> >  1 file changed, 39 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 2fc60e8acd9a..271305705c1c 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -868,6 +868,45 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)
> >       return 0;
> >  }
> >  
> > +/* Index shifts into the pagetable are offset by GEN8_PTE_SHIFT [12] */
> > +#define gen8_pd_shift(lvl) ((lvl) * ilog2(I915_PDES))
> > +#define gen8_pd_index(i, lvl) i915_pde_index((i), gen8_pd_shift(lvl))
> > +#define __gen8_pte_shift(lvl) (GEN8_PTE_SHIFT + gen8_pd_shift(lvl))
> > +#define __gen8_pte_index(a, lvl) i915_pde_index((a), __gen8_pte_shift(lvl))
> > +
> > +static inline unsigned int
> > +gen8_pd_range(u64 addr, u64 end, int lvl, unsigned int *idx)
> > +{
> > +     const int shift = gen8_pd_shift(lvl);
> > +     const u64 mask = ~0ull << gen8_pd_shift(lvl + 1);
> > +
> > +     GEM_BUG_ON(addr >= end);
> 
> GEM_BUG_ON(!lvl) ?

It worked for !lvl so I left it out.

> > +     end += ~mask >> gen8_pd_shift(1);
> > +
> > +     *idx = i915_pde_index(addr, shift);
> 
> As I see no usage of this macro yet, this looks
> wrong as the shift doesn't include the pte shift?

Why would it since I'm not working on page addresses but pd indices? :-p
-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