[PATCH 2/2] drm/i915: Reject an attempt to create a GGTT vma larger than the GTT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For accessing large objects through the global GTT we enforce the use of
partial views, and sanity check that the vma->size doesn't overflow and
fits within the address space. To prevent 4GiB triggering the assert,
catch the attempt to create the full sized vma early.

Testcase: igt/gem_exec_reloc/gtt-32
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b2f8ac1386a2..99ff686dd640 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3679,6 +3679,12 @@ i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
 
 	lockdep_assert_held(&obj->base.dev->struct_mutex);
 
+	/* Disallow a single VMA to occupy the entire GGTT, and catch any
+	 * attempt to create a normal VMA larger than the GGTT.
+	 */
+	if (!view && obj->base.size >= vm->total)
+		return ERR_PTR(-ENOSPC);
+
 	vma = i915_vma_instance(obj, vm, view);
 	if (IS_ERR(vma))
 		return vma;
-- 
2.11.0

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux