[PATCH 2/2] cachelines

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 21 21:25:03 UTC 2018


---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 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..f126aba1b619 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,18 +459,22 @@ 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;
 			}
 		}
 
 		for (; m < DW_PER_PAGE; m++) {
-			if (map[m] != STACK_MAGIC) {
+			u32 x = map[offset_in_page(m * (CACHELINE_BYTES + sizeof(*map))) / sizeof(*map)];
+
+			if (x != STACK_MAGIC) {
 				pr_err("Invalid value at page %d, offset %d: found %x expected %x\n",
-				       n, m, map[m], STACK_MAGIC);
+				       n, m, x, STACK_MAGIC);
 				err = -EINVAL;
 				goto out_unmap;
 			}
-- 
2.19.1



More information about the Intel-gfx-trybot mailing list