[PATCH 11/22] swiotlb: Add map_peer_resource stub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add swiotlb stub of the 'map_peer_resource' DMA operation.

Signed-off-by: Will Davis <wdavis@xxxxxxxxxx>
---
 include/linux/swiotlb.h |  8 ++++++++
 lib/swiotlb.c           | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index e7a018e..872463a 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -87,6 +87,14 @@ swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
 		       int nelems, enum dma_data_direction dir,
 		       struct dma_attrs *attrs);
 
+#ifdef CONFIG_HAS_DMA_P2P
+extern dma_peer_addr_t
+swiotlb_map_peer_resource(struct device *hwdev, struct device *hwpeer,
+			  struct resource *res, unsigned long offset,
+			  size_t size, enum dma_data_direction dir,
+			  struct dma_attrs *attrs);
+#endif
+
 extern void
 swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
 			    size_t size, enum dma_data_direction dir);
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 76f29ec..61522a7 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -945,6 +945,23 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
 }
 EXPORT_SYMBOL(swiotlb_unmap_sg);
 
+#ifdef CONFIG_HAS_DMA_P2P
+/*
+ * Maps a single region from a peer device's resource for DMA streaming. This
+ * is currently unimplemented because there's no bounce buffer abstraction for
+ * peer mappings.
+ */
+dma_peer_addr_t
+swiotlb_map_peer_resource(struct device *hwdev, struct device *hwpeer,
+			  struct resource *res, unsigned long offset,
+			  size_t size, enum dma_data_direction dir,
+			  struct dma_attrs *attrs)
+{
+	return phys_to_dma(hwdev, io_tlb_overflow_buffer);
+}
+EXPORT_SYMBOL(swiotlb_map_peer_resource);
+#endif
+
 /*
  * Make physical memory consistent for a set of streaming mode DMA translations
  * after a transfer.
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux