Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -6
+6 -5
Documentation/dma-buf-sharing.txt
··· 352 352 353 353 No special interfaces, userspace simply calls mmap on the dma-buf fd, making 354 354 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. 356 357 357 358 Some systems might need some sort of cache coherency management e.g. when 358 359 CPU and GPU domains are being accessed through dma-buf at the same time. To ··· 367 366 want (with the new data being consumed by the GPU or say scanout device) 368 367 - munmap once you don't need the buffer any more 369 368 370 - Therefore, for correctness and optimal performance, systems with the memory 371 - cache shared by the GPU and CPU i.e. the "coherent" and also the 372 - "incoherent" are always required to use SYNC_START and SYNC_END before and 373 - after, respectively, when accessing the mapped address. 369 + For correctness and optimal performance, it is always required to use 370 + SYNC_START and SYNC_END before and after, respectively, when accessing the 371 + mapped address. Userspace cannot rely on coherent access, even when there 372 + are systems where it just works without calling these ioctls. 374 373 375 374 2. Supporting existing mmap interfaces in importers 376 375
+1 -1
drivers/dma-buf/dma-buf.c
··· 612 612 * @dmabuf: [in] buffer to complete cpu access for. 613 613 * @direction: [in] length of range for cpu access. 614 614 * 615 - * This call must always succeed. 615 + * Can return negative error values, returns 0 on success. 616 616 */ 617 617 int dma_buf_end_cpu_access(struct dma_buf *dmabuf, 618 618 enum dma_data_direction direction)