Commit ff4c25f2 authored by Christoph Hellwig's avatar Christoph Hellwig

dma-mapping: improve selection of dma_declare_coherent availability

This API is primarily used through DT entries, but two architectures
and two drivers call it directly.  So instead of selecting the config
symbol for random architectures pull it in implicitly for the actual
users.  Also rename the Kconfig option to describe the feature better.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: Paul Burton <paul.burton@mips.com> # MIPS
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent be4311a2
...@@ -31,7 +31,6 @@ config ARC ...@@ -31,7 +31,6 @@ config ARC
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select HAVE_DEBUG_STACKOVERFLOW select HAVE_DEBUG_STACKOVERFLOW
select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_GENERIC_DMA_COHERENT
select HAVE_IOREMAP_PROT select HAVE_IOREMAP_PROT
select HAVE_KERNEL_GZIP select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
......
...@@ -32,6 +32,7 @@ config ARM ...@@ -32,6 +32,7 @@ config ARM
select CLONE_BACKWARDS select CLONE_BACKWARDS
select CPU_PM if SUSPEND || CPU_IDLE select CPU_PM if SUSPEND || CPU_IDLE
select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
select DMA_DECLARE_COHERENT
select DMA_REMAP if MMU select DMA_REMAP if MMU
select EDAC_SUPPORT select EDAC_SUPPORT
select EDAC_ATOMIC_SCRUB select EDAC_ATOMIC_SCRUB
...@@ -74,7 +75,6 @@ config ARM ...@@ -74,7 +75,6 @@ config ARM
select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL
select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_FUNCTION_TRACER if !XIP_KERNEL
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select HAVE_GENERIC_DMA_COHERENT
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
select HAVE_IDE if PCI || ISA || PCMCIA select HAVE_IDE if PCI || ISA || PCMCIA
select HAVE_IRQ_TIME_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING
......
...@@ -139,7 +139,6 @@ config ARM64 ...@@ -139,7 +139,6 @@ config ARM64
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select HAVE_GENERIC_DMA_COHERENT
select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_HW_BREAKPOINT if PERF_EVENTS
select HAVE_IRQ_TIME_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_MEMBLOCK_NODE_MAP if NUMA select HAVE_MEMBLOCK_NODE_MAP if NUMA
......
...@@ -30,7 +30,6 @@ config CSKY ...@@ -30,7 +30,6 @@ config CSKY
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_GENERIC_DMA_COHERENT
select HAVE_KERNEL_GZIP select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZO select HAVE_KERNEL_LZO
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
......
...@@ -56,7 +56,6 @@ config MIPS ...@@ -56,7 +56,6 @@ config MIPS
select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER
select HAVE_GENERIC_DMA_COHERENT
select HAVE_IDE select HAVE_IDE
select HAVE_IOREMAP_PROT select HAVE_IOREMAP_PROT
select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_IRQ_EXIT_ON_IRQ_STACK
......
...@@ -32,7 +32,6 @@ config RISCV ...@@ -32,7 +32,6 @@ config RISCV
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
select HAVE_DMA_CONTIGUOUS select HAVE_DMA_CONTIGUOUS
select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_GENERIC_DMA_COHERENT
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HAVE_SYSCALL_TRACEPOINTS select HAVE_SYSCALL_TRACEPOINTS
select IRQ_DOMAIN select IRQ_DOMAIN
......
...@@ -7,11 +7,11 @@ config SUPERH ...@@ -7,11 +7,11 @@ config SUPERH
select ARCH_NO_COHERENT_DMA_MMAP if !MMU select ARCH_NO_COHERENT_DMA_MMAP if !MMU
select HAVE_PATA_PLATFORM select HAVE_PATA_PLATFORM
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select DMA_DECLARE_COHERENT
select HAVE_IDE if HAS_IOPORT_MAP select HAVE_IDE if HAS_IOPORT_MAP
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
select ARCH_DISCARD_MEMBLOCK select ARCH_DISCARD_MEMBLOCK
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_GENERIC_DMA_COHERENT
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HAVE_DEBUG_BUGVERBOSE select HAVE_DEBUG_BUGVERBOSE
......
...@@ -4,7 +4,6 @@ config UNICORE32 ...@@ -4,7 +4,6 @@ config UNICORE32
select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO select ARCH_MIGHT_HAVE_PC_SERIO
select HAVE_GENERIC_DMA_COHERENT
select HAVE_KERNEL_GZIP select HAVE_KERNEL_GZIP
select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_BZIP2
select GENERIC_ATOMIC64 select GENERIC_ATOMIC64
......
...@@ -15,7 +15,6 @@ config X86_32 ...@@ -15,7 +15,6 @@ config X86_32
select CLKSRC_I8253 select CLKSRC_I8253
select CLONE_BACKWARDS select CLONE_BACKWARDS
select HAVE_AOUT select HAVE_AOUT
select HAVE_GENERIC_DMA_COHERENT
select MODULES_USE_ELF_REL select MODULES_USE_ELF_REL
select OLD_SIGACTION select OLD_SIGACTION
......
...@@ -1067,6 +1067,7 @@ config MFD_SI476X_CORE ...@@ -1067,6 +1067,7 @@ config MFD_SI476X_CORE
config MFD_SM501 config MFD_SM501
tristate "Silicon Motion SM501" tristate "Silicon Motion SM501"
depends on HAS_DMA depends on HAS_DMA
select DMA_DECLARE_COHERENT
---help--- ---help---
This is the core driver for the Silicon Motion SM501 multimedia This is the core driver for the Silicon Motion SM501 multimedia
companion chip. This device is a multifunction device which may companion chip. This device is a multifunction device which may
...@@ -1675,6 +1676,7 @@ config MFD_TC6393XB ...@@ -1675,6 +1676,7 @@ config MFD_TC6393XB
select GPIOLIB select GPIOLIB
select MFD_CORE select MFD_CORE
select MFD_TMIO select MFD_TMIO
select DMA_DECLARE_COHERENT
help help
Support for Toshiba Mobile IO Controller TC6393XB Support for Toshiba Mobile IO Controller TC6393XB
......
...@@ -43,6 +43,7 @@ config OF_FLATTREE ...@@ -43,6 +43,7 @@ config OF_FLATTREE
config OF_EARLY_FLATTREE config OF_EARLY_FLATTREE
bool bool
select DMA_DECLARE_COHERENT if HAS_DMA
select OF_FLATTREE select OF_FLATTREE
config OF_PROMTREE config OF_PROMTREE
...@@ -83,7 +84,7 @@ config OF_MDIO ...@@ -83,7 +84,7 @@ config OF_MDIO
config OF_RESERVED_MEM config OF_RESERVED_MEM
bool bool
depends on OF_EARLY_FLATTREE depends on OF_EARLY_FLATTREE
default y if HAVE_GENERIC_DMA_COHERENT || DMA_CMA default y if DMA_DECLARE_COHERENT || DMA_CMA
config OF_RESOLVE config OF_RESOLVE
bool bool
......
...@@ -1017,7 +1017,7 @@ struct device { ...@@ -1017,7 +1017,7 @@ struct device {
struct list_head dma_pools; /* dma pools (if dma'ble) */ struct list_head dma_pools; /* dma pools (if dma'ble) */
#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT #ifdef CONFIG_DMA_DECLARE_COHERENT
struct dma_coherent_mem *dma_mem; /* internal for coherent mem struct dma_coherent_mem *dma_mem; /* internal for coherent mem
override */ override */
#endif #endif
......
...@@ -153,7 +153,7 @@ static inline int is_device_dma_capable(struct device *dev) ...@@ -153,7 +153,7 @@ static inline int is_device_dma_capable(struct device *dev)
return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
} }
#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT #ifdef CONFIG_DMA_DECLARE_COHERENT
/* /*
* These three functions are only for dma allocator. * These three functions are only for dma allocator.
* Don't use them in device drivers. * Don't use them in device drivers.
...@@ -192,7 +192,7 @@ static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma, ...@@ -192,7 +192,7 @@ static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
{ {
return 0; return 0;
} }
#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ #endif /* CONFIG_DMA_DECLARE_COHERENT */
static inline bool dma_is_direct(const struct dma_map_ops *ops) static inline bool dma_is_direct(const struct dma_map_ops *ops)
{ {
...@@ -739,7 +739,7 @@ static inline int dma_get_cache_alignment(void) ...@@ -739,7 +739,7 @@ static inline int dma_get_cache_alignment(void)
/* flags for the coherent memory api */ /* flags for the coherent memory api */
#define DMA_MEMORY_EXCLUSIVE 0x01 #define DMA_MEMORY_EXCLUSIVE 0x01
#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT #ifdef CONFIG_DMA_DECLARE_COHERENT
int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
dma_addr_t device_addr, size_t size, int flags); dma_addr_t device_addr, size_t size, int flags);
void dma_release_declared_memory(struct device *dev); void dma_release_declared_memory(struct device *dev);
...@@ -764,7 +764,7 @@ dma_mark_declared_memory_occupied(struct device *dev, ...@@ -764,7 +764,7 @@ dma_mark_declared_memory_occupied(struct device *dev,
{ {
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
} }
#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ #endif /* CONFIG_DMA_DECLARE_COHERENT */
static inline void *dmam_alloc_coherent(struct device *dev, size_t size, static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp) dma_addr_t *dma_handle, gfp_t gfp)
......
...@@ -16,7 +16,7 @@ config ARCH_DMA_ADDR_T_64BIT ...@@ -16,7 +16,7 @@ config ARCH_DMA_ADDR_T_64BIT
config ARCH_HAS_DMA_COHERENCE_H config ARCH_HAS_DMA_COHERENCE_H
bool bool
config HAVE_GENERIC_DMA_COHERENT config DMA_DECLARE_COHERENT
bool bool
config ARCH_HAS_SETUP_DMA_OPS config ARCH_HAS_SETUP_DMA_OPS
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o
obj-$(CONFIG_DMA_CMA) += contiguous.o obj-$(CONFIG_DMA_CMA) += contiguous.o
obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += coherent.o obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o
obj-$(CONFIG_DMA_VIRT_OPS) += virt.o obj-$(CONFIG_DMA_VIRT_OPS) += virt.o
obj-$(CONFIG_DMA_API_DEBUG) += debug.o obj-$(CONFIG_DMA_API_DEBUG) += debug.o
obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_SWIOTLB) += swiotlb.o
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment