From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Disable stolen memory when DMAR is active Date: Wed, 5 Mar 2014 16:17:17 +0100 Message-ID: <20140305151717.GF17001@phenom.ffwll.local> References: <1393589642-9992-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by gabe.freedesktop.org (Postfix) with ESMTP id ED141FA62C for ; Wed, 5 Mar 2014 07:17:23 -0800 (PST) Received: by mail-ee0-f47.google.com with SMTP id b15so524613eek.6 for ; Wed, 05 Mar 2014 07:17:21 -0800 (PST) Content-Disposition: inline In-Reply-To: <1393589642-9992-1-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Feb 28, 2014 at 12:14:02PM +0000, Chris Wilson wrote: > We have reports of heavy screen corruption if we try to use the stolen > memory reserved by the BIOS whilst the DMA-Remapper is active. This > quirk may be only specific to a few machines or BIOSes, but first lets > apply the big hammer and always disable use of stolen memory when DMAR > is active. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68535 > Signed-off-by: Chris Wilson > Cc: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_gem_stolen.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c > index 984ada1b0084..13a849afe479 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -325,11 +325,25 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) > drm_mm_takedown(&dev_priv->mm.stolen); > } > > +static bool need_dmar_wa(struct drm_device *dev) > +{ > +#ifdef CONFIG_INTEL_IOMMU > + if (INTEL_INFO(dev)->gen >= 6 && intel_iommu_gfx_mapped) Why the gen check in here? Without that we could just check intel_iommu_gfx_mapped and shovel the #ifdef into stolen init. No need to spread it out like that imo. -Daniel > + return true; > +#endif > + return false; > +} > + > int i915_gem_init_stolen(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > struct resource *r; > > + if (need_dmar_wa(dev)) { > + DRM_INFO("DMAR active, disabling use of stolen memory\n"); > + return 0; > + } > + > if (dev_priv->gtt.stolen_size == 0) > return 0; > > -- > 1.9.0 > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch