[PATCH 2/2] cachelines

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 21 20:49:24 UTC 2018


---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index 56d3e52c6580..e22af7388cad 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -361,7 +361,7 @@ static int gpu_fill(struct drm_i915_gem_object *obj,
 	 */
 	batch = gpu_fill_dw(vma,
 			    (dw * real_page_count(obj)) << PAGE_SHIFT |
-			    (dw * sizeof(u32)),
+			    offset_in_page(dw * (CACHELINE_BYTES + sizeof(u32))),
 			    real_page_count(obj),
 			    dw);
 	if (IS_ERR(batch)) {
@@ -459,9 +459,11 @@ static int cpu_check(struct drm_i915_gem_object *obj, unsigned int max)
 			drm_clflush_virt_range(map, PAGE_SIZE);
 
 		for (m = 0; m < max; m++) {
-			if (map[m] != m) {
+			u32 x = map[offset_in_page(m * (CACHELINE_BYTES + sizeof(*map))) / sizeof(*map)];
+
+			if (x != m) {
 				pr_err("Invalid value at page %d, offset %d: found %x expected %x\n",
-				       n, m, map[m], m);
+				       n, m, x, m);
 				err = -EINVAL;
 				goto out_unmap;
 			}
-- 
2.19.1



More information about the Intel-gfx-trybot mailing list