Re: [Intel-gfx] [PATCH 1/1] drm/i915/mtl: enable local stolen memory

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

 



On Tue, Sep 20, 2022 at 06:57:46PM +0200, Andi Shyti wrote:
> Hi Aravind,
> 
> > +static int get_mtl_gms_size(struct intel_uncore *uncore)
> > +{
> > +	u16 ggc, gms;
> > +
> > +	ggc = intel_uncore_read16(uncore, _MMIO(0x108040));
> > +
> > +	/* check GGMS, should be fixed 0x3 (8MB) */
> > +	if ((ggc & 0xc0) != 0xc0)
> > +		return -EIO;
> > +
> > +	/* return valid GMS value, -EIO if invalid */
> > +	gms = ggc >> 8;
> > +	switch (gms) {
> > +	case 0x0 ... 0x10:
> > +		return gms * 32;
> > +	case 0x20:
> > +		return 1024;
> > +	case 0x30:
> > +		return 1536;
> > +	case 0x40:
> > +		return 2048;
> > +	case 0xf0 ... 0xfe:
> 
> just a bit puzzled by the fact that case ranges are not standard
> and are supported only by GCC, unless, of course, I miss
> something. Do we still want to use them as they are widely used
> around the kernel?

i915 already has 17 other uses of this notation and the DRM subsystem in
general has about 50 today.  So it's not super common, but I think it
should be okay to use.  I believe clang supports this language extension
as well and the coding style doc doesn't say anything one way or the
other.


Matt

> 
> Andi
> 
> > +		return (gms - 0xf0 + 1) * 4;
> > +	default:
> > +		return -EIO;
> > +	}
> > +}

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux