From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH] drm/i915: Extend BIOS stolen mem handling to all platform Date: Fri, 12 Sep 2014 12:23:14 +0300 Message-ID: <20140912092314.GL4193@intel.com> References: <1410434909-24902-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id DFAFC6E65C for ; Fri, 12 Sep 2014 02:23:27 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1410434909-24902-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Daniel Vetter Cc: Deepak S , Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org On Thu, Sep 11, 2014 at 01:28:29PM +0200, Daniel Vetter wrote: > Based upon a patch from Deepak, but reworked to only apply on gen7+ > and with the logic a bit clarified. > = > Cc: Deepak S > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_gem_stolen.c | 13 +++++++++++-- > drivers/gpu/drm/i915/i915_reg.h | 8 ++++++++ > 2 files changed, 19 insertions(+), 2 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i91= 5/i915_gem_stolen.c > index 21c025a209c0..15d42b3e2029 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -289,6 +289,7 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) > int i915_gem_init_stolen(struct drm_device *dev) > { > struct drm_i915_private *dev_priv =3D dev->dev_private; > + u32 tmp; > int bios_reserved =3D 0; > = > #ifdef CONFIG_INTEL_IOMMU > @@ -308,8 +309,16 @@ int i915_gem_init_stolen(struct drm_device *dev) > DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n", > dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base); > = > - if (IS_VALLEYVIEW(dev)) > - bios_reserved =3D 1024*1024; /* top 1M on VLV/BYT */ > + if (INTEL_INFO(dev)->gen >=3D 8) { > + tmp =3D I915_READ(GEN7_BIOS_RESERVED); > + tmp >>=3D GEN8_BIOS_RESERVED_SHIFT; > + tmp &=3D GEN8_BIOS_RESERVED_SHIFT; ^^^^^ MASK The docs are a bit confusing on this topic, but othwewise this seems to be OK wrt. most of the docs. So with that one thing fixed: Reviewed-by: Ville Syrj=E4l=E4 > + bios_reserved =3D (1024*1024) << tmp; > + } else if (IS_GEN7(dev)) { > + tmp =3D I915_READ(GEN7_BIOS_RESERVED); > + bios_reserved =3D tmp & GEN7_BIOS_RESERVED_256K ? > + 256*1024 : 1024*1024; > + } > = > if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size)) > return 0; > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_= reg.h > index 15c0eaa9f97f..eb1430974a9a 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -143,6 +143,14 @@ > #define GAB_CTL 0x24000 > #define GAB_CTL_CONT_AFTER_PAGEFAULT (1<<8) > = > +#define GEN7_BIOS_RESERVED 0x1082C0 > +#define GEN7_BIOS_RESERVED_1M (0 << 5) > +#define GEN7_BIOS_RESERVED_256K (1 << 5) > +#define GEN8_BIOS_RESERVED_SHIFT 7 > +#define GEN7_BIOS_RESERVED_MASK 0x1 > +#define GEN8_BIOS_RESERVED_MASK 0x3 > + > + > /* VGA stuff */ > = > #define VGA_ST01_MDA 0x3ba > -- = > 2.0.1 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Ville Syrj=E4l=E4 Intel OTC