Skip to content

Commit

Permalink
dma-mapping: always provide the dma_map_ops based implementation
Browse files Browse the repository at this point in the history
Move the generic implementation to <linux/dma-mapping.h> now that all
architectures support it and remove the HAVE_DMA_ATTR Kconfig symbol now
that everyone supports them.

[[email protected]: remove leftovers in Kconfig]
Signed-off-by: Christoph Hellwig <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: David Howells <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
Cc: Hans-Christian Egtvedt <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: Koichi Yasutake <[email protected]>
Cc: Ley Foon Tan <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Steven Miao <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Sebastian Ott <[email protected]>
Signed-off-by: Valentin Rothberg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and torvalds committed Jan 21, 2016
1 parent bd38118 commit e1c7e32
Show file tree
Hide file tree
Showing 70 changed files with 369 additions and 633 deletions.
10 changes: 0 additions & 10 deletions Documentation/DMA-API-HOWTO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -951,16 +951,6 @@ to "Closing".
alignment constraints (e.g. the alignment constraints about 64-bit
objects).

3) Supporting multiple types of IOMMUs

If your architecture needs to support multiple types of IOMMUs, you
can use include/linux/asm-generic/dma-mapping-common.h. It's a
library to support the DMA API with multiple types of IOMMUs. Lots
of architectures (x86, powerpc, sh, alpha, ia64, microblaze and
sparc) use it. Choose one to see how it can be used. If you need to
support multiple types of IOMMUs in a single system, the example of
x86 or powerpc helps.

Closing

This document, and the API itself, would not be in its current
Expand Down
40 changes: 0 additions & 40 deletions Documentation/features/io/dma_map_attrs/arch-support.txt

This file was deleted.

3 changes: 0 additions & 3 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ config HAVE_NMI_WATCHDOG
config HAVE_ARCH_TRACEHOOK
bool

config HAVE_DMA_ATTRS
bool

config HAVE_DMA_CONTIGUOUS
bool

Expand Down
1 change: 0 additions & 1 deletion arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ config ALPHA
select HAVE_OPROFILE
select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
select HAVE_DMA_ATTRS
select VIRT_TO_BUS
select GENERIC_IRQ_PROBE
select AUTO_IRQ_AFFINITY if SMP
Expand Down
2 changes: 0 additions & 2 deletions arch/alpha/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

#define dma_cache_sync(dev, va, size, dir) ((void)0)

#endif /* _ALPHA_DMA_MAPPING_H */
1 change: 0 additions & 1 deletion arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ config ARC
select OF_EARLY_FLATTREE
select PERF_USE_VMALLOC
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_DMA_ATTRS

config TRACE_IRQFLAGS_SUPPORT
def_bool y
Expand Down
2 changes: 0 additions & 2 deletions arch/arc/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &arc_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

#endif
1 change: 0 additions & 1 deletion arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ config ARM
select HAVE_C_RECORDMCOUNT
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_API_DEBUG
select HAVE_DMA_ATTRS
select HAVE_DMA_CONTIGUOUS if MMU
select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 && MMU
select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
#define HAVE_ARCH_DMA_SUPPORTED 1
extern int dma_supported(struct device *dev, u64 mask);

/*
* Note that while the generic code provides dummy dma_{alloc,free}_noncoherent
* implementations, we don't provide a dma_cache_sync function so drivers using
* this API are highlighted with build warnings.
*/
#include <asm-generic/dma-mapping-common.h>

#ifdef __arch_page_to_dma
#error Please update to __arch_pfn_to_dma
#endif
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ config ARM64
select HAVE_DEBUG_BUGVERBOSE
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_API_DEBUG
select HAVE_DMA_ATTRS
select HAVE_DMA_CONTIGUOUS
select HAVE_DYNAMIC_FTRACE
select HAVE_EFFICIENT_UNALIGNED_ACCESS
Expand Down
2 changes: 0 additions & 2 deletions arch/arm64/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ static inline bool is_device_dma_coherent(struct device *dev)
return dev->archdata.dma_coherent;
}

