[PATCH 3/6] dma-buf: add peer2peer flag

Christian König ckoenig.leichtzumerken at gmail.com
Thu Apr 18 12:09:25 UTC 2019


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 at amd.com>
---
 drivers/dma-buf/dma-buf.c | 1 +
 include/linux/dma-buf.h   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index f23ff8355505..3ab49b492017 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -563,6 +563,7 @@ struct dma_buf_attachment *dma_buf_attach(const struct dma_buf_attach_info *info
 
 	attach->dev = info->dev;
 	attach->dmabuf = dmabuf;
+	attach->peer2peer = info->peer2peer;
 	attach->importer_priv = info->importer_priv;
 	attach->invalidate = info->invalidate;
 
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index a615b74e5894..d2746bdfe92c 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -346,6 +346,7 @@ struct dma_buf {
  * @dmabuf: buffer for this attachment.
  * @dev: device attached to the buffer.
  * @node: list of dma_buf_attachment.
+ * @peer2peer: true if the importer can handle peer resources without pages.
  * @priv: exporter specific attachment data.
  * @importer_priv: importer specific attachment data.
  *
@@ -362,6 +363,7 @@ struct dma_buf_attachment {
 	struct dma_buf *dmabuf;
 	struct device *dev;
 	struct list_head node;
+	bool peer2peer;
 	void *priv;
 	struct sg_table *sgt;
 	void *importer_priv;
@@ -427,6 +429,7 @@ struct dma_buf_export_info {
  * struct dma_buf_attach_info - holds information needed to attach to a dma_buf
  * @dmabuf:		the exported dma_buf
  * @dev:		the device which wants to import the attachment
+ * @peer2peer:		true if the importer can handle peer resources without pages
  * @importer_priv:	private data of importer to this attachment
  * @invalidate:		callback to use for invalidating mappings
  *
@@ -436,6 +439,7 @@ struct dma_buf_export_info {
 struct dma_buf_attach_info {
 	struct dma_buf *dmabuf;
 	struct device *dev;
+	bool peer2peer;
 	void *importer_priv;
 	void (*invalidate)(struct dma_buf_attachment *attach);
 };
-- 
2.17.1



More information about the amd-gfx mailing list