We rely on the VMA being allocated inside the drm_mm and for its alloted
node being large enough to accommodate all the vma->pages.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.a...@gmail.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index a7180d73be43..68a51f8ff1d1 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -327,6 +327,9 @@ int i915_vma_bind(struct i915_vma *vma, enum 
i915_cache_level cache_level,
        u32 vma_flags;
        int ret;
 
+       GEM_BUG_ON(!drm_mm_node_allocated(&vma->node));
+       GEM_BUG_ON(vma->size > vma->node.size);
+
        if (GEM_WARN_ON(flags == 0))
                return -EINVAL;
 
-- 
2.11.0

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

Reply via email to