Lines Matching refs:vma

36 static bool assert_vma(struct i915_vma *vma,  in assert_vma()  argument
42 if (vma->vm != ctx->vm) { in assert_vma()
47 if (vma->size != obj->base.size) { in assert_vma()
49 vma->size, obj->base.size); in assert_vma()
53 if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { in assert_vma()
55 vma->ggtt_view.type); in assert_vma()
67 struct i915_vma *vma; in checked_vma_instance() local
70 vma = i915_vma_instance(obj, vm, view); in checked_vma_instance()
71 if (IS_ERR(vma)) in checked_vma_instance()
72 return vma; in checked_vma_instance()
75 if (vma->vm != vm) { in checked_vma_instance()
77 vma->vm, vm); in checked_vma_instance()
81 if (i915_is_ggtt(vm) != i915_vma_is_ggtt(vma)) { in checked_vma_instance()
83 i915_vma_is_ggtt(vma), i915_is_ggtt(vm)); in checked_vma_instance()
87 if (i915_vma_compare(vma, vm, view)) { in checked_vma_instance()
92 if (i915_vma_compare(vma, vma->vm, in checked_vma_instance()
93 i915_vma_is_ggtt(vma) ? &vma->ggtt_view : NULL)) { in checked_vma_instance()
103 return vma; in checked_vma_instance()
118 struct i915_vma *vma; in create_vmas() local
122 vma = checked_vma_instance(obj, vm, NULL); in create_vmas()
124 if (IS_ERR(vma)) in create_vmas()
125 return PTR_ERR(vma); in create_vmas()
127 if (!assert_vma(vma, obj, ctx)) { in create_vmas()
133 err = i915_vma_pin(vma, 0, 0, PIN_USER); in create_vmas()
139 i915_vma_unpin(vma); in create_vmas()
226 static bool assert_pin_valid(const struct i915_vma *vma, in assert_pin_valid() argument
233 if (i915_vma_misplaced(vma, mode->size, 0, mode->flags)) in assert_pin_valid()
240 static bool assert_pin_enospc(const struct i915_vma *vma, in assert_pin_enospc() argument
248 static bool assert_pin_einval(const struct i915_vma *vma, in assert_pin_einval() argument
311 struct i915_vma *vma; in igt_vma_pin1() local
324 vma = checked_vma_instance(obj, &ggtt->vm, NULL); in igt_vma_pin1()
325 if (IS_ERR(vma)) in igt_vma_pin1()
329 err = i915_vma_pin(vma, m->size, 0, m->flags); in igt_vma_pin1()
330 if (!m->assert(vma, m, err)) { in igt_vma_pin1()
336 i915_vma_unpin(vma); in igt_vma_pin1()
342 i915_vma_unpin(vma); in igt_vma_pin1()
343 err = i915_vma_unbind(vma); in igt_vma_pin1()
615 struct i915_vma *vma; in igt_vma_rotate_remap() local
618 vma = checked_vma_instance(obj, vm, &view); in igt_vma_rotate_remap()
619 if (IS_ERR(vma)) { in igt_vma_rotate_remap()
620 err = PTR_ERR(vma); in igt_vma_rotate_remap()
624 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL); in igt_vma_rotate_remap()
633 vma->size != expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
635 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
641 vma->size > expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
643 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
648 if (vma->pages->nents > expected_pages) { in igt_vma_rotate_remap()
650 expected_pages, vma->pages->nents); in igt_vma_rotate_remap()
655 if (vma->node.size < vma->size) { in igt_vma_rotate_remap()
657 vma->size, vma->node.size); in igt_vma_rotate_remap()
662 if (vma->pages == obj->mm.pages) { in igt_vma_rotate_remap()
668 sg = vma->pages->sgl; in igt_vma_rotate_remap()
693 i915_vma_unpin(vma); in igt_vma_rotate_remap()
709 struct i915_vma *vma, in assert_partial() argument
716 for_each_sgt_daddr(dma, sgt, vma->pages) { in assert_partial()
738 static bool assert_pin(struct i915_vma *vma, in assert_pin() argument
745 if (vma->size != size) { in assert_pin()
747 name, size, vma->size); in assert_pin()
751 if (vma->node.size < vma->size) { in assert_pin()
753 name, vma->size, vma->node.size); in assert_pin()
758 if (memcmp(&vma->ggtt_view, view, sizeof(*view))) { in assert_pin()
764 if (vma->pages == vma->obj->mm.pages) { in assert_pin()
770 if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { in assert_pin()
772 vma->ggtt_view.type); in assert_pin()
776 if (vma->pages != vma->obj->mm.pages) { in assert_pin()
799 struct i915_vma *vma; in igt_vma_partial() local
825 vma = checked_vma_instance(obj, vm, &view); in igt_vma_partial()
826 if (IS_ERR(vma)) { in igt_vma_partial()
827 err = PTR_ERR(vma); in igt_vma_partial()
831 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL); in igt_vma_partial()
835 if (!assert_pin(vma, &view, sz*PAGE_SIZE, p->name)) { in igt_vma_partial()
842 if (!assert_partial(obj, vma, offset, sz)) { in igt_vma_partial()
849 i915_vma_unpin(vma); in igt_vma_partial()
857 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
867 vma = checked_vma_instance(obj, vm, NULL); in igt_vma_partial()
868 if (IS_ERR(vma)) { in igt_vma_partial()
869 err = PTR_ERR(vma); in igt_vma_partial()
873 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL); in igt_vma_partial()
877 if (!assert_pin(vma, NULL, obj->base.size, p->name)) { in igt_vma_partial()
883 i915_vma_unpin(vma); in igt_vma_partial()
886 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
986 struct i915_vma *vma; in igt_vma_remapped_gtt() local
1000 vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE); in igt_vma_remapped_gtt()
1001 if (IS_ERR(vma)) { in igt_vma_remapped_gtt()
1002 err = PTR_ERR(vma); in igt_vma_remapped_gtt()
1006 GEM_BUG_ON(vma->ggtt_view.type != *t); in igt_vma_remapped_gtt()
1008 map = i915_vma_pin_iomap(vma); in igt_vma_remapped_gtt()
1009 i915_vma_unpin(vma); in igt_vma_remapped_gtt()
1029 i915_vma_unpin_iomap(vma); in igt_vma_remapped_gtt()
1031 vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, PIN_MAPPABLE); in igt_vma_remapped_gtt()
1032 if (IS_ERR(vma)) { in igt_vma_remapped_gtt()
1033 err = PTR_ERR(vma); in igt_vma_remapped_gtt()
1037 GEM_BUG_ON(vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL); in igt_vma_remapped_gtt()
1039 map = i915_vma_pin_iomap(vma); in igt_vma_remapped_gtt()
1040 i915_vma_unpin(vma); in igt_vma_remapped_gtt()
1063 i915_vma_unpin_iomap(vma); in igt_vma_remapped_gtt()
1069 i915_vma_unpin_iomap(vma); in igt_vma_remapped_gtt()