Lines Matching refs:bind_op
184 static int pvr_vm_bind_op_exec(struct pvr_vm_bind_op *bind_op) in pvr_vm_bind_op_exec() argument
186 switch (bind_op->type) { in pvr_vm_bind_op_exec()
188 return drm_gpuvm_sm_map(&bind_op->vm_ctx->gpuvm_mgr, in pvr_vm_bind_op_exec()
189 bind_op, bind_op->device_addr, in pvr_vm_bind_op_exec()
190 bind_op->size, in pvr_vm_bind_op_exec()
191 gem_from_pvr_gem(bind_op->pvr_obj), in pvr_vm_bind_op_exec()
192 bind_op->offset); in pvr_vm_bind_op_exec()
195 return drm_gpuvm_sm_unmap(&bind_op->vm_ctx->gpuvm_mgr, in pvr_vm_bind_op_exec()
196 bind_op, bind_op->device_addr, in pvr_vm_bind_op_exec()
197 bind_op->size); in pvr_vm_bind_op_exec()
208 static void pvr_vm_bind_op_fini(struct pvr_vm_bind_op *bind_op) in pvr_vm_bind_op_fini() argument
210 drm_gpuvm_bo_put(bind_op->gpuvm_bo); in pvr_vm_bind_op_fini()
212 kfree(bind_op->new_va); in pvr_vm_bind_op_fini()
213 kfree(bind_op->prev_va); in pvr_vm_bind_op_fini()
214 kfree(bind_op->next_va); in pvr_vm_bind_op_fini()
216 if (bind_op->pvr_obj) in pvr_vm_bind_op_fini()
217 pvr_gem_object_put(bind_op->pvr_obj); in pvr_vm_bind_op_fini()
219 if (bind_op->mmu_op_ctx) in pvr_vm_bind_op_fini()
220 pvr_mmu_op_context_destroy(bind_op->mmu_op_ctx); in pvr_vm_bind_op_fini()
224 pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op, in pvr_vm_bind_op_map_init() argument
249 bind_op->type = PVR_VM_BIND_TYPE_MAP; in pvr_vm_bind_op_map_init()
252 bind_op->gpuvm_bo = drm_gpuvm_bo_obtain(&vm_ctx->gpuvm_mgr, obj); in pvr_vm_bind_op_map_init()
254 if (IS_ERR(bind_op->gpuvm_bo)) in pvr_vm_bind_op_map_init()
255 return PTR_ERR(bind_op->gpuvm_bo); in pvr_vm_bind_op_map_init()
257 bind_op->new_va = kzalloc(sizeof(*bind_op->new_va), GFP_KERNEL); in pvr_vm_bind_op_map_init()
258 bind_op->prev_va = kzalloc(sizeof(*bind_op->prev_va), GFP_KERNEL); in pvr_vm_bind_op_map_init()
259 bind_op->next_va = kzalloc(sizeof(*bind_op->next_va), GFP_KERNEL); in pvr_vm_bind_op_map_init()
260 if (!bind_op->new_va || !bind_op->prev_va || !bind_op->next_va) { in pvr_vm_bind_op_map_init()
271 bind_op->mmu_op_ctx = in pvr_vm_bind_op_map_init()
273 err = PTR_ERR_OR_ZERO(bind_op->mmu_op_ctx); in pvr_vm_bind_op_map_init()
275 bind_op->mmu_op_ctx = NULL; in pvr_vm_bind_op_map_init()
279 bind_op->pvr_obj = pvr_obj; in pvr_vm_bind_op_map_init()
280 bind_op->vm_ctx = vm_ctx; in pvr_vm_bind_op_map_init()
281 bind_op->device_addr = device_addr; in pvr_vm_bind_op_map_init()
282 bind_op->size = size; in pvr_vm_bind_op_map_init()
283 bind_op->offset = offset; in pvr_vm_bind_op_map_init()
288 pvr_vm_bind_op_fini(bind_op); in pvr_vm_bind_op_map_init()
294 pvr_vm_bind_op_unmap_init(struct pvr_vm_bind_op *bind_op, in pvr_vm_bind_op_unmap_init() argument
303 bind_op->type = PVR_VM_BIND_TYPE_UNMAP; in pvr_vm_bind_op_unmap_init()
305 bind_op->prev_va = kzalloc(sizeof(*bind_op->prev_va), GFP_KERNEL); in pvr_vm_bind_op_unmap_init()
306 bind_op->next_va = kzalloc(sizeof(*bind_op->next_va), GFP_KERNEL); in pvr_vm_bind_op_unmap_init()
307 if (!bind_op->prev_va || !bind_op->next_va) { in pvr_vm_bind_op_unmap_init()
312 bind_op->mmu_op_ctx = in pvr_vm_bind_op_unmap_init()
314 err = PTR_ERR_OR_ZERO(bind_op->mmu_op_ctx); in pvr_vm_bind_op_unmap_init()
316 bind_op->mmu_op_ctx = NULL; in pvr_vm_bind_op_unmap_init()
320 bind_op->vm_ctx = vm_ctx; in pvr_vm_bind_op_unmap_init()
321 bind_op->device_addr = device_addr; in pvr_vm_bind_op_unmap_init()
322 bind_op->size = size; in pvr_vm_bind_op_unmap_init()
327 pvr_vm_bind_op_fini(bind_op); in pvr_vm_bind_op_unmap_init()
691 struct pvr_vm_bind_op *bind_op = vm_exec->extra.priv; in pvr_vm_lock_extra() local
692 struct pvr_gem_object *pvr_obj = bind_op->pvr_obj; in pvr_vm_lock_extra()
728 struct pvr_vm_bind_op bind_op = {0}; in pvr_vm_map() local
735 .priv = &bind_op, in pvr_vm_map()
739 int err = pvr_vm_bind_op_map_init(&bind_op, vm_ctx, pvr_obj, in pvr_vm_map()
752 err = pvr_vm_bind_op_exec(&bind_op); in pvr_vm_map()
757 pvr_vm_bind_op_fini(&bind_op); in pvr_vm_map()
779 struct pvr_vm_bind_op bind_op = {0}; in pvr_vm_unmap() local
786 .priv = &bind_op, in pvr_vm_unmap()
790 int err = pvr_vm_bind_op_unmap_init(&bind_op, vm_ctx, device_addr, in pvr_vm_unmap()
799 err = pvr_vm_bind_op_exec(&bind_op); in pvr_vm_unmap()
804 pvr_vm_bind_op_fini(&bind_op); in pvr_vm_unmap()