Lines Matching +full:vm +full:- +full:map
43 if (vma->vm != ctx->vm) { in assert_vma()
44 pr_err("VMA created with wrong VM\n"); in assert_vma()
48 if (vma->size != obj->base.size) { in assert_vma()
50 vma->size, obj->base.size); in assert_vma()
54 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) { in assert_vma()
56 vma->gtt_view.type); in assert_vma()
65 struct i915_address_space *vm, in checked_vma_instance() argument
71 vma = i915_vma_instance(obj, vm, view); in checked_vma_instance()
76 if (vma->vm != vm) { in checked_vma_instance()
77 pr_err("VMA's vm [%p] does not match request [%p]\n", in checked_vma_instance()
78 vma->vm, vm); in checked_vma_instance()
82 if (i915_is_ggtt(vm) != i915_vma_is_ggtt(vma)) { in checked_vma_instance()
84 i915_vma_is_ggtt(vma), i915_is_ggtt(vm)); in checked_vma_instance()
88 if (i915_vma_compare(vma, vm, view)) { in checked_vma_instance()
90 return ERR_PTR(-EINVAL); in checked_vma_instance()
93 if (i915_vma_compare(vma, vma->vm, in checked_vma_instance()
94 i915_vma_is_ggtt(vma) ? &vma->gtt_view : NULL)) { in checked_vma_instance()
96 return ERR_PTR(-EINVAL); in checked_vma_instance()
101 return ERR_PTR(-EINVAL); in checked_vma_instance()
118 struct i915_address_space *vm; in create_vmas() local
122 vm = i915_gem_context_get_eb_vm(ctx); in create_vmas()
123 vma = checked_vma_instance(obj, vm, NULL); in create_vmas()
124 i915_vm_put(vm); in create_vmas()
130 return -EINVAL; in create_vmas()
152 struct drm_i915_private *i915 = ggtt->vm.i915; in igt_vma_create()
160 int err = -ENOMEM; in igt_vma_create()
167 for_each_prime_number(num_obj, ULONG_MAX - 1) { in igt_vma_create()
173 list_add(&obj->st_link, &objects); in igt_vma_create()
183 list_move(&ctx->link, &contexts); in igt_vma_create()
197 list_del_init(&ctx->link); in igt_vma_create()
209 list_del_init(&ctx->link); in igt_vma_create()
234 if (i915_vma_misplaced(vma, mode->size, 0, mode->flags)) in assert_pin_valid()
245 return result == -ENOSPC; in assert_pin_enospc()
253 return result == -EINVAL; in assert_pin_einval()
269 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
270 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
271 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
273 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
274 INVALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | ggtt->mappable_end), in igt_vma_pin1()
275 VALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
276 INVALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | ggtt->vm.total), in igt_vma_pin1()
281 VALID(ggtt->mappable_end - 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
282 VALID(ggtt->mappable_end, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
283 NOSPACE(ggtt->mappable_end + 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
284 VALID(ggtt->vm.total - 4096, PIN_GLOBAL), in igt_vma_pin1()
285 VALID(ggtt->vm.total, PIN_GLOBAL), in igt_vma_pin1()
286 NOSPACE(ggtt->vm.total + 4096, PIN_GLOBAL), in igt_vma_pin1()
288 INVALID(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
289 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
290 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (round_down(U64_MAX, PAGE_SIZE) - 4096)), in igt_vma_pin1()
292 VALID(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
300 NOSPACE(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | ggtt->mappable_end), in igt_vma_pin1()
301 NOSPACE(0, PIN_GLOBAL | PIN_OFFSET_BIAS | ggtt->vm.total), in igt_vma_pin1()
302 NOSPACE(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
303 NOSPACE(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
313 int err = -EINVAL; in igt_vma_pin1()
319 GEM_BUG_ON(!drm_mm_clean(&ggtt->vm.mm)); in igt_vma_pin1()
321 obj = i915_gem_object_create_internal(ggtt->vm.i915, PAGE_SIZE); in igt_vma_pin1()
325 vma = checked_vma_instance(obj, &ggtt->vm, NULL); in igt_vma_pin1()
329 for (m = modes; m->assert; m++) { in igt_vma_pin1()
330 err = i915_vma_pin(vma, m->size, 0, m->flags); in igt_vma_pin1()
331 if (!m->assert(vma, m, err)) { in igt_vma_pin1()
333 m->assert == assert_pin_valid ? "Failed" : "Unexpectedly succeeded", in igt_vma_pin1()
334 (int)(m - modes), m->string, m->size, m->flags, in igt_vma_pin1()
338 err = -EINVAL; in igt_vma_pin1()
365 return (r->plane[n].src_stride * (r->plane[n].height - y - 1) + in rotated_index()
366 r->plane[n].offset + x); in rotated_index()
376 for (x = 0; x < r->plane[n].width; x++) { in assert_rotated()
379 for (y = 0; y < r->plane[n].height; y++) { in assert_rotated()
386 return ERR_PTR(-EINVAL); in assert_rotated()
396 return ERR_PTR(-EINVAL); in assert_rotated()
402 return ERR_PTR(-EINVAL); in assert_rotated()
408 left = (r->plane[n].dst_stride - y) * PAGE_SIZE; in assert_rotated()
416 return ERR_PTR(-EINVAL); in assert_rotated()
422 return ERR_PTR(-EINVAL); in assert_rotated()
428 return ERR_PTR(-EINVAL); in assert_rotated()
442 return (r->plane[n].src_stride * y + in remapped_index()
443 r->plane[n].offset + x); in remapped_index()
455 for (y = 0; y < r->plane[n].height; y++) { in assert_remapped()
456 for (x = 0; x < r->plane[n].width; x++) { in assert_remapped()
463 return ERR_PTR(-EINVAL); in assert_remapped()
473 if (left < PAGE_SIZE || left & (PAGE_SIZE-1)) { in assert_remapped()
477 return ERR_PTR(-EINVAL); in assert_remapped()
483 return ERR_PTR(-EINVAL); in assert_remapped()
486 left -= PAGE_SIZE; in assert_remapped()
498 return ERR_PTR(-EINVAL); in assert_remapped()
501 left = (r->plane[n].dst_stride - r->plane[n].width) * PAGE_SIZE; in assert_remapped()
509 return ERR_PTR(-EINVAL); in assert_remapped()
516 return ERR_PTR(-EINVAL); in assert_remapped()
523 return ERR_PTR(-EINVAL); in assert_remapped()
539 return a->dst_stride * a->width + b->dst_stride * b->width; in remapped_size()
541 return a->dst_stride * a->height + b->dst_stride * b->height; in remapped_size()
547 struct i915_address_space *vm = &ggtt->vm; in igt_vma_rotate_remap() local
578 int err = -ENOMEM; in igt_vma_rotate_remap()
584 obj = i915_gem_object_create_internal(vm->i915, max_pages * PAGE_SIZE); in igt_vma_rotate_remap()
589 for (a = planes; a->width; a++) { in igt_vma_rotate_remap()
590 for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) { in igt_vma_rotate_remap()
602 max_offset = max_pages - max_offset; in igt_vma_rotate_remap()
619 vma = checked_vma_instance(obj, vm, &view); in igt_vma_rotate_remap()
634 vma->size != expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
636 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
637 err = -EINVAL; in igt_vma_rotate_remap()
642 vma->size > expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
644 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
645 err = -EINVAL; in igt_vma_rotate_remap()
649 if (vma->pages->nents > expected_pages) { in igt_vma_rotate_remap()
651 expected_pages, vma->pages->nents); in igt_vma_rotate_remap()
652 err = -EINVAL; in igt_vma_rotate_remap()
656 if (vma->node.size < vma->size) { in igt_vma_rotate_remap()
658 vma->size, vma->node.size); in igt_vma_rotate_remap()
659 err = -EINVAL; in igt_vma_rotate_remap()
663 if (vma->pages == obj->mm.pages) { in igt_vma_rotate_remap()
665 err = -EINVAL; in igt_vma_rotate_remap()
669 sg = vma->pages->sgl; in igt_vma_rotate_remap()
689 err = -EINVAL; in igt_vma_rotate_remap()
721 for_each_sgt_daddr(dma, sgt, vma->pages) { in assert_partial()
737 size--; in assert_partial()
750 if (vma->size != size) { in assert_pin()
752 name, size, vma->size); in assert_pin()
756 if (vma->node.size < vma->size) { in assert_pin()
758 name, vma->size, vma->node.size); in assert_pin()
762 if (view && view->type != I915_GTT_VIEW_NORMAL) { in assert_pin()
763 if (memcmp(&vma->gtt_view, view, sizeof(*view))) { in assert_pin()
769 if (vma->pages == vma->obj->mm.pages) { in assert_pin()
775 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) { in assert_pin()
777 vma->gtt_view.type); in assert_pin()
781 if (vma->pages != vma->obj->mm.pages) { in assert_pin()
793 struct i915_address_space *vm = &ggtt->vm; in igt_vma_partial() local
805 int err = -ENOMEM; in igt_vma_partial()
811 obj = i915_gem_object_create_internal(vm->i915, npages * PAGE_SIZE); in igt_vma_partial()
815 for (p = phases; p->name; p++) { /* exercise both create/lookup */ in igt_vma_partial()
820 for_each_prime_number_from(offset, 0, npages - sz) { in igt_vma_partial()
830 vma = checked_vma_instance(obj, vm, &view); in igt_vma_partial()
840 if (!assert_pin(vma, &view, sz*PAGE_SIZE, p->name)) { in igt_vma_partial()
842 p->name, offset, sz); in igt_vma_partial()
843 err = -EINVAL; in igt_vma_partial()
849 p->name, offset, sz); in igt_vma_partial()
850 err = -EINVAL; in igt_vma_partial()
867 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
870 pr_err("(%s) All partial vma were not recorded on the obj->vma_list: found %u, expected %u\n", in igt_vma_partial()
871 p->name, count, nvma); in igt_vma_partial()
872 err = -EINVAL; in igt_vma_partial()
877 vma = checked_vma_instance(obj, vm, NULL); in igt_vma_partial()
887 if (!assert_pin(vma, NULL, obj->base.size, p->name)) { in igt_vma_partial()
888 pr_err("(%s) inconsistent full pin\n", p->name); in igt_vma_partial()
889 err = -EINVAL; in igt_vma_partial()
902 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
905 pr_err("(%s) allocated an extra full vma!\n", p->name); in igt_vma_partial()
906 err = -EINVAL; in igt_vma_partial()
931 return -ENOMEM; in i915_vma_mock_selftests()
942 err = i915_subtests(tests, gt->ggtt); in i915_vma_mock_selftests()
946 mock_fini_ggtt(gt->ggtt); in i915_vma_mock_selftests()
988 if (!i915_ggtt_has_aperture(to_gt(i915)->ggtt)) in igt_vma_remapped_gtt()
995 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in igt_vma_remapped_gtt()
998 for (p = planes; p->width; p++) { in igt_vma_remapped_gtt()
1005 u32 __iomem *map; in igt_vma_remapped_gtt() local
1016 p->height : p->width; in igt_vma_remapped_gtt()
1024 GEM_BUG_ON(vma->gtt_view.type != *t); in igt_vma_remapped_gtt()
1026 map = i915_vma_pin_iomap(vma); in igt_vma_remapped_gtt()
1028 if (IS_ERR(map)) { in igt_vma_remapped_gtt()
1029 err = PTR_ERR(map); in igt_vma_remapped_gtt()
1043 iowrite32(val, &map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
1055 GEM_BUG_ON(vma->gtt_view.type != I915_GTT_VIEW_NORMAL); in igt_vma_remapped_gtt()
1057 map = i915_vma_pin_iomap(vma); in igt_vma_remapped_gtt()
1059 if (IS_ERR(map)) { in igt_vma_remapped_gtt()
1060 err = PTR_ERR(map); in igt_vma_remapped_gtt()
1076 val = ioread32(&map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
1082 err = -EINVAL; in igt_vma_remapped_gtt()
1094 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in igt_vma_remapped_gtt()