Lines Matching refs:vma

41 bool msm_gem_vma_inuse(struct msm_gem_vma *vma)  in msm_gem_vma_inuse()  argument
43 if (vma->inuse > 0) in msm_gem_vma_inuse()
46 while (vma->fence_mask) { in msm_gem_vma_inuse()
47 unsigned idx = ffs(vma->fence_mask) - 1; in msm_gem_vma_inuse()
49 if (!msm_fence_completed(vma->fctx[idx], vma->fence[idx])) in msm_gem_vma_inuse()
52 vma->fence_mask &= ~BIT(idx); in msm_gem_vma_inuse()
60 struct msm_gem_vma *vma) in msm_gem_purge_vma() argument
62 unsigned size = vma->node.size; in msm_gem_purge_vma()
65 GEM_WARN_ON(msm_gem_vma_inuse(vma)); in msm_gem_purge_vma()
68 if (!vma->mapped) in msm_gem_purge_vma()
72 aspace->mmu->funcs->unmap(aspace->mmu, vma->iova, size); in msm_gem_purge_vma()
74 vma->mapped = false; in msm_gem_purge_vma()
78 void msm_gem_unpin_vma(struct msm_gem_vma *vma) in msm_gem_unpin_vma() argument
80 if (GEM_WARN_ON(!vma->inuse)) in msm_gem_unpin_vma()
82 if (!GEM_WARN_ON(!vma->iova)) in msm_gem_unpin_vma()
83 vma->inuse--; in msm_gem_unpin_vma()
87 void msm_gem_unpin_vma_fenced(struct msm_gem_vma *vma, struct msm_fence_context *fctx) in msm_gem_unpin_vma_fenced() argument
89 vma->fctx[fctx->index] = fctx; in msm_gem_unpin_vma_fenced()
90 vma->fence[fctx->index] = fctx->last_fence; in msm_gem_unpin_vma_fenced()
91 vma->fence_mask |= BIT(fctx->index); in msm_gem_unpin_vma_fenced()
92 msm_gem_unpin_vma(vma); in msm_gem_unpin_vma_fenced()
98 struct msm_gem_vma *vma, int prot, in msm_gem_map_vma() argument
103 if (GEM_WARN_ON(!vma->iova)) in msm_gem_map_vma()
107 vma->inuse++; in msm_gem_map_vma()
109 if (vma->mapped) in msm_gem_map_vma()
112 vma->mapped = true; in msm_gem_map_vma()
115 ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, in msm_gem_map_vma()
119 vma->mapped = false; in msm_gem_map_vma()
120 vma->inuse--; in msm_gem_map_vma()
128 struct msm_gem_vma *vma) in msm_gem_close_vma() argument
130 GEM_WARN_ON(msm_gem_vma_inuse(vma) || vma->mapped); in msm_gem_close_vma()
133 if (vma->iova) in msm_gem_close_vma()
134 drm_mm_remove_node(&vma->node); in msm_gem_close_vma()
137 vma->iova = 0; in msm_gem_close_vma()
144 struct msm_gem_vma *vma, int size, in msm_gem_init_vma() argument
149 if (GEM_WARN_ON(vma->iova)) in msm_gem_init_vma()
153 ret = drm_mm_insert_node_in_range(&aspace->mm, &vma->node, in msm_gem_init_vma()
161 vma->iova = vma->node.start; in msm_gem_init_vma()
162 vma->mapped = false; in msm_gem_init_vma()