[Intel-gfx] [PATCH] drm/i915: Assert that created vma has a whole number of pages

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 19 13:31:47 UTC 2017


VMA (and their objects) are supposed to composed of whole pages. Add an
assert to catch any invalid construct when we create the VMA.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_vma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 68e66ffb95e8..57243bc68b86 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -108,6 +108,7 @@ vma_create(struct drm_i915_gem_object *obj,
 	}
 
 	GEM_BUG_ON(vma->size > vm->total);
+	GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
 
 	if (i915_is_ggtt(vm)) {
 		GEM_BUG_ON(overflows_type(vma->size, u32));
-- 
2.11.0



More information about the Intel-gfx mailing list