From: Jesse Barnes Subject: [PATCH] drm/i915: set cache sharing policy to max sharing on SNB+ Date: Fri, 1 Jul 2011 16:35:07 -0700 Message-ID: <1309563307-5480-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy3-pub.bluehost.com (oproxy3-pub.bluehost.com [69.89.21.8]) by gabe.freedesktop.org (Postfix) with SMTP id 2D4519E79E for ; Fri, 1 Jul 2011 16:35:15 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org By default, the GPU will only share a very small portion of the CPU cache. With this change, both the GPU and CPU will have full access to the cache, which should help (sometimes a lot) in most cases. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_display.c | 7 +++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 4a446b1..eac59f1 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -78,6 +78,11 @@ #define GRDOM_RENDER (1<<2) #define GRDOM_MEDIA (3<<2) +#define GEN6_MBCUNIT_CFG 0x900c /* for LLC config */ +#define GEN6_MBC_LLC_CFG_MASK (3<<21) +#define GEN6_MBC_LLC_CFG_FULL (1<<21) /* full sharing of 16/16ths of the cache */ +#define GEN6_MBC_LLC_CFG_MIN (3<<21) /* only 1/16th of the cache is shared */ + #define GEN6_GDRST 0x941c #define GEN6_GRDOM_FULL (1 << 0) #define GEN6_GRDOM_RENDER (1 << 1) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 823b8d9..0ed4ed2 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7279,6 +7279,7 @@ void gen6_update_ring_freq(struct drm_i915_private *dev_priv) int min_freq = 15; int gpu_freq, ia_freq, max_ia_freq; int scaling_factor = 180; + u32 mbccfg; max_ia_freq = cpufreq_quick_get_max(0); /* @@ -7293,6 +7294,12 @@ void gen6_update_ring_freq(struct drm_i915_private *dev_priv) mutex_lock(&dev_priv->dev->struct_mutex); + /* Update the cache sharing policy here as well */ + mbccfg = I915_READ(GEN6_MBCUNIT_CFG); + mbccfg &= ~GEN6_MBC_LLC_CFG_MASK; + mbccfg |= GEN6_MBC_LLC_CFG_FULL; + I915_WRITE(GEN6_MBCUNIT_CFG, mbccfg); + /* * For each potential GPU frequency, load a ring frequency we'd like * to use for memory access. We do this by specifying the IA frequency -- 1.7.4.1