dma-buf: add peer2peer flag
Add a peer2peer flag noting that the importer can deal with device resources which are not backed by pages. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Sumit Semwal <sumit.semwal@linaro.org> Link: https://patchwork.freedesktop.org/patch/359286/
This commit is contained in:
@@ -690,6 +690,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
|
|||||||
|
|
||||||
attach->dev = dev;
|
attach->dev = dev;
|
||||||
attach->dmabuf = dmabuf;
|
attach->dmabuf = dmabuf;
|
||||||
|
if (importer_ops)
|
||||||
|
attach->peer2peer = importer_ops->allow_peer2peer;
|
||||||
attach->importer_ops = importer_ops;
|
attach->importer_ops = importer_ops;
|
||||||
attach->importer_priv = importer_priv;
|
attach->importer_priv = importer_priv;
|
||||||
|
|
||||||
|
|||||||
@@ -334,6 +334,14 @@ struct dma_buf {
|
|||||||
* Attachment operations implemented by the importer.
|
* Attachment operations implemented by the importer.
|
||||||
*/
|
*/
|
||||||
struct dma_buf_attach_ops {
|
struct dma_buf_attach_ops {
|
||||||
|
/**
|
||||||
|
* @allow_peer2peer:
|
||||||
|
*
|
||||||
|
* If this is set to true the importer must be able to handle peer
|
||||||
|
* resources without struct pages.
|
||||||
|
*/
|
||||||
|
bool allow_peer2peer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @move_notify
|
* @move_notify
|
||||||
*
|
*
|
||||||
@@ -362,6 +370,7 @@ struct dma_buf_attach_ops {
|
|||||||
* @node: list of dma_buf_attachment, protected by dma_resv lock of the dmabuf.
|
* @node: list of dma_buf_attachment, protected by dma_resv lock of the dmabuf.
|
||||||
* @sgt: cached mapping.
|
* @sgt: cached mapping.
|
||||||
* @dir: direction of cached mapping.
|
* @dir: direction of cached mapping.
|
||||||
|
* @peer2peer: true if the importer can handle peer resources without pages.
|
||||||
* @priv: exporter specific attachment data.
|
* @priv: exporter specific attachment data.
|
||||||
* @importer_ops: importer operations for this attachment, if provided
|
* @importer_ops: importer operations for this attachment, if provided
|
||||||
* dma_buf_map/unmap_attachment() must be called with the dma_resv lock held.
|
* dma_buf_map/unmap_attachment() must be called with the dma_resv lock held.
|
||||||
@@ -382,6 +391,7 @@ struct dma_buf_attachment {
|
|||||||
struct list_head node;
|
struct list_head node;
|
||||||
struct sg_table *sgt;
|
struct sg_table *sgt;
|
||||||
enum dma_data_direction dir;
|
enum dma_data_direction dir;
|
||||||
|
bool peer2peer;
|
||||||
const struct dma_buf_attach_ops *importer_ops;
|
const struct dma_buf_attach_ops *importer_ops;
|
||||||
void *importer_priv;
|
void *importer_priv;
|
||||||
void *priv;
|
void *priv;
|
||||||
|
|||||||
Reference in New Issue
Block a user