Skip to content

Commit 611dc3b

Browse files
committed
drm/gpuvm: Support immediate mode in drm_gpuvm_bo_unmap()
In DRM_GPUVM_IMMEDIATE_MODE drm core is able to lock the gem object's gpuva.lock instead of relying on the caller locking the dma_resv lock. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent a5b8fe7 commit 611dc3b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/gpu/drm/drm_gpuvm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_prefetch_ops_create);
30343034
int
30353035
drm_gpuvm_bo_unmap(struct drm_gpuvm_bo *vm_bo, void *priv)
30363036
{
3037+
struct drm_gpuva_ops *ops;
30373038
struct drm_gpuva_op *op;
30383039
int ret;
30393040

@@ -3045,7 +3046,12 @@ drm_gpuvm_bo_unmap(struct drm_gpuvm_bo *vm_bo, void *priv)
30453046
if (unlikely(!(vm_ops && vm_ops->sm_step_unmap)))
30463047
return -EINVAL;
30473048

3048-
struct drm_gpuva_ops *ops = drm_gpuvm_bo_unmap_ops_create(vm_bo);
3049+
if (drm_gpuvm_immediate_mode(vm_bo->vm)) {
3050+
guard(mutex)(&vm_bo->obj->gpuva.lock);
3051+
ops = drm_gpuvm_bo_unmap_ops_create(vm_bo);
3052+
} else {
3053+
ops = drm_gpuvm_bo_unmap_ops_create(vm_bo);
3054+
}
30493055
if (IS_ERR(ops))
30503056
return PTR_ERR(ops);
30513057

0 commit comments

Comments
 (0)