Skip to content
Commit 1ffe0959 authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann
Browse files

udmabuf: fix dma-buf cpu access



I'm just going to put Chia's review comment here since it sums
the issue rather nicely:

"(1) Semantically, a dma-buf is in DMA domain.  CPU access from the
importer must be surrounded by {begin,end}_cpu_access.  This gives the
exporter a chance to move the buffer to the CPU domain temporarily.

(2) When the exporter itself has other means to do CPU access, it is
only reasonable for the exporter to move the buffer to the CPU domain
before access, and to the DMA domain after access.  The exporter can
potentially reuse {begin,end}_cpu_access for that purpose.

Because of (1), udmabuf does need to implement the
{begin,end}_cpu_access hooks.  But "begin" should mean
dma_sync_sg_for_cpu and "end" should mean dma_sync_sg_for_device.

Because of (2), if userspace wants to continuing accessing through the
memfd mapping, it should call udmabuf's {begin,end}_cpu_access to
avoid cache issues."

Reported-by: default avatarChia-I Wu <olvaffe@gmail.com>
Suggested-by: default avatarChia-I Wu <olvaffe@gmail.com>
Fixes: 284562e1

 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks")
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191217230228.453-1-gurchetansingh@chromium.org
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent c8d4a560
  • mirror @mirror

    mentioned in commit a140fd1efe7f82c9095cc4342ce228e000f3be9a

    ·

    mentioned in commit a140fd1efe7f82c9095cc4342ce228e000f3be9a

    Toggle commit list
  • mirror @mirror

    mentioned in commit 153f1e1d

    ·

    mentioned in commit 153f1e1d

    Toggle commit list
  • mirror @mirror

    mentioned in commit 25460db7f157da7cb88fa5d684e075ac0f7ff659

    ·

    mentioned in commit 25460db7f157da7cb88fa5d684e075ac0f7ff659

    Toggle commit list
  • mirror @mirror

    mentioned in commit 55760d77936fb545abba7779c29fc40e91009a9d

    ·

    mentioned in commit 55760d77936fb545abba7779c29fc40e91009a9d

    Toggle commit list
  • mirror @mirror

    mentioned in commit 47f026d40d63043a1ea3b3267c7d9ecc57435fa9

    ·

    mentioned in commit 47f026d40d63043a1ea3b3267c7d9ecc57435fa9

    Toggle commit list
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment