On Thu, May 02, 2024 at 03:14:22PM +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > The name 'HAS_REGION()' suggests we are checking for a single > region, so seem more sensible to pass in the region ID rather > than a bitmask. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > --- > drivers/gpu/drm/i915/gt/intel_gt.c | 2 +- > drivers/gpu/drm/i915/i915_drv.h | 4 ++-- > drivers/gpu/drm/i915/intel_memory_region.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c > index 5a7ecf823ae6..626b166e67ef 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c > @@ -105,7 +105,7 @@ static int intel_gt_probe_lmem(struct intel_gt *gt) > > intel_memory_region_set_name(mem, "local%u", mem->instance); > > - GEM_BUG_ON(!HAS_REGION(i915, BIT(id))); > + GEM_BUG_ON(!HAS_REGION(i915, id)); > GEM_BUG_ON(i915->mm.regions[id]); > i915->mm.regions[id] = mem; > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index ee0d7d5f135d..5cae1fe42c2a 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -715,8 +715,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, > */ > #define HAS_64K_PAGES(i915) (INTEL_INFO(i915)->has_64k_pages) > > -#define HAS_REGION(i915, i) (INTEL_INFO(i915)->memory_regions & (i)) > -#define HAS_LMEM(i915) HAS_REGION(i915, REGION_LMEM) > +#define HAS_REGION(i915, id) (INTEL_INFO(i915)->memory_regions & BIT(id)) > +#define HAS_LMEM(i915) HAS_REGION(i915, INTEL_REGION_LMEM_0) > > #define HAS_EXTRA_GT_LIST(i915) (INTEL_INFO(i915)->extra_gt_list) > > diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c > index 52d998e5c21a..172dfa7c3588 100644 > --- a/drivers/gpu/drm/i915/intel_memory_region.c > +++ b/drivers/gpu/drm/i915/intel_memory_region.c > @@ -332,7 +332,7 @@ int intel_memory_regions_hw_probe(struct drm_i915_private *i915) > struct intel_memory_region *mem = ERR_PTR(-ENODEV); > u16 type, instance; > > - if (!HAS_REGION(i915, BIT(i))) > + if (!HAS_REGION(i915, i)) > continue; > > type = intel_region_map[i].class; > -- > 2.43.2 >