[PATCH 77/78] mark-ppgtt

Chris Wilson chris at chris-wilson.co.uk
Sun Jan 1 13:34:06 UTC 2017


---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c7a58575853c..057d87794ee4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -158,6 +158,16 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 		return has_aliasing_ppgtt ? 1 : 0;
 }
 
+/* PDE TLBs are a pain to invalidate on GEN8+. When we modify
+ * the page table structures, we mark them dirty so that
+ * context switching/execlist queuing code takes extra steps
+ * to ensure that tlbs are flushed.
+ */
+static void mark_tlbs_dirty(struct i915_hw_ppgtt *ppgtt)
+{
+	ppgtt->pd_dirty_rings = INTEL_INFO(ppgtt->base.i915)->ring_mask;
+}
+
 static int ppgtt_bind_vma(struct i915_vma *vma,
 			  enum i915_cache_level cache_level,
 			  u32 unused)
@@ -172,6 +182,7 @@ static int ppgtt_bind_vma(struct i915_vma *vma,
 
 	vma->vm->insert_entries(vma->vm, vma->pages, vma->node.start,
 				cache_level, pte_flags);
+	mark_tlbs_dirty(i915_vm_to_ppgtt(vma->vm));
 
 	return 0;
 }
@@ -634,16 +645,6 @@ static int gen8_48b_mm_switch(struct i915_hw_ppgtt *ppgtt,
 	return gen8_write_pdp(req, 0, px_dma(&ppgtt->pml4));
 }
 
-/* PDE TLBs are a pain to invalidate on GEN8+. When we modify
- * the page table structures, we mark them dirty so that
- * context switching/execlist queuing code takes extra steps
- * to ensure that tlbs are flushed.
- */
-static void mark_tlbs_dirty(struct i915_hw_ppgtt *ppgtt)
-{
-	ppgtt->pd_dirty_rings = INTEL_INFO(ppgtt->base.i915)->ring_mask;
-}
-
 /* Removes entries from a single page table, releasing it if it's empty.
  * Caller can use the return value to update higher-level entries.
  */
@@ -1018,7 +1019,6 @@ static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm,
 				struct i915_page_directory_pointer *pdp,
 				    u64 start, u64 length)
 {
-	struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
 	struct i915_page_directory *pd;
 	u64 from = start;
 	u32 pdpe;
@@ -1041,7 +1041,6 @@ static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm,
 			goto unwind;
 	}
 
-	mark_tlbs_dirty(ppgtt);
 	return 0;
 
 unwind:
@@ -1593,7 +1592,6 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
 					 gen6_pte_count(start, length));
 	}
 
-	mark_tlbs_dirty(ppgtt);
 	return 0;
 
 unwind_out:
-- 
2.11.0



More information about the Intel-gfx-trybot mailing list