All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] dma-buf: add peer2peer flag
@ 2020-03-30 13:55 ` Christian König
  0 siblings, 0 replies; 34+ messages in thread
From: Christian König @ 2020-03-30 13:55 UTC (permalink / raw)
  To: dri-devel, amd-gfx, daniel

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>
---
 drivers/dma-buf/dma-buf.c |  2 ++
 include/linux/dma-buf.h   | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index ccc9eda1bc28..570c923023e6 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -690,6 +690,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
 
 	attach->dev = dev;
 	attach->dmabuf = dmabuf;
+	if (importer_ops)
+		attach->peer2peer = importer_ops->allow_peer2peer;
 	attach->importer_ops = importer_ops;
 	attach->importer_priv = importer_priv;
 
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 1ade486fc2bb..82e0a4a64601 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -334,6 +334,14 @@ struct dma_buf {
  * Attachment operations implemented by the importer.
  */
 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
 	 *
@@ -362,6 +370,7 @@ struct dma_buf_attach_ops {
  * @node: list of dma_buf_attachment, protected by dma_resv lock of the dmabuf.
  * @sgt: cached mapping.
  * @dir: direction of cached mapping.
+ * @peer2peer: true if the importer can handle peer resources without pages.
  * @priv: exporter specific attachment data.
  * @importer_ops: importer operations for this attachment, if provided
  * 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 sg_table *sgt;
 	enum dma_data_direction dir;
+	bool peer2peer;
 	const struct dma_buf_attach_ops *importer_ops;
 	void *importer_priv;
 	void *priv;
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 34+ messages in thread
* P2P for DMA-buf
@ 2020-03-11 13:51 Christian König
  2020-03-11 13:51   ` Christian König
  0 siblings, 1 reply; 34+ messages in thread
From: Christian König @ 2020-03-11 13:51 UTC (permalink / raw)
  To: David1.Zhou, hch, jgg, daniel, dri-devel, linaro-mm-sig,
	linux-media, intel-gfx

This is the third and final part of my series to start supporting P2P with DMA-buf.

The implementation is straight forward, apart from a helper to aid constructing scatterlists without having struct pages we only add a new flag indicating that an DMA-buf importer can handle peer2peer.

The exporter can then check if P2P is general possible using the pci_p2pdma_distance_many() function and if necessary can also clear the flag.

The rest is an example how to implementing the necessary functionality into the amdgpu driver to setup scatterlists pointing to device memory.

Please review and comment,
Christian.



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-04-03  8:32 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 13:55 [PATCH 1/6] dma-buf: add peer2peer flag Christian König
2020-03-30 13:55 ` Christian König
2020-03-30 13:55 ` [PATCH 2/6] drm/ttm: lock resv object during destruction Christian König
2020-03-30 13:55   ` Christian König
2020-03-30 13:55 ` [PATCH 3/6] drm/amdgpu: note that we can handle peer2peer DMA-buf Christian König
2020-03-30 13:55   ` Christian König
2020-03-30 13:55 ` [PATCH 4/6] drm/amdgpu: add checks if DMA-buf P2P is supported Christian König
2020-03-30 13:55   ` Christian König
2020-03-30 13:55 ` [PATCH 5/6] drm/amdgpu: add support for exporting VRAM using DMA-buf v3 Christian König
2020-03-30 13:55   ` Christian König
2020-03-30 13:55 ` [PATCH 6/6] drm/amdgpu: improve amdgpu_gem_info debugfs file Christian König
2020-03-30 13:55   ` Christian König
2020-03-31  8:46 ` [PATCH 1/6] dma-buf: add peer2peer flag Daniel Vetter
2020-03-31  8:46   ` Daniel Vetter
2020-04-01  2:39   ` Sumit Semwal
2020-04-01  2:39     ` Sumit Semwal
2020-04-01 11:34 ` Daniel Vetter
2020-04-01 11:34   ` Daniel Vetter
2020-04-01 16:04   ` Ruhl, Michael J
2020-04-01 16:04     ` Ruhl, Michael J
2020-04-03  8:32     ` Daniel Vetter
2020-04-03  8:32       ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2020-03-11 13:51 P2P for DMA-buf Christian König
2020-03-11 13:51 ` [PATCH 4/6] drm/amdgpu: add checks if DMA-buf P2P is supported Christian König
2020-03-11 13:51   ` Christian König
2020-03-11 14:04   ` Jason Gunthorpe
2020-03-11 14:04     ` Jason Gunthorpe
2020-03-11 14:33     ` Christian König
2020-03-11 14:33       ` Christian König
2020-03-11 14:38       ` Jason Gunthorpe
2020-03-11 14:38         ` Jason Gunthorpe
2020-03-11 14:43         ` Christian König
2020-03-11 14:43           ` Christian König
2020-03-11 14:48           ` Jason Gunthorpe
2020-03-11 14:48             ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.