summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2020-12-14 18:16:22 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2020-12-16 11:28:34 +0100
commit8ccf0a29af75326fb8e5ed6e51ff61e74b7ed2e4 (patch)
treedb0563b230c1ec4f7248fcc88a28f00cd1f3a8d5
parentdma-buf: some kerneldoc formatting fixes (diff)
downloadlinux-8ccf0a29af75326fb8e5ed6e51ff61e74b7ed2e4.tar.xz
linux-8ccf0a29af75326fb8e5ed6e51ff61e74b7ed2e4.zip
dma-buf: begin/end_cpu might lock the dma_resv lock
At least amdgpu and i915 do, so lets just document this as the rule. v2: Works better with less typos (intel-gfx-ci) Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: "Christian König" <christian.koenig@amd.com> Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Link: https://patchwork.freedesktop.org/patch/msgid/20201214171622.3868883-1-daniel.vetter@ffwll.ch
-rw-r--r--drivers/dma-buf/dma-buf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index e1fa6c6f02c4..a0a02ef888da 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -1118,6 +1118,8 @@ int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
if (WARN_ON(!dmabuf))
return -EINVAL;
+ might_lock(&dmabuf->resv->lock.base);
+
if (dmabuf->ops->begin_cpu_access)
ret = dmabuf->ops->begin_cpu_access(dmabuf, direction);
@@ -1151,6 +1153,8 @@ int dma_buf_end_cpu_access(struct dma_buf *dmabuf,
WARN_ON(!dmabuf);
+ might_lock(&dmabuf->resv->lock.base);
+
if (dmabuf->ops->end_cpu_access)
ret = dmabuf->ops->end_cpu_access(dmabuf, direction);