OSDN Git Service

dma-buf: add dynamic DMA-buf handling v15
authorChristian König <christian.koenig@amd.com>
Tue, 3 Jul 2018 14:42:26 +0000 (16:42 +0200)
committerChristian König <christian.koenig@amd.com>
Thu, 27 Feb 2020 13:58:00 +0000 (14:58 +0100)
commitbb42df4662a4476531147c3d9caa1940f7ad36bb
treec1473eb93403a91ca659e0d2fabe9a4cb6a75f4d
parent258145ea35848aed63623bb4b54a7db929b926eb
dma-buf: add dynamic DMA-buf handling v15

On the exporter side we add optional explicit pinning callbacks. Which are
called when the importer doesn't implement dynamic handling, move notification
or need the DMA-buf locked in place for its use case.

On the importer side we add an optional move_notify callback. This callback is
used by the exporter to inform the importers that their mappings should be
destroyed as soon as possible.

This allows the exporter to provide the mappings without the need to pin
the backing store.

v2: don't try to invalidate mappings when the callback is NULL,
    lock the reservation obj while using the attachments,
    add helper to set the callback
v3: move flag for invalidation support into the DMA-buf,
    use new attach_info structure to set the callback
v4: use importer_priv field instead of mangling exporter priv.
v5: drop invalidation_supported flag
v6: squash together with pin/unpin changes
v7: pin/unpin takes an attachment now
v8: nuke dma_buf_attachment_(map|unmap)_locked,
    everything is now handled backward compatible
v9: always cache when export/importer don't agree on dynamic handling
v10: minimal style cleanup
v11: drop automatically re-entry avoidance
v12: rename callback to move_notify
v13: add might_lock in appropriate places
v14: rebase on separated locking change
v15: add EXPERIMENTAL flag, some more code comments

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/353993/?series=73646&rev=1
drivers/dma-buf/Kconfig
drivers/dma-buf/dma-buf.c
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
include/linux/dma-buf.h