#include <asm-generic/dma-mapping-common.h>

static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
{
return (dma_addr_t)paddr;
Expand Down
1 change: 0 additions & 1 deletion arch/avr32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ config AVR32
select HAVE_OPROFILE
select HAVE_KPROBES
select VIRT_TO_BUS
select HAVE_DMA_ATTRS
select GENERIC_IRQ_PROBE
select GENERIC_ATOMIC64
select HARDIRQS_SW_RESEND
Expand Down
2 changes: 0 additions & 2 deletions arch/avr32/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &avr32_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

#endif /* __ASM_AVR32_DMA_MAPPING_H */
1 change: 0 additions & 1 deletion arch/blackfin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ config BLACKFIN
def_bool y
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_DMA_ATTRS
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_FUNCTION_GRAPH_TRACER
Expand Down
2 changes: 0 additions & 2 deletions arch/blackfin/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,4 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &bfin_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

#endif /* _BLACKFIN_DMA_MAPPING_H */
1 change: 0 additions & 1 deletion arch/c6x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ config C6X
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
select ARCH_NO_COHERENT_DMA_MMAP
select HAVE_DMA_ATTRS

config MMU
def_bool n
Expand Down
2 changes: 0 additions & 2 deletions arch/c6x/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &c6x_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

extern void coherent_mem_init(u32 start, u32 size);
void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
gfp_t gfp, struct dma_attrs *attrs);
Expand Down
1 change: 0 additions & 1 deletion arch/cris/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ config CRIS
select GENERIC_ATOMIC64
select HAVE_UID16
select VIRT_TO_BUS
select HAVE_DMA_ATTRS
select ARCH_WANT_IPC_PARSE_VERSION
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
Expand Down
2 changes: 0 additions & 2 deletions arch/cris/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
}
#endif

#include <asm-generic/dma-mapping-common.h>

static inline void
dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction)
Expand Down
1 change: 0 additions & 1 deletion arch/frv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ config FRV
select OLD_SIGACTION
select HAVE_DEBUG_STACKOVERFLOW
select ARCH_NO_COHERENT_DMA_MMAP
select HAVE_DMA_ATTRS

config ZONE_DMA
bool
Expand Down
2 changes: 0 additions & 2 deletions arch/frv/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
flush_write_buffers();
}

#include <asm-generic/dma-mapping-common.h>

#endif /* _ASM_DMA_MAPPING_H */
1 change: 0 additions & 1 deletion arch/h8300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ config H8300
select OF_IRQ
select OF_EARLY_FLATTREE
select HAVE_MEMBLOCK
select HAVE_DMA_ATTRS
select CLKSRC_OF
select H8300_TMR8

Expand Down
2 changes: 0 additions & 2 deletions arch/h8300/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &h8300_dma_map_ops;
}

#include <asm-generic/dma-mapping-common.h>

#endif
1 change: 0 additions & 1 deletion arch/hexagon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ config HEXAGON
select GENERIC_CLOCKEVENTS_BROADCAST
select MODULES_USE_ELF_RELA
select GENERIC_CPU_DEVICES
select HAVE_DMA_ATTRS
---help---
Qualcomm Hexagon is a processor architecture designed for high
performance and low power across a wide variety of applications.
Expand Down
2 changes: 0 additions & 2 deletions arch/hexagon/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ extern int dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction);

#include <asm-generic/dma-mapping-common.h>

