Lines Matching refs:vma
37 static bool assert_vma(struct i915_vma *vma,
43 if (vma->vm != ctx->vm) {
48 if (vma->size != obj->base.size) {
50 vma->size, obj->base.size);
54 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) {
56 vma->gtt_view.type);
68 struct i915_vma *vma;
71 vma = i915_vma_instance(obj, vm, view);
72 if (IS_ERR(vma))
73 return vma;
76 if (vma->vm != vm) {
78 vma->vm, vm);
82 if (i915_is_ggtt(vm) != i915_vma_is_ggtt(vma)) {
84 i915_vma_is_ggtt(vma), i915_is_ggtt(vm));
88 if (i915_vma_compare(vma, vm, view)) {
93 if (i915_vma_compare(vma, vma->vm,
94 i915_vma_is_ggtt(vma) ? &vma->gtt_view : NULL)) {
104 return vma;
119 struct i915_vma *vma;
123 vma = checked_vma_instance(obj, vm, NULL);
125 if (IS_ERR(vma))
126 return PTR_ERR(vma);
128 if (!assert_vma(vma, obj, ctx)) {
134 err = i915_vma_pin(vma, 0, 0, PIN_USER);
140 i915_vma_unpin(vma);
163 * Exercise creating many vma amongst many objections, checking the
164 * vma creation and lookup routines.
228 static bool assert_pin_valid(const struct i915_vma *vma,
235 if (i915_vma_misplaced(vma, mode->size, 0, mode->flags))
242 static bool assert_pin_enospc(const struct i915_vma *vma,
250 static bool assert_pin_einval(const struct i915_vma *vma,
314 struct i915_vma *vma;
328 vma = checked_vma_instance(obj, &ggtt->vm, NULL);
329 if (IS_ERR(vma))
333 err = i915_vma_pin(vma, m->size, 0, m->flags);
334 if (!m->assert(vma, m, err)) {
340 i915_vma_unpin(vma);
346 i915_vma_unpin(vma);
347 err = i915_vma_unbind_unlocked(vma);
620 struct i915_vma *vma;
623 vma = checked_vma_instance(obj, vm, &view);
624 if (IS_ERR(vma)) {
625 err = PTR_ERR(vma);
629 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
638 vma->size != expected_pages * PAGE_SIZE) {
640 PAGE_SIZE * expected_pages, vma->size);
646 vma->size > expected_pages * PAGE_SIZE) {
648 PAGE_SIZE * expected_pages, vma->size);
653 if (vma->pages->nents > expected_pages) {
655 expected_pages, vma->pages->nents);
660 if (vma->node.size < vma->size) {
662 vma->size, vma->node.size);
667 if (vma->pages == obj->mm.pages) {
673 sg = vma->pages->sgl;
698 i915_vma_unpin(vma);
699 err = i915_vma_unbind_unlocked(vma);
718 struct i915_vma *vma,
725 for_each_sgt_daddr(dma, sgt, vma->pages) {
747 static bool assert_pin(struct i915_vma *vma,
754 if (vma->size != size) {
756 name, size, vma->size);
760 if (vma->node.size < vma->size) {
762 name, vma->size, vma->node.size);
767 if (memcmp(&vma->gtt_view, view, sizeof(*view))) {
773 if (vma->pages == vma->obj->mm.pages) {
779 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) {
781 vma->gtt_view.type);
785 if (vma->pages != vma->obj->mm.pages) {
808 struct i915_vma *vma;
835 vma = checked_vma_instance(obj, vm, &view);
836 if (IS_ERR(vma)) {
837 err = PTR_ERR(vma);
841 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
845 if (!assert_pin(vma, &view, sz*PAGE_SIZE, p->name)) {
852 if (!assert_partial(obj, vma, offset, sz)) {
859 i915_vma_unpin(vma);
861 err = i915_vma_unbind_unlocked(vma);
872 list_for_each_entry(vma, &obj->vma.list, obj_link)
875 pr_err("(%s) All partial vma were not recorded on the obj->vma_list: found %u, expected %u\n",
882 vma = checked_vma_instance(obj, vm, NULL);
883 if (IS_ERR(vma)) {
884 err = PTR_ERR(vma);
888 err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
892 if (!assert_pin(vma, NULL, obj->base.size, p->name)) {
898 i915_vma_unpin(vma);
900 err = i915_vma_unbind_unlocked(vma);
907 list_for_each_entry(vma, &obj->vma.list, obj_link)
910 pr_err("(%s) allocated an extra full vma!\n", p->name);
1009 struct i915_vma *vma;
1023 vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE);
1024 if (IS_ERR(vma)) {
1025 err = PTR_ERR(vma);
1029 GEM_BUG_ON(vma->gtt_view.type != *t);
1031 map = i915_vma_pin_iomap(vma);
1032 i915_vma_unpin(vma);
1052 i915_vma_unpin_iomap(vma);
1054 vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, PIN_MAPPABLE);
1055 if (IS_ERR(vma)) {
1056 err = PTR_ERR(vma);
1060 GEM_BUG_ON(vma->gtt_view.type != I915_GTT_VIEW_NORMAL);
1062 map = i915_vma_pin_iomap(vma);
1063 i915_vma_unpin(vma);
1086 i915_vma_unpin_iomap(vma);
1092 i915_vma_unpin_iomap(vma);