Skip to content

Commit

Permalink
drm/shmem-helper: Add lockdep asserts to vmap/vunmap
Browse files Browse the repository at this point in the history
Since commit 21aa27d ("drm/shmem-helper: Switch to reservation
lock"), the drm_gem_shmem_vmap and drm_gem_shmem_vunmap functions
require that the caller holds the DMA reservation lock for the object.
Add lockdep assertions to help validate this.

Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina committed Nov 22, 2023
1 parent 1695a7e commit 23a2ffd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/drm_gem_shmem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem,
struct drm_gem_object *obj = &shmem->base;
int ret = 0;

dma_resv_assert_held(obj->resv);

if (obj->import_attach) {
ret = dma_buf_vmap(obj->import_attach->dmabuf, map);
if (!ret) {
Expand Down Expand Up @@ -379,6 +381,8 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
{
struct drm_gem_object *obj = &shmem->base;

dma_resv_assert_held(obj->resv);

if (obj->import_attach) {
dma_buf_vunmap(obj->import_attach->dmabuf, map);
} else {
Expand Down

0 comments on commit 23a2ffd

Please sign in to comment.