Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Burton <paul.burton@mips.com> # MIPS
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+13 -17
-1
arch/arc/Kconfig
··· 31 31 select HAVE_ARCH_TRACEHOOK 32 32 select HAVE_DEBUG_STACKOVERFLOW 33 33 select HAVE_FUTEX_CMPXCHG if FUTEX 34 - select HAVE_GENERIC_DMA_COHERENT 35 34 select HAVE_IOREMAP_PROT 36 35 select HAVE_KERNEL_GZIP 37 36 select HAVE_KERNEL_LZMA
+1 -1
arch/arm/Kconfig
··· 32 32 select CLONE_BACKWARDS 33 33 select CPU_PM if SUSPEND || CPU_IDLE 34 34 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS 35 + select DMA_DECLARE_COHERENT 35 36 select DMA_REMAP if MMU 36 37 select EDAC_SUPPORT 37 38 select EDAC_ATOMIC_SCRUB ··· 75 74 select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL 76 75 select HAVE_FUNCTION_TRACER if !XIP_KERNEL 77 76 select HAVE_GCC_PLUGINS 78 - select HAVE_GENERIC_DMA_COHERENT 79 77 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) 80 78 select HAVE_IDE if PCI || ISA || PCMCIA 81 79 select HAVE_IRQ_TIME_ACCOUNTING
-1
arch/arm64/Kconfig
··· 139 139 select HAVE_FUNCTION_TRACER 140 140 select HAVE_FUNCTION_GRAPH_TRACER 141 141 select HAVE_GCC_PLUGINS 142 - select HAVE_GENERIC_DMA_COHERENT 143 142 select HAVE_HW_BREAKPOINT if PERF_EVENTS 144 143 select HAVE_IRQ_TIME_ACCOUNTING 145 144 select HAVE_MEMBLOCK_NODE_MAP if NUMA
-1
arch/csky/Kconfig
··· 30 30 select HAVE_ARCH_TRACEHOOK 31 31 select HAVE_FUNCTION_TRACER 32 32 select HAVE_FUNCTION_GRAPH_TRACER 33 - select HAVE_GENERIC_DMA_COHERENT 34 33 select HAVE_KERNEL_GZIP 35 34 select HAVE_KERNEL_LZO 36 35 select HAVE_KERNEL_LZMA
-1
arch/mips/Kconfig
··· 56 56 select HAVE_FTRACE_MCOUNT_RECORD 57 57 select HAVE_FUNCTION_GRAPH_TRACER 58 58 select HAVE_FUNCTION_TRACER 59 - select HAVE_GENERIC_DMA_COHERENT 60 59 select HAVE_IDE 61 60 select HAVE_IOREMAP_PROT 62 61 select HAVE_IRQ_EXIT_ON_IRQ_STACK
-1
arch/riscv/Kconfig
··· 32 32 select HAVE_MEMBLOCK_NODE_MAP 33 33 select HAVE_DMA_CONTIGUOUS 34 34 select HAVE_FUTEX_CMPXCHG if FUTEX 35 - select HAVE_GENERIC_DMA_COHERENT 36 35 select HAVE_PERF_EVENTS 37 36 select HAVE_SYSCALL_TRACEPOINTS 38 37 select IRQ_DOMAIN
+1 -1
arch/sh/Kconfig
··· 7 7 select ARCH_NO_COHERENT_DMA_MMAP if !MMU 8 8 select HAVE_PATA_PLATFORM 9 9 select CLKDEV_LOOKUP 10 + select DMA_DECLARE_COHERENT 10 11 select HAVE_IDE if HAS_IOPORT_MAP 11 12 select HAVE_MEMBLOCK_NODE_MAP 12 13 select ARCH_DISCARD_MEMBLOCK 13 14 select HAVE_OPROFILE 14 - select HAVE_GENERIC_DMA_COHERENT 15 15 select HAVE_ARCH_TRACEHOOK 16 16 select HAVE_PERF_EVENTS 17 17 select HAVE_DEBUG_BUGVERBOSE
-1
arch/unicore32/Kconfig
··· 4 4 select ARCH_HAS_DEVMEM_IS_ALLOWED 5 5 select ARCH_MIGHT_HAVE_PC_PARPORT 6 6 select ARCH_MIGHT_HAVE_PC_SERIO 7 - select HAVE_GENERIC_DMA_COHERENT 8 7 select HAVE_KERNEL_GZIP 9 8 select HAVE_KERNEL_BZIP2 10 9 select GENERIC_ATOMIC64
-1
arch/x86/Kconfig
··· 15 15 select CLKSRC_I8253 16 16 select CLONE_BACKWARDS 17 17 select HAVE_AOUT 18 - select HAVE_GENERIC_DMA_COHERENT 19 18 select MODULES_USE_ELF_REL 20 19 select OLD_SIGACTION 21 20
+2
drivers/mfd/Kconfig
··· 1067 1067 config MFD_SM501 1068 1068 tristate "Silicon Motion SM501" 1069 1069 depends on HAS_DMA 1070 + select DMA_DECLARE_COHERENT 1070 1071 ---help--- 1071 1072 This is the core driver for the Silicon Motion SM501 multimedia 1072 1073 companion chip. This device is a multifunction device which may ··· 1676 1675 select GPIOLIB 1677 1676 select MFD_CORE 1678 1677 select MFD_TMIO 1678 + select DMA_DECLARE_COHERENT 1679 1679 help 1680 1680 Support for Toshiba Mobile IO Controller TC6393XB 1681 1681
+2 -1
drivers/of/Kconfig
··· 43 43 44 44 config OF_EARLY_FLATTREE 45 45 bool 46 + select DMA_DECLARE_COHERENT if HAS_DMA 46 47 select OF_FLATTREE 47 48 48 49 config OF_PROMTREE ··· 84 83 config OF_RESERVED_MEM 85 84 bool 86 85 depends on OF_EARLY_FLATTREE 87 - default y if HAVE_GENERIC_DMA_COHERENT || DMA_CMA 86 + default y if DMA_DECLARE_COHERENT || DMA_CMA 88 87 89 88 config OF_RESOLVE 90 89 bool
+1 -1
include/linux/device.h
··· 1017 1017 1018 1018 struct list_head dma_pools; /* dma pools (if dma'ble) */ 1019 1019 1020 - #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT 1020 + #ifdef CONFIG_DMA_DECLARE_COHERENT 1021 1021 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 1022 1022 override */ 1023 1023 #endif
+4 -4
include/linux/dma-mapping.h
··· 153 153 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 154 154 } 155 155 156 - #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT 156 + #ifdef CONFIG_DMA_DECLARE_COHERENT 157 157 /* 158 158 * These three functions are only for dma allocator. 159 159 * Don't use them in device drivers. ··· 192 192 { 193 193 return 0; 194 194 } 195 - #endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ 195 + #endif /* CONFIG_DMA_DECLARE_COHERENT */ 196 196 197 197 static inline bool dma_is_direct(const struct dma_map_ops *ops) 198 198 { ··· 739 739 /* flags for the coherent memory api */ 740 740 #define DMA_MEMORY_EXCLUSIVE 0x01 741 741 742 - #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT 742 + #ifdef CONFIG_DMA_DECLARE_COHERENT 743 743 int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, 744 744 dma_addr_t device_addr, size_t size, int flags); 745 745 void dma_release_declared_memory(struct device *dev); ··· 764 764 { 765 765 return ERR_PTR(-EBUSY); 766 766 } 767 - #endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ 767 + #endif /* CONFIG_DMA_DECLARE_COHERENT */ 768 768 769 769 static inline void *dmam_alloc_coherent(struct device *dev, size_t size, 770 770 dma_addr_t *dma_handle, gfp_t gfp)
+1 -1
kernel/dma/Kconfig
··· 16 16 config ARCH_HAS_DMA_COHERENCE_H 17 17 bool 18 18 19 - config HAVE_GENERIC_DMA_COHERENT 19 + config DMA_DECLARE_COHERENT 20 20 bool 21 21 22 22 config ARCH_HAS_SETUP_DMA_OPS
+1 -1
kernel/dma/Makefile
··· 2 2 3 3 obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o 4 4 obj-$(CONFIG_DMA_CMA) += contiguous.o 5 - obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += coherent.o 5 + obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o 6 6 obj-$(CONFIG_DMA_VIRT_OPS) += virt.o 7 7 obj-$(CONFIG_DMA_API_DEBUG) += debug.o 8 8 obj-$(CONFIG_SWIOTLB) += swiotlb.o