Skip to content

Commit 87e332d

Browse files
committed
dma-buf: Update docs for SYNC ioctl
Just a bit of wording polish plus mentioning that it can fail and must be restarted. Requested by Sumit. v2: Fix them typos (Hans). Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tiago Vignatti <tiago.vignatti@intel.com> Cc: Stéphane Marchesin <marcheu@chromium.org> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Daniel Vetter <daniel.vetter@intel.com> CC: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-sig@lists.linaro.org Cc: intel-gfx@lists.freedesktop.org Cc: devel@driverdev.osuosl.org Cc: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: Sumit Semwal <sumit.semwal@linaro.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
1 parent 3c66f4a commit 87e332d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Documentation/dma-buf-sharing.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases:
352352

353353
No special interfaces, userspace simply calls mmap on the dma-buf fd, making
354354
sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always*
355-
used when the access happens. This is discussed next paragraphs.
355+
used when the access happens. Note that DMA_BUF_IOCTL_SYNC can fail with
356+
-EAGAIN or -EINTR, in which case it must be restarted.
356357

357358
Some systems might need some sort of cache coherency management e.g. when
358359
CPU and GPU domains are being accessed through dma-buf at the same time. To
@@ -366,10 +367,10 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases:
366367
want (with the new data being consumed by the GPU or say scanout device)
367368
- munmap once you don't need the buffer any more
368369

369-
Therefore, for correctness and optimal performance, systems with the memory
370-
cache shared by the GPU and CPU i.e. the "coherent" and also the
371-
"incoherent" are always required to use SYNC_START and SYNC_END before and
372-
after, respectively, when accessing the mapped address.
370+
For correctness and optimal performance, it is always required to use
371+
SYNC_START and SYNC_END before and after, respectively, when accessing the
372+
mapped address. Userspace cannot rely on coherent access, even when there
373+
are systems where it just works without calling these ioctls.
373374

374375
2. Supporting existing mmap interfaces in importers
375376

drivers/dma-buf/dma-buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access);
612612
* @dmabuf: [in] buffer to complete cpu access for.
613613
* @direction: [in] length of range for cpu access.
614614
*
615-
* This call must always succeed.
615+
* Can return negative error values, returns 0 on success.
616616
*/
617617
int dma_buf_end_cpu_access(struct dma_buf *dmabuf,
618618
enum dma_data_direction direction)

0 commit comments

Comments
 (0)