Re: [PATCH 2/2] drm/i915/gen9: Calculate edram size

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

 



On Mon, Jan 11, 2016 at 08:50:43AM +0100, Daniel Vetter wrote:
> On Fri, Jan 08, 2016 at 06:58:45PM +0200, Mika Kuoppala wrote:
> > With gen9+ the edram capabilities are defined so
> > that we can calculate the edram (ellc) size accordingly.
> > 
> > Note that there are undefined combinations for some subset of
> > edram capability bits. Return the closest size for undefined indexes.
> > Even if we get it wrong with beginning of future gen enabling, the size
> > information is currently only used for boot message and in debugfs entry.
> > 
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h     | 14 ++++++++++++++
> >  drivers/gpu/drm/i915/intel_uncore.c |  9 +++++----
> >  2 files changed, 19 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index f88b75ec5047..52283c44a0c1 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -6820,6 +6820,20 @@ enum skl_disp_power_wells {
> >  #define    IDIHASHMSK(x)			(((x) & 0x3f) << 16)
> >  #define  HSW_EDRAM_CAP				_MMIO(0x120010)
> >  #define    EDRAM_ENABLED			0x1
> > +#define    EDRAM_NUM_BANKS(cap)			(((cap) >> 1) & 0xf)
> > +#define    __EDRAM_WAYS(cap)			(((cap) >> 5) & 0x7)
> > +#define    EDRAM_NUM_WAYS(cap)			({ \
> > +			int __ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; \
> > +			__ways[__EDRAM_WAYS(cap)]; \
> > +})
> > +#define    __EDRAM_SETS(cap)			(((cap) >> 8) & 0x3)
> > +#define    EDRAM_NUM_SETS(cap)			({ \
> > +			int __sets[4] = { 1, 1, 2, 2 }; \
> > +			__sets[__EDRAM_SETS(cap)]; \
> > +})
> > +#define    EDRAM_SIZE(cap)			(EDRAM_NUM_BANKS(cap) * \
> > +						 EDRAM_NUM_WAYS(cap) * \
> > +						 EDRAM_NUM_SETS(cap))
> 
> Please just make a function out of this, no reason to make it into a
> hard-to-read macro. E.g. gen9_edram_size or whatever is the first gen this
> starts to be valid for.

May I humbly suggest intel_uncore_edram_size_mb() ? ;)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux