drm/msm: Disallow foreign mapping of _NO_SHARE
Rob Clark
maintainerPATCH 1/2 drm/msm: Disallow foreign mapping of _NO_SHARE
This restriction applies to mapping of _NO_SHARE objs in the kms vm as well as importing/exporting BOs. Since the DPU has it's own VM, scanout counts as "exporting" a BO from outside of it's host VM.
--- drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/msm/msm_gem_vma.c +6 -0
@@ -373,6 +373,12 @@ msm_gem_vma_new(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj,struct msm_gem_vma *vma;int ret; +/* _NO_SHARE objs cannot be mapped outside of their "host" vm: */ +if ((to_msm_bo (obj)->flags &MSM_BO_NO_SHARE ) && +GEM_WARN_ON (obj->resv !=drm_gpuvm_resv (gpuvm))) { +return ERR_PTR (-EINVAL ); + } +drm_gpuvm_resv_assert_held (&vm->base); vma =kzalloc (sizeof (*vma),GFP_KERNEL );
Signature · 1 line
2.53.0
Rob Clark
maintainerPATCH 2/2 drm/msm: Fix VM_BIND UNMAP locking
Wrong argument meant that the objs involved in UNMAP ops were not always getting locked.
Since _NO_SHARE objs share a common resv with the VM (which is always locked) this would only show up with non-_NO_SHARE BOs.
--- drivers/gpu/drm/msm/msm_gem_vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gem_vma.c +1 -1
@@ -1251,7 +1251,7 @@ vm_bind_job_lock_objects(struct msm_vm_bind_job *job, struct drm_exec *exec)case MSM_VM_BIND_OP_UNMAP : ret =drm_gpuvm_sm_unmap_exec_lock (job->vm, exec, op->iova, - op->obj_offset); + op->range);break ;case MSM_VM_BIND_OP_MAP :case MSM_VM_BIND_OP_MAP_NULL : {
Signature · 1 line
2.53.0
Re: [PATCH 2/2] drm/msm: Fix VM_BIND UNMAP locking
Quoted 7 lines · Rob Clark
Wrong argument meant that the objs involved in UNMAP ops were not always getting locked.
Since
_NO_SHAREobjs share a common resv with the VM (which is always locked) this would only show up with non-_NO_SHARE BOs.
Quoted 21 lines
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/msm_gem_vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/msm_gem_vma.c +1
-2@@ -1251,7 +1251,7 @@ vm_bind_job_lock_objects(struct msm_vm_bind_job *job, struct drm_exec *exec)case MSM_VM_BIND_OP_UNMAP : ret =drm_gpuvm_sm_unmap_exec_lock (job->vm, exec, op->iova, - op->obj_offset); + op->range);break ;case MSM_VM_BIND_OP_MAP :case MSM_VM_BIND_OP_MAP_NULL : { --2.53.0