Lines Matching +full:low +full:- +full:vt

1 // SPDX-License-Identifier: MIT
7 #include <linux/slab.h> /* fault-inject.h is not standalone! */
9 #include <linux/fault-inject.h>
31 if (dma_map_sg_attrs(&obj->base.dev->pdev->dev, in i915_gem_gtt_prepare_pages()
32 pages->sgl, pages->nents, in i915_gem_gtt_prepare_pages()
43 * try again - if there are no more pages to remove from in i915_gem_gtt_prepare_pages()
46 GEM_BUG_ON(obj->mm.pages == pages); in i915_gem_gtt_prepare_pages()
47 } while (i915_gem_shrink(to_i915(obj->base.dev), in i915_gem_gtt_prepare_pages()
48 obj->base.size >> PAGE_SHIFT, NULL, in i915_gem_gtt_prepare_pages()
52 return -ENOSPC; in i915_gem_gtt_prepare_pages()
58 struct drm_i915_private *dev_priv = to_i915(obj->base.dev); in i915_gem_gtt_finish_pages()
59 struct device *kdev = &dev_priv->drm.pdev->dev; in i915_gem_gtt_finish_pages()
60 struct i915_ggtt *ggtt = &dev_priv->ggtt; in i915_gem_gtt_finish_pages()
62 if (unlikely(ggtt->do_idle_maps)) { in i915_gem_gtt_finish_pages()
64 if (intel_gt_retire_requests_timeout(ggtt->vm.gt, in i915_gem_gtt_finish_pages()
65 -MAX_SCHEDULE_TIMEOUT)) { in i915_gem_gtt_finish_pages()
66 drm_err(&dev_priv->drm, in i915_gem_gtt_finish_pages()
67 "Failed to wait for idle; VT'd may hang.\n"); in i915_gem_gtt_finish_pages()
73 dma_unmap_sg(kdev, pages->sgl, pages->nents, PCI_DMA_BIDIRECTIONAL); in i915_gem_gtt_finish_pages()
77 * i915_gem_gtt_reserve - reserve a node in an address_space (GTT)
98 * Returns: 0 on success, -ENOSPC if no suitable hole is found, -EINTR if
111 GEM_BUG_ON(range_overflows(offset, size, vm->total)); in i915_gem_gtt_reserve()
112 GEM_BUG_ON(vm == &vm->i915->ggtt.alias->vm); in i915_gem_gtt_reserve()
115 node->size = size; in i915_gem_gtt_reserve()
116 node->start = offset; in i915_gem_gtt_reserve()
117 node->color = color; in i915_gem_gtt_reserve()
119 err = drm_mm_reserve_node(&vm->mm, node); in i915_gem_gtt_reserve()
120 if (err != -ENOSPC) in i915_gem_gtt_reserve()
124 return -ENOSPC; in i915_gem_gtt_reserve()
128 err = drm_mm_reserve_node(&vm->mm, node); in i915_gem_gtt_reserve()
138 GEM_BUG_ON(round_up(start, align) > round_down(end - len, align)); in random_offset()
140 range = round_down(end - len, align) - round_up(start, align); in random_offset()
159 * i915_gem_gtt_insert - insert a node into an address_space (GTT)
165 * if specified, this must be a power-of-two and at least
189 * Returns: 0 on success, -ENOSPC if no suitable hole is found, -EINTR if
201 lockdep_assert_held(&vm->mutex); in i915_gem_gtt_insert()
210 GEM_BUG_ON(vm == &vm->i915->ggtt.alias->vm); in i915_gem_gtt_insert()
214 return -ENOSPC; in i915_gem_gtt_insert()
216 if (unlikely(round_up(start, alignment) > round_down(end - size, alignment))) in i915_gem_gtt_insert()
217 return -ENOSPC; in i915_gem_gtt_insert()
235 err = drm_mm_insert_node_in_range(&vm->mm, node, in i915_gem_gtt_insert()
238 if (err != -ENOSPC) in i915_gem_gtt_insert()
242 err = drm_mm_insert_node_in_range(&vm->mm, node, in i915_gem_gtt_insert()
246 if (err != -ENOSPC) in i915_gem_gtt_insert()
251 return -ENOSPC; in i915_gem_gtt_insert()
257 * mmap and GPU (i.e. ggtt/aliasing_ppgtt but not full-ppgtt): in i915_gem_gtt_insert()
259 * |<-- 256 MiB aperture -->||<-- 1792 MiB unmappable -->| in i915_gem_gtt_insert()
262 * Now imagine that the eviction LRU is ordered top-down (just because in i915_gem_gtt_insert()
269 * On a full-ppgtt system, if we have run out of available space, there in i915_gem_gtt_insert()
272 * range restrictions (e.g. restriction to low 4GiB) and so, for in i915_gem_gtt_insert()
279 if (err != -ENOSPC) in i915_gem_gtt_insert()
283 return -ENOSPC; in i915_gem_gtt_insert()
291 return drm_mm_insert_node_in_range(&vm->mm, node, in i915_gem_gtt_insert()