dma: add dma_*map*_attrs() interfaces
v6 cover 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
@@ -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
@@ -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
@@ -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