[Intel-gfx] [PATCH 6/9] drm/i915: Add function to determine if a slice has a subslice

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 20 19:20:11 UTC 2019


Quoting Summers, Stuart (2019-08-20 20:01:05)
> On Tue, 2019-08-20 at 11:53 +0100, Chris Wilson wrote:
> > Quoting Stuart Summers (2019-08-19 22:50:00)
> > > Add a new function to determine whether a particular slice
> > > has a given subslice.
> > > 
> > > Signed-off-by: Stuart Summers <stuart.summers at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/gt/intel_sseu.h     | 10 ++++++++++
> > >  drivers/gpu/drm/i915/intel_device_info.c |  9 ++++-----
> > >  2 files changed, 14 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.h
> > > b/drivers/gpu/drm/i915/gt/intel_sseu.h
> > > index 2261d4e7d98b..0ecc1c35a7a1 100644
> > > --- a/drivers/gpu/drm/i915/gt/intel_sseu.h
> > > +++ b/drivers/gpu/drm/i915/gt/intel_sseu.h
> > > @@ -66,6 +66,16 @@ intel_sseu_from_device_info(const struct
> > > sseu_dev_info *sseu)
> > >         return value;
> > >  }
> > >  
> > > +static inline bool
> > > +intel_sseu_has_subslice(const struct sseu_dev_info *sseu, int
> > > slice,
> > > +                       int subslice)
> > > +{
> > > +       u8 mask = sseu->subslice_mask[slice * sseu->ss_stride +
> > > +                                     subslice / BITS_PER_BYTE];
> > > +
> > 
> > Suggestion:
> > 
> >       GEM_BUG_ON(subslice >= sseu->ss_slice);
> 
> Thanks Chris and makes sense. I think this should  instead be (ss /
> BITS_PER_BYTE >= ss_stride).

Don't assume I put more thought into than dropping a hint to catch
programmer errors that would lead to UB. :)

> I'll post an update hopefully today on this. Let me know if you'd like
> me to drop your R-B with the above change.

If CI doesn't explode, keep the r-b ;)
-Chris


More information about the Intel-gfx mailing list