]> git.karo-electronics.de Git - karo-tx-linux.git/commit
dma-buf: implement vmap refcounting in the interface logic
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 20 Dec 2012 13:14:23 +0000 (14:14 +0100)
committerSumit Semwal <sumit.semwal@linaro.org>
Tue, 19 Feb 2013 10:24:46 +0000 (15:54 +0530)
commit58d7343609e32a727a01647614edad1632947a7e
treeed85be2e85f51898f57fd54d1d9e3043656d6555
parent671b716af984442fec9816eaca8235b8da305c58
dma-buf: implement vmap refcounting in the interface logic

All drivers which implement this need to have some sort of refcount to
allow concurrent vmap usage. Hence implement this in the dma-buf core.

To protect against concurrent calls we need a lock, which potentially
causes new funny locking inversions. But this shouldn't be a problem
for exporters with statically allocated backing storage, and more
dynamic drivers have decent issues already anyway.

Inspired by some refactoring patches from Aaron Plattner, who
implemented the same idea, but only for drm/prime drivers.

v2: Check in dma_buf_release that no dangling vmaps are left.
Suggested by Aaron Plattner. We might want to do similar checks for
attachments, but that's for another patch. Also fix up ERR_PTR return
for vmap.

v3: Check whether the passed-in vmap address matches with the cached
one for vunmap. Eventually we might want to remove that parameter -
compared to the kmap functions there's no need for the vaddr for
unmapping.  Suggested by Chris Wilson.

v4: Fix a brown-paper-bag bug spotted by Aaron Plattner.

Cc: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Documentation/dma-buf-sharing.txt
drivers/base/dma-buf.c
include/linux/dma-buf.h