aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2018-05-11 05:51:40 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2018-05-13 05:29:18 -0400
commitf79401b477bc22914e4c37ea39c611117bd10b19 (patch)
tree87d02c0acaae33cf28065bd63fc9a5d82d48cf4e
parente896d29a548d04371ce746f7d02a8488ff93d812 (diff)
drm/i915/selftests: scrub 64K
We write all 4K page entries, even when using 64K pages. In order to verify that the HW isn't cheating by using the 4K PTE instead of the 64K PTE, we want to remove all the surplus entries. If the HW skipped the 64K PTE, it will read/write into the scratch page instead - which we detect as missing results during selftests. v2: much improved commentary (Chris) Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Changbin Du <changbin.du@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20180511095140.25590-1-matthew.auld@intel.com
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c21
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.h1
-rw-r--r--drivers/gpu/drm/i915/selftests/huge_pages.c3
3 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c01d6dbe269a..996ab2ad6c45 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1162,6 +1162,27 @@ static void gen8_ppgtt_insert_huge_entries(struct i915_vma *vma,
1162 vaddr[idx.pde] |= GEN8_PDE_IPS_64K; 1162 vaddr[idx.pde] |= GEN8_PDE_IPS_64K;
1163 kunmap_atomic(vaddr); 1163 kunmap_atomic(vaddr);
1164 page_size = I915_GTT_PAGE_SIZE_64K; 1164 page_size = I915_GTT_PAGE_SIZE_64K;
1165
1166 /*
1167 * We write all 4K page entries, even when using 64K
1168 * pages. In order to verify that the HW isn't cheating
1169 * by using the 4K PTE instead of the 64K PTE, we want
1170 * to remove all the surplus entries. If the HW skipped
1171 * the 64K PTE, it will read/write into the scratch page
1172 * instead - which we detect as missing results during
1173 * selftests.
1174 */
1175 if (I915_SELFTEST_ONLY(vma->vm->scrub_64K)) {
1176 u16 i;
1177
1178 encode = pte_encode | vma->vm->scratch_page.daddr;
1179 vaddr = kmap_atomic_px(pd->page_table[idx.pde]);
1180
1181 for (i = 1; i < index; i += 16)
1182 memset64(vaddr + i, encode, 15);
1183
1184 kunmap_atomic(vaddr);
1185 }
1165 } 1186 }
1166 1187
1167 vma->page_sizes.gtt |= page_size; 1188 vma->page_sizes.gtt |= page_size;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 1db0dedb4059..aec4f73574f4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -342,6 +342,7 @@ struct i915_address_space {
342 void (*clear_pages)(struct i915_vma *vma); 342 void (*clear_pages)(struct i915_vma *vma);
343 343
344 I915_SELFTEST_DECLARE(struct fault_attr fault_attr); 344 I915_SELFTEST_DECLARE(struct fault_attr fault_attr);
345 I915_SELFTEST_DECLARE(bool scrub_64K);
345}; 346};
346 347
347#define i915_is_ggtt(V) (!(V)->file) 348#define i915_is_ggtt(V) (!(V)->file)
diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
index d7c8ef8e6764..91c72911be3c 100644
--- a/drivers/gpu/drm/i915/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
@@ -1757,6 +1757,9 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
1757 goto out_unlock; 1757 goto out_unlock;
1758 } 1758 }
1759 1759
1760 if (ctx->ppgtt)
1761 ctx->ppgtt->base.scrub_64K = true;
1762
1760 err = i915_subtests(tests, ctx); 1763 err = i915_subtests(tests, ctx);
1761 1764
1762out_unlock: 1765out_unlock: