diff mbox

drm/i915: Sanity check the vma->node prior to binding into the GTT

Message ID 20170224211637.5564-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 24, 2017, 9:16 p.m. UTC
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 <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Matthew Auld Feb. 25, 2017, 12:33 p.m. UTC | #1
On 24 February 2017 at 21:16, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> We rely on the VMA being allocated inside the drm_mm and for its alloted
s/alloted/allotted

> node being large enough to accommodate all the vma->pages.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
Didn't apply cleanly on tip.

Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
diff mbox

Patch

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;