We have always excluded the top-page of the Global GTT to prevent
prefetching past the end of the address space. We have been lax about
applying this restriction to the per-process GTT, but there is no reason
to believe that the hw restriction is any less severe.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 5332d8cb1c53..f18ca11a8da6 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1860,7 +1860,8 @@ static void i915_address_space_init(struct 
i915_address_space *vm,
 {
        i915_gem_timeline_init(dev_priv, &vm->timeline, name);
 
-       drm_mm_init(&vm->mm, 0, vm->total);
+       /* Always exclude the top page to avoid prefetches past the end. */
+       drm_mm_init(&vm->mm, 0, vm->total - I915_GTT_PAGE_SIZE);
        vm->mm.head_node.color = I915_COLOR_UNEVICTABLE;
 
        INIT_LIST_HEAD(&vm->active_list);
@@ -2390,7 +2391,7 @@ static void i915_gtt_color_adjust(const struct 
drm_mm_node *node,
         * GTT boundary.
         */
        node = list_next_entry(node, node_list);
-       if (node->color != color)
+       if (node->allocated && node->color != color)
                *end -= I915_GTT_PAGE_SIZE;
 }
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to