[PATCH 14/22] swiotlb-xen: add map_peer_resource stub

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

 



Add Xen stub of the map_peer_resource DMA API. Return an error to
indicate no bounce-buffer implementation is available yet.

Signed-off-by: Will Davis <wdavis@xxxxxxxxxx>
---
 drivers/xen/swiotlb-xen.c | 20 ++++++++++++++++++++
 include/xen/swiotlb-xen.h | 11 +++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 4c54932..b9879dc 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -475,6 +475,26 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
 }
 EXPORT_SYMBOL_GPL(xen_swiotlb_unmap_page);
 
+#ifdef CONFIG_HAS_DMA_P2P
+/*
+ * Maps a single region from a peer device's resource for DMA streaming. This is
+ * currently unimplemented for Xen because the only peer DMA mappings we're
+ * capable of creating are direct mappings with no explicit synchronization,
+ * e.g., there's no bounce buffer abstraction for peer mappings.
+ */
+dma_peer_addr_t xen_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 DMA_ERROR_CODE;
+}
+EXPORT_SYMBOL_GPL(xen_swiotlb_map_peer_resource);
+#endif
+
 /*
  * Make physical memory consistent for a single streaming mode DMA translation
  * after a transfer.
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index 8b2eb93..dc08a4f 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -24,6 +24,17 @@ extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
 extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
 				   size_t size, enum dma_data_direction dir,
 				   struct dma_attrs *attrs);
+
+#ifdef CONFIG_HAS_DMA_P2P
+extern dma_peer_addr_t xen_swiotlb_map_peer(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 int
 xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
 			 int nelems, enum dma_data_direction dir,
-- 
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