Add an additional comparison to check the entire vma created in the mappable region of the global GTT against the one in the unmappable range. Further test with an assert_partial as well to ensure the VMA corresponds to the original object's backing store. Signed-off-by: Abdiel Janulgue <abdiel.janulgue@xxxxxxxxxxxxxxx> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/selftests/i915_vma.c | 44 ++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c index ea48bac..10cf4df 100644 --- a/drivers/gpu/drm/i915/selftests/i915_vma.c +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c @@ -554,6 +554,30 @@ static bool assert_partial(struct drm_i915_gem_object *obj, return true; } +static bool assert_vma_compare(struct i915_vma *vma1, struct i915_vma *vma2) +{ + struct sgt_iter sgt; + dma_addr_t dma; + unsigned long offset = 0; + + for_each_sgt_dma(dma, sgt, vma1->pages) { + dma_addr_t src; + + src = sg_dma_address(vma2->pages->sgl) + + (offset << PAGE_SHIFT); + + if (src != dma) { + pr_err("VMA comparison failed. DMA mismatch for partial " + "page offset %lu\n", offset); + return false; + } + + offset++; + } + + return true; +} + static bool assert_pin(struct i915_vma *vma, struct i915_ggtt_view *view, u64 size, @@ -621,7 +645,7 @@ static int igt_vma_partial(void *arg) { }, }, *p; unsigned int sz, offset; - struct i915_vma *vma; + struct i915_vma *vma, *vma_unmapped = NULL; int err = -ENOMEM; /* @@ -660,6 +684,8 @@ static int igt_vma_partial(void *arg) err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH); if (err) goto out_object; + + vma_unmapped = vma; } nvma = 0; @@ -748,6 +774,22 @@ static int igt_vma_partial(void *arg) goto out_object; } + if (!assert_partial(obj, vma, 0, npages)) { + pr_err("(%s) Inconsistent partial pages for (offset=%d, size=%d)\n", + p->name, offset, sz); + err = -EINVAL; + goto out_object; + } + + if (vma_unmapped) { + if (!assert_vma_compare(vma, vma_unmapped)) { + pr_err("(%s) Inconsistent vma from unmapped region\n", + p->name); + err = -EINVAL; + goto out_object; + } + } + i915_vma_unpin(vma); } } -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx