Blob Blame History Raw
From 641382e9b44fba81a0778e1914ee35b8471121f9 Mon Sep 17 00:00:00 2001
From: Matthew Auld <matthew.auld@intel.com>
Date: Thu, 24 Dec 2020 15:13:58 +0000
Subject: [PATCH] drm/i915: clear the gpu reloc batch
Git-commit: 641382e9b44fba81a0778e1914ee35b8471121f9
Patch-mainline: v5.11-rc3
No-fix: 26ebc511e799f621357982ccc37a7987a56a00f4
References: git-fixes

The reloc batch is short lived but can exist in the user visible ppGTT,
and since it's backed by an internal object, which lacks page clearing,
we should take care to clear it upfront.

Signed-off-by: Matthew Auld <matthew.auld@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/20201224151358.401345-2-matthew.auld@intel.com
Cc: stable@vger.kernel.org
(cherry picked from commit 26ebc511e799f621357982ccc37a7987a56a00f4)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1074,8 +1074,7 @@ static int reloc_gpu_flush(struct reloc_
 		GEM_BUG_ON(cache->rq_size >= obj->base.size / sizeof(u32));
 		cache->rq_cmd[cache->rq_size++] = MI_BATCH_BUFFER_END;
 
-		__i915_gem_object_flush_map(obj,
-					    0, sizeof(u32) * cache->rq_size);
+		i915_gem_object_flush_map(obj);
 		i915_gem_object_unpin_map(obj);
 	}
 
@@ -1315,6 +1314,8 @@ static int __reloc_gpu_alloc(struct i915
 		goto out_pool;
 	}
 
+	memset32(cmd, 0, pool->obj->base.size / sizeof(u32));
+
 	batch = i915_vma_instance(pool->obj, eb->context->vm, NULL);
 	if (IS_ERR(batch)) {
 		err = PTR_ERR(batch);