Skip to content

Commit

Permalink
dma-buf: Move dma_buf_vmap() to dynamic locking specification
Browse files Browse the repository at this point in the history
Move dma_buf_vmap/vunmap() functions to the dynamic locking
specification by asserting that the reservation lock is held.

Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221017172229.42269-16-dmitry.osipenko@collabora.com
  • Loading branch information
Dmitry Osipenko committed Oct 17, 2022
1 parent 50f0ddc commit 34c7797
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,8 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
if (WARN_ON(!dmabuf))
return -EINVAL;

dma_resv_assert_held(dmabuf->resv);

if (!dmabuf->ops->vmap)
return -EINVAL;

Expand Down Expand Up @@ -1515,6 +1517,8 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map)
if (WARN_ON(!dmabuf))
return;

dma_resv_assert_held(dmabuf->resv);

BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr));
BUG_ON(dmabuf->vmapping_counter == 0);
BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map));
Expand Down

0 comments on commit 34c7797

Please sign in to comment.