Lines Matching full:vm

160 	if (!ppgtt->vm.allocate_va_range)  in igt_ppgtt_alloc()
171 limit = min(ppgtt->vm.total, limit); in igt_ppgtt_alloc()
177 err = i915_vm_alloc_pt_stash(&ppgtt->vm, &stash, size); in igt_ppgtt_alloc()
181 err = i915_vm_pin_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
183 i915_vm_free_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
187 ppgtt->vm.allocate_va_range(&ppgtt->vm, &stash, 0, size); in igt_ppgtt_alloc()
190 ppgtt->vm.clear_range(&ppgtt->vm, 0, size); in igt_ppgtt_alloc()
192 i915_vm_free_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
199 err = i915_vm_alloc_pt_stash(&ppgtt->vm, &stash, size - last); in igt_ppgtt_alloc()
203 err = i915_vm_pin_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
205 i915_vm_free_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
209 ppgtt->vm.allocate_va_range(&ppgtt->vm, &stash, in igt_ppgtt_alloc()
213 i915_vm_free_pt_stash(&ppgtt->vm, &stash); in igt_ppgtt_alloc()
217 i915_vm_put(&ppgtt->vm); in igt_ppgtt_alloc()
221 static int lowlevel_hole(struct i915_address_space *vm, in lowlevel_hole() argument
261 GEM_BUG_ON(count * BIT_ULL(size) > vm->total); in lowlevel_hole()
270 obj = fake_dma_object(vm->i915, BIT_ULL(size)); in lowlevel_hole()
288 GEM_BUG_ON(addr + BIT_ULL(size) > vm->total); in lowlevel_hole()
297 if (vm->allocate_va_range) { in lowlevel_hole()
300 if (i915_vm_alloc_pt_stash(vm, &stash, in lowlevel_hole()
304 if (i915_vm_pin_pt_stash(vm, &stash)) { in lowlevel_hole()
305 i915_vm_free_pt_stash(vm, &stash); in lowlevel_hole()
309 vm->allocate_va_range(vm, &stash, in lowlevel_hole()
312 i915_vm_free_pt_stash(vm, &stash); in lowlevel_hole()
319 with_intel_runtime_pm(vm->gt->uncore->rpm, wakeref) in lowlevel_hole()
320 vm->insert_entries(vm, mock_vma, in lowlevel_hole()
330 GEM_BUG_ON(addr + BIT_ULL(size) > vm->total); in lowlevel_hole()
331 with_intel_runtime_pm(vm->gt->uncore->rpm, wakeref) in lowlevel_hole()
332 vm->clear_range(vm, addr, BIT_ULL(size)); in lowlevel_hole()
340 cleanup_freed_objects(vm->i915); in lowlevel_hole()
348 struct i915_address_space *vm) in close_object_list() argument
356 vma = i915_vma_instance(obj, vm, NULL); in close_object_list()
365 static int fill_hole(struct i915_address_space *vm, in fill_hole() argument
382 if (i915_is_ggtt(vm)) in fill_hole()
398 obj = fake_dma_object(vm->i915, full_size); in fill_hole()
413 vma = i915_vma_instance(obj, vm, NULL); in fill_hole()
450 vma = i915_vma_instance(obj, vm, NULL); in fill_hole()
486 vma = i915_vma_instance(obj, vm, NULL); in fill_hole()
523 vma = i915_vma_instance(obj, vm, NULL); in fill_hole()
565 close_object_list(&objects, vm); in fill_hole()
566 cleanup_freed_objects(vm->i915); in fill_hole()
572 close_object_list(&objects, vm); in fill_hole()
576 static int walk_hole(struct i915_address_space *vm, in walk_hole() argument
589 if (i915_is_ggtt(vm)) in walk_hole()
598 obj = fake_dma_object(vm->i915, size << PAGE_SHIFT); in walk_hole()
602 vma = i915_vma_instance(obj, vm, NULL); in walk_hole()
650 cleanup_freed_objects(vm->i915); in walk_hole()
656 static int pot_hole(struct i915_address_space *vm, in pot_hole() argument
667 if (i915_is_ggtt(vm)) in pot_hole()
670 obj = i915_gem_object_create_internal(vm->i915, 2 * I915_GTT_PAGE_SIZE); in pot_hole()
674 vma = i915_vma_instance(obj, vm, NULL); in pot_hole()
728 static int drunk_hole(struct i915_address_space *vm, in drunk_hole() argument
737 if (i915_is_ggtt(vm)) in drunk_hole()
773 obj = fake_dma_object(vm->i915, BIT_ULL(size)); in drunk_hole()
779 vma = i915_vma_instance(obj, vm, NULL); in drunk_hole()
828 cleanup_freed_objects(vm->i915); in drunk_hole()
834 static int __shrink_hole(struct i915_address_space *vm, in __shrink_hole() argument
851 obj = fake_dma_object(vm->i915, size); in __shrink_hole()
859 vma = i915_vma_instance(obj, vm, NULL); in __shrink_hole()
904 close_object_list(&objects, vm); in __shrink_hole()
905 cleanup_freed_objects(vm->i915); in __shrink_hole()
909 static int shrink_hole(struct i915_address_space *vm, in shrink_hole() argument
916 vm->fault_attr.probability = 999; in shrink_hole()
917 atomic_set(&vm->fault_attr.times, -1); in shrink_hole()
920 vm->fault_attr.interval = prime; in shrink_hole()
921 err = __shrink_hole(vm, hole_start, hole_end, end_time); in shrink_hole()
926 memset(&vm->fault_attr, 0, sizeof(vm->fault_attr)); in shrink_hole()
931 static int shrink_boom(struct i915_address_space *vm, in shrink_boom() argument
953 purge = fake_dma_object(vm->i915, size); in shrink_boom()
957 vma = i915_vma_instance(purge, vm, NULL); in shrink_boom()
970 explode = fake_dma_object(vm->i915, size); in shrink_boom()
976 vm->fault_attr.probability = 100; in shrink_boom()
977 vm->fault_attr.interval = 1; in shrink_boom()
978 atomic_set(&vm->fault_attr.times, -1); in shrink_boom()
980 vma = i915_vma_instance(explode, vm, NULL); in shrink_boom()
995 memset(&vm->fault_attr, 0, sizeof(vm->fault_attr)); in shrink_boom()
996 cleanup_freed_objects(vm->i915); in shrink_boom()
1005 memset(&vm->fault_attr, 0, sizeof(vm->fault_attr)); in shrink_boom()
1010 int (*func)(struct i915_address_space *vm, in exercise_ppgtt() argument
1031 GEM_BUG_ON(offset_in_page(ppgtt->vm.total)); in exercise_ppgtt()
1032 GEM_BUG_ON(!atomic_read(&ppgtt->vm.open)); in exercise_ppgtt()
1034 err = func(&ppgtt->vm, 0, ppgtt->vm.total, end_time); in exercise_ppgtt()
1036 i915_vm_put(&ppgtt->vm); in exercise_ppgtt()
1090 int (*func)(struct i915_address_space *vm, in exercise_ggtt() argument
1101 list_sort(NULL, &ggtt->vm.mm.hole_stack, sort_holes); in exercise_ggtt()
1102 drm_mm_for_each_hole(node, &ggtt->vm.mm, hole_start, hole_end) { in exercise_ggtt()
1106 if (ggtt->vm.mm.color_adjust) in exercise_ggtt()
1107 ggtt->vm.mm.color_adjust(node, 0, in exercise_ggtt()
1112 err = func(&ggtt->vm, hole_start, hole_end, end_time); in exercise_ggtt()
1173 mutex_lock(&ggtt->vm.mutex); in igt_ggtt_page()
1174 err = drm_mm_insert_node_in_range(&ggtt->vm.mm, &tmp, in igt_ggtt_page()
1179 mutex_unlock(&ggtt->vm.mutex); in igt_ggtt_page()
1188 ggtt->vm.insert_page(&ggtt->vm, in igt_ggtt_page()
1207 intel_gt_flush_ggtt_writes(ggtt->vm.gt); in igt_ggtt_page()
1229 ggtt->vm.clear_range(&ggtt->vm, tmp.start, tmp.size); in igt_ggtt_page()
1231 mutex_lock(&ggtt->vm.mutex); in igt_ggtt_page()
1233 mutex_unlock(&ggtt->vm.mutex); in igt_ggtt_page()
1252 mutex_lock(&vma->vm->mutex); in track_vma_bind()
1253 list_add_tail(&vma->vm_link, &vma->vm->bound_list); in track_vma_bind()
1254 mutex_unlock(&vma->vm->mutex); in track_vma_bind()
1258 int (*func)(struct i915_address_space *vm, in exercise_mock() argument
1263 struct i915_address_space *vm; in exercise_mock() local
1272 vm = i915_gem_context_get_vm_rcu(ctx); in exercise_mock()
1273 err = func(vm, 0, min(vm->total, limit), end_time); in exercise_mock()
1274 i915_vm_put(vm); in exercise_mock()
1284 return exercise_mock(ggtt->vm.i915, fill_hole); in igt_mock_fill()
1291 return exercise_mock(ggtt->vm.i915, walk_hole); in igt_mock_walk()
1298 return exercise_mock(ggtt->vm.i915, pot_hole); in igt_mock_pot()
1305 return exercise_mock(ggtt->vm.i915, drunk_hole); in igt_mock_drunk()
1324 total + 2 * I915_GTT_PAGE_SIZE <= ggtt->vm.total; in igt_gtt_reserve()
1328 obj = i915_gem_object_create_internal(ggtt->vm.i915, in igt_gtt_reserve()
1343 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_reserve()
1349 mutex_lock(&ggtt->vm.mutex); in igt_gtt_reserve()
1350 err = i915_gem_gtt_reserve(&ggtt->vm, &vma->node, in igt_gtt_reserve()
1355 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_reserve()
1358 total, ggtt->vm.total, err); in igt_gtt_reserve()
1376 total + 2 * I915_GTT_PAGE_SIZE <= ggtt->vm.total; in igt_gtt_reserve()
1380 obj = i915_gem_object_create_internal(ggtt->vm.i915, in igt_gtt_reserve()
1395 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_reserve()
1401 mutex_lock(&ggtt->vm.mutex); in igt_gtt_reserve()
1402 err = i915_gem_gtt_reserve(&ggtt->vm, &vma->node, in igt_gtt_reserve()
1407 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_reserve()
1410 total, ggtt->vm.total, err); in igt_gtt_reserve()
1431 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_reserve()
1444 0, ggtt->vm.total, in igt_gtt_reserve()
1448 mutex_lock(&ggtt->vm.mutex); in igt_gtt_reserve()
1449 err = i915_gem_gtt_reserve(&ggtt->vm, &vma->node, in igt_gtt_reserve()
1454 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_reserve()
1457 total, ggtt->vm.total, err); in igt_gtt_reserve()
1492 ggtt->vm.total + I915_GTT_PAGE_SIZE, 0, in igt_gtt_insert()
1493 0, ggtt->vm.total, in igt_gtt_insert()
1523 mutex_lock(&ggtt->vm.mutex); in igt_gtt_insert()
1524 err = i915_gem_gtt_insert(&ggtt->vm, &tmp, in igt_gtt_insert()
1529 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_insert()
1540 total + I915_GTT_PAGE_SIZE <= ggtt->vm.total; in igt_gtt_insert()
1544 obj = i915_gem_object_create_internal(ggtt->vm.i915, in igt_gtt_insert()
1559 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_insert()
1565 mutex_lock(&ggtt->vm.mutex); in igt_gtt_insert()
1566 err = i915_gem_gtt_insert(&ggtt->vm, &vma->node, in igt_gtt_insert()
1568 0, ggtt->vm.total, in igt_gtt_insert()
1570 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_insert()
1578 total, ggtt->vm.total, err); in igt_gtt_insert()
1590 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_insert()
1610 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_insert()
1625 mutex_lock(&ggtt->vm.mutex); in igt_gtt_insert()
1626 err = i915_gem_gtt_insert(&ggtt->vm, &vma->node, in igt_gtt_insert()
1628 0, ggtt->vm.total, in igt_gtt_insert()
1630 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_insert()
1633 total, ggtt->vm.total, err); in igt_gtt_insert()
1649 total + 2 * I915_GTT_PAGE_SIZE <= ggtt->vm.total; in igt_gtt_insert()
1653 obj = i915_gem_object_create_internal(ggtt->vm.i915, in igt_gtt_insert()
1668 vma = i915_vma_instance(obj, &ggtt->vm, NULL); in igt_gtt_insert()
1674 mutex_lock(&ggtt->vm.mutex); in igt_gtt_insert()
1675 err = i915_gem_gtt_insert(&ggtt->vm, &vma->node, in igt_gtt_insert()
1677 0, ggtt->vm.total, in igt_gtt_insert()
1679 mutex_unlock(&ggtt->vm.mutex); in igt_gtt_insert()
1682 total, ggtt->vm.total, err); in igt_gtt_insert()
1793 struct i915_address_space *vm; in igt_cs_tlb() local
1820 vm = i915_gem_context_get_vm_rcu(ctx); in igt_cs_tlb()
1821 if (i915_is_ggtt(vm)) in igt_cs_tlb()
1854 u64 addr = (vm->total - PAGE_SIZE) + i * sizeof(u32); in igt_cs_tlb()
1880 vma = i915_vma_instance(out, vm, NULL); in igt_cs_tlb()
1889 (vm->total - PAGE_SIZE)); in igt_cs_tlb()
1892 GEM_BUG_ON(vma->node.start != vm->total - PAGE_SIZE); in igt_cs_tlb()
1913 0, vm->total - PAGE_SIZE, in igt_cs_tlb()
1918 vma = i915_vma_instance(bbe, vm, NULL); in igt_cs_tlb()
1928 err = i915_vm_alloc_pt_stash(vm, &stash, chunk_size); in igt_cs_tlb()
1932 err = i915_vm_pin_pt_stash(vm, &stash); in igt_cs_tlb()
1934 i915_vm_free_pt_stash(vm, &stash); in igt_cs_tlb()
1938 vm->allocate_va_range(vm, &stash, offset, chunk_size); in igt_cs_tlb()
1940 i915_vm_free_pt_stash(vm, &stash); in igt_cs_tlb()
1945 vm->insert_entries(vm, vma, I915_CACHE_NONE, 0); in igt_cs_tlb()
1964 vma = i915_vma_instance(act, vm, NULL); in igt_cs_tlb()
1981 vm->insert_entries(vm, vma, I915_CACHE_NONE, 0); in igt_cs_tlb()
2027 vm->clear_range(vm, offset, chunk_size); in igt_cs_tlb()
2045 i915_vm_put(vm); in igt_cs_tlb()
2071 GEM_BUG_ON(offset_in_page(i915->ggtt.vm.total)); in i915_gem_gtt_live_selftests()