Commit b3bb8288 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert all sg are initialised in fake_dma_object for selftests

Double check that we allocated the right amount of scatterlist elements
for our obj->size.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170225181122.4788-1-chris@chris-wilson.co.uk
parent 91e32157
...@@ -62,12 +62,14 @@ fake_get_pages(struct drm_i915_gem_object *obj) ...@@ -62,12 +62,14 @@ fake_get_pages(struct drm_i915_gem_object *obj)
for (sg = pages->sgl; sg; sg = sg_next(sg)) { for (sg = pages->sgl; sg; sg = sg_next(sg)) {
unsigned long len = min_t(typeof(rem), rem, BIT(31)); unsigned long len = min_t(typeof(rem), rem, BIT(31));
GEM_BUG_ON(!len);
sg_set_page(sg, pfn_to_page(PFN_BIAS), len, 0); sg_set_page(sg, pfn_to_page(PFN_BIAS), len, 0);
sg_dma_address(sg) = page_to_phys(sg_page(sg)); sg_dma_address(sg) = page_to_phys(sg_page(sg));
sg_dma_len(sg) = len; sg_dma_len(sg) = len;
rem -= len; rem -= len;
} }
GEM_BUG_ON(rem);
obj->mm.madv = I915_MADV_DONTNEED; obj->mm.madv = I915_MADV_DONTNEED;
return pages; return pages;
......
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