Commit b00ddb27 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert that created vma has a whole number of pages

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170119192659.31789-6-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent 44a0ec0d
...@@ -110,6 +110,8 @@ vma_create(struct drm_i915_gem_object *obj, ...@@ -110,6 +110,8 @@ vma_create(struct drm_i915_gem_object *obj,
if (unlikely(vma->size > vm->total)) if (unlikely(vma->size > vm->total))
goto err_vma; goto err_vma;
GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
if (i915_is_ggtt(vm)) { if (i915_is_ggtt(vm)) {
if (unlikely(overflows_type(vma->size, u32))) if (unlikely(overflows_type(vma->size, u32)))
goto err_vma; goto err_vma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment