aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-11-04 12:21:30 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-11-11 17:51:44 -0500
commit0f9b91c754b7244d3a7345df88c4384f0eb0dd17 (patch)
tree3a4feddfd1b3f1e8bce1fcb095dc1d243d839e82
parent009946f89b7795699848a922fc2f7804390017d9 (diff)
drm/i915: flush system agent TLBs on SNB
This allows us to map the PTEs WC. I've not done thorough testing or performance measurements with this patch, but it should be decent. This is based on a patch from Jesse with the original commit message > I've only lightly tested this so far, but the corruption seems to be > gone if I write the GFX_FLSH_CNTL reg after binding an object. This > register should control the TLB for the system agent, which is what CPU > mapped objects will go through. It has been updated for the new AGP-less code by me, and included with it is feedback from the original patch. v2: Updated to reflect paranoia on pte updates/register posting reads. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Reviewed-by [v1]: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c11
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 814ed3ed7790..a3e509a71655 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -379,6 +379,13 @@ static void gen6_ggtt_bind_object(struct drm_i915_gem_object *obj,
379 */ 379 */
380 if (i != 0) 380 if (i != 0)
381 WARN_ON(readl(&gtt_entries[i-1]) != pte_encode(dev, addr, level)); 381 WARN_ON(readl(&gtt_entries[i-1]) != pte_encode(dev, addr, level));
382
383 /* This next bit makes the above posting read even more important. We
384 * want to flush the TLBs only after we're certain all the PTE updates
385 * have finished.
386 */
387 I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
388 POSTING_READ(GFX_FLSH_CNTL_GEN6);
382} 389}
383 390
384void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj, 391void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj,
@@ -589,8 +596,8 @@ int i915_gem_gtt_init(struct drm_device *dev)
589 goto err_out; 596 goto err_out;
590 } 597 }
591 598
592 dev_priv->mm.gtt->gtt = ioremap(gtt_bus_addr, 599 dev_priv->mm.gtt->gtt = ioremap_wc(gtt_bus_addr,
593 dev_priv->mm.gtt->gtt_total_entries * sizeof(gtt_pte_t)); 600 dev_priv->mm.gtt->gtt_total_entries * sizeof(gtt_pte_t));
594 if (!dev_priv->mm.gtt->gtt) { 601 if (!dev_priv->mm.gtt->gtt) {
595 DRM_ERROR("Failed to map the gtt page table\n"); 602 DRM_ERROR("Failed to map the gtt page table\n");
596 teardown_scratch_page(dev); 603 teardown_scratch_page(dev);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index e62b347dc049..d55c49642c68 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -694,6 +694,8 @@
694#define CM0_RC_OP_FLUSH_DISABLE (1<<0) 694#define CM0_RC_OP_FLUSH_DISABLE (1<<0)
695#define BB_ADDR 0x02140 /* 8 bytes */ 695#define BB_ADDR 0x02140 /* 8 bytes */
696#define GFX_FLSH_CNTL 0x02170 /* 915+ only */ 696#define GFX_FLSH_CNTL 0x02170 /* 915+ only */
697#define GFX_FLSH_CNTL_GEN6 0x101008
698#define GFX_FLSH_CNTL_EN (1<<0)
697#define ECOSKPD 0x021d0 699#define ECOSKPD 0x021d0
698#define ECO_GATING_CX_ONLY (1<<3) 700#define ECO_GATING_CX_ONLY (1<<3)
699#define ECO_FLIP_DONE (1<<0) 701#define ECO_FLIP_DONE (1<<0)