static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
{
if (!dev->dma_mask)
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ config IA64
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_DYNAMIC_FTRACE if (!ITANIUM)
select HAVE_FUNCTION_TRACER
select HAVE_DMA_ATTRS
select TTY
select HAVE_ARCH_TRACEHOOK
select HAVE_DMA_API_DEBUG
Expand Down
2 changes: 0 additions & 2 deletions arch/ia64/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,

#define get_dma_ops(dev) platform_dma_get_ops(dev)

#include <asm-generic/dma-mapping-common.h>

static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
{
if (!dev->dma_mask)
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ config M68K
select MODULES_USE_ELF_RELA
select OLD_SIGSUSPEND3
select OLD_SIGACTION
select HAVE_DMA_ATTRS

config RWSEM_GENERIC_SPINLOCK
bool
Expand Down
2 changes: 0 additions & 2 deletions arch/m68k/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &m68k_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction dir)
{
Expand Down
1 change: 0 additions & 1 deletion arch/metag/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ config METAG
select OF
select OF_EARLY_FLATTREE
select SPARSE_IRQ
select HAVE_DMA_ATTRS

config STACKTRACE_SUPPORT
def_bool y
Expand Down
2 changes: 0 additions & 2 deletions arch/metag/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &metag_dma_ops;
}

#include <asm-generic/dma-mapping-common.h>

/*
* dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to
* do any flushing here.
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ config MICROBLAZE
select HAVE_ARCH_KGDB
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_API_DEBUG
select HAVE_DMA_ATTRS
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_FUNCTION_GRAPH_TRACER
Expand Down
2 changes: 0 additions & 2 deletions arch/microblaze/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
return &dma_direct_ops;
}

#include <asm-generic/dma-mapping-common.h>

static inline void __dma_sync(unsigned long paddr,
size_t size, enum dma_data_direction direction)
{
Expand Down
1 change: 0 additions & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ config MIPS
select RTC_LIB if !MACH_LOONGSON64
select GENERIC_ATOMIC64 if !64BIT
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_DMA_ATTRS
select HAVE_DMA_CONTIGUOUS
select HAVE_DMA_API_DEBUG
select GENERIC_IRQ_PROBE
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)

static inline void dma_mark_clean(void *addr, size_t size) {}

#include <asm-generic/dma-mapping-common.h>

extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction);

Expand Down
1 change: 0 additions & 1 deletion arch/mn10300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ config MN10300
select OLD_SIGACTION
select HAVE_DEBUG_STACKOVERFLOW
select ARCH_NO_COHERENT_DMA_MMAP
select HAVE_DMA_ATTRS

config AM33_2
def_bool n
Expand Down
2 changes: 0 additions & 2 deletions arch/mn10300/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ void dma_cache_sync(void *vaddr, size_t size,
mn10300_dcache_flush_inv();
}

#include <asm-generic/dma-mapping-common.h>

#endif
1 change: 0 additions & 1 deletion arch/nios2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ config NIOS2
select SOC_BUS
select SPARSE_IRQ
select USB_ARCH_HAS_HCD if USB_SUPPORT
select HAVE_DMA_ATTRS

config GENERIC_CSUM
def_bool y
Expand Down
3 changes: 0 additions & 3 deletions arch/openrisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ config OPENRISC
config MMU
def_bool y

config HAVE_DMA_ATTRS
def_bool y

config RWSEM_GENERIC_SPINLOCK
def_bool y

Expand Down
2 changes: 0 additions & 2 deletions arch/openrisc/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ static inline int dma_supported(struct device *dev, u64 dma_mask)
return dma_mask == DMA_BIT_MASK(32);
}

#include <asm-generic/dma-mapping-common.h>

#endif /* __ASM_OPENRISC_DMA_MAPPING_H */
1 change: 0 additions & 1 deletion arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ config PARISC
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_ARCH_AUDITSYSCALL
select ARCH_NO_COHERENT_DMA_MMAP
select HAVE_DMA_ATTRS

help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
Expand Down
2 changes: 0 additions & 2 deletions arch/parisc/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,4 @@ struct parisc_device;
void * sba_get_iommu(struct parisc_device *dev);
#endif

#include <asm-generic/dma-mapping-common.h>

#endif
1 change: 0 additions & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ config PPC
select HAVE_ARCH_TRACEHOOK
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select HAVE_OPROFILE
select HAVE_DEBUG_KMEMLEAK
Expand Down
Loading

0 comments on commit e1c7e32

Please sign in to comment.