Lines Matching refs:vma
136 struct i915_vma *vma; in i915_gem_get_aperture_ioctl() local
141 list_for_each_entry(vma, &ggtt->base.active_list, mm_list) in i915_gem_get_aperture_ioctl()
142 if (vma->pin_count) in i915_gem_get_aperture_ioctl()
143 pinned += vma->node.size; in i915_gem_get_aperture_ioctl()
144 list_for_each_entry(vma, &ggtt->base.inactive_list, mm_list) in i915_gem_get_aperture_ioctl()
145 if (vma->pin_count) in i915_gem_get_aperture_ioctl()
146 pinned += vma->node.size; in i915_gem_get_aperture_ioctl()
271 struct i915_vma *vma, *next; in drop_pages() local
275 list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) in drop_pages()
276 if (i915_vma_unbind(vma)) in drop_pages()
1753 struct vm_area_struct *vma; in i915_gem_mmap_ioctl() local
1756 vma = find_vma(mm, addr); in i915_gem_mmap_ioctl()
1757 if (vma) in i915_gem_mmap_ioctl()
1758 vma->vm_page_prot = in i915_gem_mmap_ioctl()
1759 pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); in i915_gem_mmap_ioctl()
1789 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) in i915_gem_fault() argument
1791 struct drm_i915_gem_object *obj = to_intel_bo(vma->vm_private_data); in i915_gem_fault()
1803 page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> in i915_gem_fault()
1838 (vma->vm_end - vma->vm_start)/PAGE_SIZE - in i915_gem_fault()
1866 unsigned long base = vma->vm_start + in i915_gem_fault()
1871 ret = vm_insert_pfn(vma, base + i * PAGE_SIZE, pfn + i); in i915_gem_fault()
1880 vma->vm_end - vma->vm_start, in i915_gem_fault()
1885 ret = vm_insert_pfn(vma, in i915_gem_fault()
1886 (unsigned long)vma->vm_start + i * PAGE_SIZE, in i915_gem_fault()
1894 ret = vm_insert_pfn(vma, in i915_gem_fault()
2488 void i915_vma_move_to_active(struct i915_vma *vma, in i915_vma_move_to_active() argument
2491 struct drm_i915_gem_object *obj = vma->obj; in i915_vma_move_to_active()
2504 list_move_tail(&vma->mm_list, &vma->vm->active_list); in i915_vma_move_to_active()
2520 struct i915_vma *vma; in i915_gem_object_retire__read() local
2542 list_for_each_entry(vma, &obj->vma_list, vma_link) { in i915_gem_object_retire__read()
2543 if (!list_empty(&vma->mm_list)) in i915_gem_object_retire__read()
2544 list_move_tail(&vma->mm_list, &vma->vm->inactive_list); in i915_gem_object_retire__read()
3357 static int __i915_vma_unbind(struct i915_vma *vma, bool wait) in __i915_vma_unbind() argument
3359 struct drm_i915_gem_object *obj = vma->obj; in __i915_vma_unbind()
3363 if (list_empty(&vma->vma_link)) in __i915_vma_unbind()
3366 if (!drm_mm_node_allocated(&vma->node)) { in __i915_vma_unbind()
3367 i915_gem_vma_destroy(vma); in __i915_vma_unbind()
3371 if (vma->pin_count) in __i915_vma_unbind()
3382 if (i915_is_ggtt(vma->vm) && in __i915_vma_unbind()
3383 vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) { in __i915_vma_unbind()
3392 trace_i915_vma_unbind(vma); in __i915_vma_unbind()
3394 vma->vm->unbind_vma(vma); in __i915_vma_unbind()
3395 vma->bound = 0; in __i915_vma_unbind()
3397 list_del_init(&vma->mm_list); in __i915_vma_unbind()
3398 if (i915_is_ggtt(vma->vm)) { in __i915_vma_unbind()
3399 if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) { in __i915_vma_unbind()
3401 } else if (vma->ggtt_view.pages) { in __i915_vma_unbind()
3402 sg_free_table(vma->ggtt_view.pages); in __i915_vma_unbind()
3403 kfree(vma->ggtt_view.pages); in __i915_vma_unbind()
3405 vma->ggtt_view.pages = NULL; in __i915_vma_unbind()
3408 drm_mm_remove_node(&vma->node); in __i915_vma_unbind()
3409 i915_gem_vma_destroy(vma); in __i915_vma_unbind()
3425 int i915_vma_unbind(struct i915_vma *vma) in i915_vma_unbind() argument
3427 return __i915_vma_unbind(vma, true); in i915_vma_unbind()
3430 int __i915_vma_unbind_no_wait(struct i915_vma *vma) in __i915_vma_unbind_no_wait() argument
3432 return __i915_vma_unbind(vma, false); in __i915_vma_unbind_no_wait()
3468 static bool i915_gem_valid_gtt_space(struct i915_vma *vma, in i915_gem_valid_gtt_space() argument
3471 struct drm_mm_node *gtt_space = &vma->node; in i915_gem_valid_gtt_space()
3481 if (vma->vm->mm.color_adjust == NULL) in i915_gem_valid_gtt_space()
3518 struct i915_vma *vma; in i915_gem_object_bind_to_vm() local
3593 vma = ggtt_view ? i915_gem_obj_lookup_or_create_ggtt_vma(obj, ggtt_view) : in i915_gem_object_bind_to_vm()
3596 if (IS_ERR(vma)) in i915_gem_object_bind_to_vm()
3608 ret = drm_mm_insert_node_in_range_generic(&vm->mm, &vma->node, in i915_gem_object_bind_to_vm()
3624 if (WARN_ON(!i915_gem_valid_gtt_space(vma, obj->cache_level))) { in i915_gem_object_bind_to_vm()
3629 trace_i915_vma_bind(vma, flags); in i915_gem_object_bind_to_vm()
3630 ret = i915_vma_bind(vma, obj->cache_level, flags); in i915_gem_object_bind_to_vm()
3635 list_add_tail(&vma->mm_list, &vm->inactive_list); in i915_gem_object_bind_to_vm()
3637 return vma; in i915_gem_object_bind_to_vm()
3640 drm_mm_remove_node(&vma->node); in i915_gem_object_bind_to_vm()
3642 i915_gem_vma_destroy(vma); in i915_gem_object_bind_to_vm()
3643 vma = ERR_PTR(ret); in i915_gem_object_bind_to_vm()
3646 return vma; in i915_gem_object_bind_to_vm()
3748 struct i915_vma *vma; in i915_gem_object_set_to_gtt_domain() local
3798 vma = i915_gem_obj_to_ggtt(obj); in i915_gem_object_set_to_gtt_domain()
3799 if (vma && drm_mm_node_allocated(&vma->node) && !obj->active) in i915_gem_object_set_to_gtt_domain()
3800 list_move_tail(&vma->mm_list, in i915_gem_object_set_to_gtt_domain()
3823 struct i915_vma *vma, *next; in i915_gem_object_set_cache_level() local
3835 list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) { in i915_gem_object_set_cache_level()
3836 if (!drm_mm_node_allocated(&vma->node)) in i915_gem_object_set_cache_level()
3839 if (vma->pin_count) { in i915_gem_object_set_cache_level()
3844 if (!i915_gem_valid_gtt_space(vma, cache_level)) { in i915_gem_object_set_cache_level()
3845 ret = i915_vma_unbind(vma); in i915_gem_object_set_cache_level()
3898 list_for_each_entry(vma, &obj->vma_list, vma_link) { in i915_gem_object_set_cache_level()
3899 if (!drm_mm_node_allocated(&vma->node)) in i915_gem_object_set_cache_level()
3902 ret = i915_vma_bind(vma, cache_level, PIN_UPDATE); in i915_gem_object_set_cache_level()
3908 list_for_each_entry(vma, &obj->vma_list, vma_link) in i915_gem_object_set_cache_level()
3909 vma->node.color = cache_level; in i915_gem_object_set_cache_level()
4204 i915_vma_misplaced(struct i915_vma *vma, uint32_t alignment, uint64_t flags) in i915_vma_misplaced() argument
4206 struct drm_i915_gem_object *obj = vma->obj; in i915_vma_misplaced()
4209 vma->node.start & (alignment - 1)) in i915_vma_misplaced()
4216 vma->node.start < (flags & PIN_OFFSET_MASK)) in i915_vma_misplaced()
4222 void __i915_vma_set_map_and_fenceable(struct i915_vma *vma) in __i915_vma_set_map_and_fenceable() argument
4224 struct drm_i915_gem_object *obj = vma->obj; in __i915_vma_set_map_and_fenceable()
4236 fenceable = (vma->node.size == fence_size && in __i915_vma_set_map_and_fenceable()
4237 (vma->node.start & (fence_alignment - 1)) == 0); in __i915_vma_set_map_and_fenceable()
4239 mappable = (vma->node.start + fence_size <= in __i915_vma_set_map_and_fenceable()
4253 struct i915_vma *vma; in i915_gem_object_do_pin() local
4269 vma = ggtt_view ? i915_gem_obj_to_ggtt_view(obj, ggtt_view) : in i915_gem_object_do_pin()
4272 if (IS_ERR(vma)) in i915_gem_object_do_pin()
4273 return PTR_ERR(vma); in i915_gem_object_do_pin()
4275 if (vma) { in i915_gem_object_do_pin()
4276 if (WARN_ON(vma->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) in i915_gem_object_do_pin()
4279 if (i915_vma_misplaced(vma, alignment, flags)) { in i915_gem_object_do_pin()
4280 WARN(vma->pin_count, in i915_gem_object_do_pin()
4285 upper_32_bits(vma->node.start), in i915_gem_object_do_pin()
4286 lower_32_bits(vma->node.start), in i915_gem_object_do_pin()
4290 ret = i915_vma_unbind(vma); in i915_gem_object_do_pin()
4294 vma = NULL; in i915_gem_object_do_pin()
4298 bound = vma ? vma->bound : 0; in i915_gem_object_do_pin()
4299 if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { in i915_gem_object_do_pin()
4300 vma = i915_gem_object_bind_to_vm(obj, vm, ggtt_view, alignment, in i915_gem_object_do_pin()
4302 if (IS_ERR(vma)) in i915_gem_object_do_pin()
4303 return PTR_ERR(vma); in i915_gem_object_do_pin()
4305 ret = i915_vma_bind(vma, obj->cache_level, flags); in i915_gem_object_do_pin()
4311 (bound ^ vma->bound) & GLOBAL_BIND) { in i915_gem_object_do_pin()
4312 __i915_vma_set_map_and_fenceable(vma); in i915_gem_object_do_pin()
4316 vma->pin_count++; in i915_gem_object_do_pin()
4348 struct i915_vma *vma = i915_gem_obj_to_ggtt_view(obj, view); in i915_gem_object_ggtt_unpin_view() local
4350 BUG_ON(!vma); in i915_gem_object_ggtt_unpin_view()
4351 WARN_ON(vma->pin_count == 0); in i915_gem_object_ggtt_unpin_view()
4354 --vma->pin_count; in i915_gem_object_ggtt_unpin_view()
4567 struct i915_vma *vma, *next; in i915_gem_free_object() local
4573 list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) { in i915_gem_free_object()
4576 vma->pin_count = 0; in i915_gem_free_object()
4577 ret = i915_vma_unbind(vma); in i915_gem_free_object()
4584 WARN_ON(i915_vma_unbind(vma)); in i915_gem_free_object()
4629 struct i915_vma *vma; in i915_gem_obj_to_vma() local
4630 list_for_each_entry(vma, &obj->vma_list, vma_link) { in i915_gem_obj_to_vma()
4631 if (i915_is_ggtt(vma->vm) && in i915_gem_obj_to_vma()
4632 vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) in i915_gem_obj_to_vma()
4634 if (vma->vm == vm) in i915_gem_obj_to_vma()
4635 return vma; in i915_gem_obj_to_vma()
4644 struct i915_vma *vma; in i915_gem_obj_to_ggtt_view() local
4649 list_for_each_entry(vma, &obj->vma_list, vma_link) in i915_gem_obj_to_ggtt_view()
4650 if (vma->vm == ggtt && in i915_gem_obj_to_ggtt_view()
4651 i915_ggtt_view_equal(&vma->ggtt_view, view)) in i915_gem_obj_to_ggtt_view()
4652 return vma; in i915_gem_obj_to_ggtt_view()
4656 void i915_gem_vma_destroy(struct i915_vma *vma) in i915_gem_vma_destroy() argument
4659 WARN_ON(vma->node.allocated); in i915_gem_vma_destroy()
4662 if (!list_empty(&vma->exec_list)) in i915_gem_vma_destroy()
4665 vm = vma->vm; in i915_gem_vma_destroy()
4670 list_del(&vma->vma_link); in i915_gem_vma_destroy()
4672 kmem_cache_free(to_i915(vma->obj->base.dev)->vmas, vma); in i915_gem_vma_destroy()
5228 struct i915_vma *vma; in i915_gem_obj_offset() local
5232 list_for_each_entry(vma, &o->vma_list, vma_link) { in i915_gem_obj_offset()
5233 if (i915_is_ggtt(vma->vm) && in i915_gem_obj_offset()
5234 vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) in i915_gem_obj_offset()
5236 if (vma->vm == vm) in i915_gem_obj_offset()
5237 return vma->node.start; in i915_gem_obj_offset()
5249 struct i915_vma *vma; in i915_gem_obj_ggtt_offset_view() local
5251 list_for_each_entry(vma, &o->vma_list, vma_link) in i915_gem_obj_ggtt_offset_view()
5252 if (vma->vm == ggtt && in i915_gem_obj_ggtt_offset_view()
5253 i915_ggtt_view_equal(&vma->ggtt_view, view)) in i915_gem_obj_ggtt_offset_view()
5254 return vma->node.start; in i915_gem_obj_ggtt_offset_view()
5263 struct i915_vma *vma; in i915_gem_obj_bound() local
5265 list_for_each_entry(vma, &o->vma_list, vma_link) { in i915_gem_obj_bound()
5266 if (i915_is_ggtt(vma->vm) && in i915_gem_obj_bound()
5267 vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) in i915_gem_obj_bound()
5269 if (vma->vm == vm && drm_mm_node_allocated(&vma->node)) in i915_gem_obj_bound()
5280 struct i915_vma *vma; in i915_gem_obj_ggtt_bound_view() local
5282 list_for_each_entry(vma, &o->vma_list, vma_link) in i915_gem_obj_ggtt_bound_view()
5283 if (vma->vm == ggtt && in i915_gem_obj_ggtt_bound_view()
5284 i915_ggtt_view_equal(&vma->ggtt_view, view) && in i915_gem_obj_ggtt_bound_view()
5285 drm_mm_node_allocated(&vma->node)) in i915_gem_obj_ggtt_bound_view()
5293 struct i915_vma *vma; in i915_gem_obj_bound_any() local
5295 list_for_each_entry(vma, &o->vma_list, vma_link) in i915_gem_obj_bound_any()
5296 if (drm_mm_node_allocated(&vma->node)) in i915_gem_obj_bound_any()
5306 struct i915_vma *vma; in i915_gem_obj_size() local
5312 list_for_each_entry(vma, &o->vma_list, vma_link) { in i915_gem_obj_size()
5313 if (i915_is_ggtt(vma->vm) && in i915_gem_obj_size()
5314 vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) in i915_gem_obj_size()
5316 if (vma->vm == vm) in i915_gem_obj_size()
5317 return vma->node.size; in i915_gem_obj_size()
5324 struct i915_vma *vma; in i915_gem_obj_is_pinned() local
5325 list_for_each_entry(vma, &obj->vma_list, vma_link) in i915_gem_obj_is_pinned()
5326 if (vma->pin_count > 0) in i915_gem_obj_is_pinned()