mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-27 18:41:56 +07:00
drm/udl: Don't call get/put_pages on imported dma-buf
There's no direct harm, because for the shmem helpers these are noops on imported buffers. The trouble is in the locks these take - I want to change dma_buf_vmap locking, and so need to make sure that we only ever take certain locks on one side of the dma-buf interface: Either for exporters, or for importers. Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Sean Paul <sean@poorly.run> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-6-daniel.vetter@ffwll.ch
This commit is contained in:
parent
d323bb44e4
commit
3a5a5971bc
@ -46,29 +46,31 @@ static void *udl_gem_object_vmap(struct drm_gem_object *obj)
|
||||
if (shmem->vmap_use_count++ > 0)
|
||||
goto out;
|
||||
|
||||
ret = drm_gem_shmem_get_pages(shmem);
|
||||
if (ret)
|
||||
goto err_zero_use;
|
||||
|
||||
if (obj->import_attach)
|
||||
if (obj->import_attach) {
|
||||
shmem->vaddr = dma_buf_vmap(obj->import_attach->dmabuf);
|
||||
else
|
||||
} else {
|
||||
ret = drm_gem_shmem_get_pages(shmem);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
shmem->vaddr = vmap(shmem->pages, obj->size >> PAGE_SHIFT,
|
||||
VM_MAP, PAGE_KERNEL);
|
||||
|
||||
if (!shmem->vaddr)
|
||||
drm_gem_shmem_put_pages(shmem);
|
||||
}
|
||||
|
||||
if (!shmem->vaddr) {
|
||||
DRM_DEBUG_KMS("Failed to vmap pages\n");
|
||||
ret = -ENOMEM;
|
||||
goto err_put_pages;
|
||||
goto err;
|
||||
}
|
||||
|
||||
out:
|
||||
mutex_unlock(&shmem->vmap_lock);
|
||||
return shmem->vaddr;
|
||||
|
||||
err_put_pages:
|
||||
drm_gem_shmem_put_pages(shmem);
|
||||
err_zero_use:
|
||||
err:
|
||||
shmem->vmap_use_count = 0;
|
||||
mutex_unlock(&shmem->vmap_lock);
|
||||
return ERR_PTR(ret);
|
||||
|
Loading…
Reference in New Issue
Block a user