Skip to content

dma: add dma_*map*_attrs() interfaces

[email protected] lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 2 repliesIn review
  2. v53 patches 2 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3dma: document dma_*map*_attrs() interfacesDocumentation/DMA-API.txt Documentation/DMA-attributes.txt+89 -00 replies
2/3dma/ia64: update ia64 machvecs, swiotlb.carch/ia64/hp/common/hwsw_iommu.c arch/ia64/hp/common/sba_iommu.c arch/ia64/sn/pci/pci_dma.c +6 more+249 -1330 replies
3/3IB: expand ib_umem_get() prototypedrivers/infiniband/core/umem.c drivers/infiniband/hw/amso1100/c2_provider.c drivers/infiniband/hw/cxgb3/iwch_provider.c +12 more+75 -192 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchArthur Kepner
1/3
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH 0/3 v6] dma: add dma_*map*_attrs() interfaces

v5-v6 changes:

- if CONFIG_HAVE_DMA_ATTRS isn't defined , use macros to define dma_*map*_attrs() - this gets around a build problem on alpha, and maybe other arches, too.

- fix ib_umem_get() call in drivers/infiniband/hw/nes/nes_verbs.c

---

Introduce new interfaces, dma_*map*_attrs(), for passing architecture-specific attributes when memory is mapped and unmapped for DMA. Give the interfaces default implementations which ignore attributes. Also introduce the dma_{set|get}_attr() interfaces for setting and retrieving individual attributes. Define one attribute, DMA_ATTR_WRITE_BARRIER, in anticipation of its use by ia64/sn. Select whether architectures implement arch-specific versions of the dma_*map*_attrs() interfaces via HAVE_DMA_ATTRS in Kconfig.

---

 arch/Kconfig                |    3 +
 arch/ia64/Kconfig           |    1 
 include/linux/dma-attrs.h   |   74 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/dma-mapping.h |   17 ++++++++++
 4 files changed, 95 insertions(+)
arch/Kconfig +3 -0
index 694c9af..3ea332b 100644
@@ -36,3 +36,6 @@ config HAVE_KPROBES
 
 config HAVE_KRETPROBES
 	def_bool n
+
+config HAVE_DMA_ATTRS
+	def_bool n
arch/ia64/Kconfig +1 -0
index 8fa3faf..985b267 100644
@@ -19,6 +19,7 @@ config IA64
 	select HAVE_OPROFILE
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
+	select HAVE_DMA_ATTRS
 	default y
 	help
 	  The Itanium Processor Family is Intel's 64-bit successor to
include/linux/dma-attrs.h +74 -0

74 lines not on this page · raw message

include/linux/dma-mapping.h +17 -0
index 3320307..952e0f8 100644
@@ -146,4 +146,21 @@ static inline void dmam_release_declared_memory(struct device *dev)
 }
 #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
 
+#ifndef CONFIG_HAVE_DMA_ATTRS
+struct dma_attrs;
+
+#define dma_map_single_attrs(dev, cpu_addr, size, dir, attrs) \
+	dma_map_single(dev, cpu_addr, size, dir)
+
+#define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \
+	dma_unmap_single(dev, dma_addr, size, dir)
+
+#define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \
+	dma_map_sg(dev, sgl, nents, dir)
+
+#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
+	dma_unmap_sg(dev, sgl, nents, dir)
+
+#endif /* CONFIG_HAVE_DMA_ATTRS */
+
 #endif