History

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.

Christoph Hellwig committed 7 years ago

Commit ff4c25f1 parent be4311a15 files · +13 −17Browse files

Unified · Split

15 files
  1. arch/arc/Kconfig +0 −1
  2. arch/arm/Kconfig +1 −1
  3. arch/arm64/Kconfig +0 −1
  4. arch/csky/Kconfig +0 −1
  5. arch/mips/Kconfig +0 −1
  6. arch/riscv/Kconfig +0 −1
  7. arch/sh/Kconfig +1 −1
  8. arch/unicore32/Kconfig +0 −1
  9. arch/x86/Kconfig +0 −1
  10. drivers/mfd/Kconfig +2 −0
  11. drivers/of/Kconfig +2 −1
  12. include/linux/device.h +1 −1
  13. include/linux/dma-mapping.h +4 −4
  14. kernel/dma/Kconfig +1 −1
  15. kernel/dma/Makefile +1 −1
arch/arc/Kconfig+0−1
@@ -31,7 +31,6 @@ config ARC · 30 unmodified lines
3131 select HAVE_ARCH_TRACEHOOK
3232 select HAVE_DEBUG_STACKOVERFLOW
3333 select HAVE_FUTEX_CMPXCHG if FUTEX
34− select HAVE_GENERIC_DMA_COHERENT
3534 select HAVE_IOREMAP_PROT
3635 select HAVE_KERNEL_GZIP
3736 select HAVE_KERNEL_LZMA
arch/arm/Kconfig+1−1
@@ -32,6 +32,7 @@ config ARM · 31 unmodified lines
3232 select CLONE_BACKWARDS
3333 select CPU_PM if SUSPEND || CPU_IDLE
3434 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
35+ select DMA_DECLARE_COHERENT
3536 select DMA_REMAP if MMU
3637 select EDAC_SUPPORT
3738 select EDAC_ATOMIC_SCRUB
@@ -74,7 +75,6 @@ config ARM · 36 unmodified lines
7475 select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL
7576 select HAVE_FUNCTION_TRACER if !XIP_KERNEL
7677 select HAVE_GCC_PLUGINS
77− select HAVE_GENERIC_DMA_COHERENT
7878 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
7979 select HAVE_IDE if PCI || ISA || PCMCIA
8080 select HAVE_IRQ_TIME_ACCOUNTING
arch/arm64/Kconfig+0−1
@@ -139,7 +139,6 @@ config ARM64 · 138 unmodified lines
139139 select HAVE_FUNCTION_TRACER
140140 select HAVE_FUNCTION_GRAPH_TRACER
141141 select HAVE_GCC_PLUGINS
142− select HAVE_GENERIC_DMA_COHERENT
143142 select HAVE_HW_BREAKPOINT if PERF_EVENTS
144143 select HAVE_IRQ_TIME_ACCOUNTING
145144 select HAVE_MEMBLOCK_NODE_MAP if NUMA
arch/csky/Kconfig+0−1
@@ -30,7 +30,6 @@ config CSKY · 29 unmodified lines
3030 select HAVE_ARCH_TRACEHOOK
3131 select HAVE_FUNCTION_TRACER
3232 select HAVE_FUNCTION_GRAPH_TRACER
33− select HAVE_GENERIC_DMA_COHERENT
3433 select HAVE_KERNEL_GZIP
3534 select HAVE_KERNEL_LZO
3635 select HAVE_KERNEL_LZMA
arch/mips/Kconfig+0−1
@@ -56,7 +56,6 @@ config MIPS · 55 unmodified lines
5656 select HAVE_FTRACE_MCOUNT_RECORD
5757 select HAVE_FUNCTION_GRAPH_TRACER
5858 select HAVE_FUNCTION_TRACER
59− select HAVE_GENERIC_DMA_COHERENT
6059 select HAVE_IDE
6160 select HAVE_IOREMAP_PROT
6261 select HAVE_IRQ_EXIT_ON_IRQ_STACK
arch/riscv/Kconfig+0−1
@@ -32,7 +32,6 @@ config RISCV · 31 unmodified lines
3232 select HAVE_MEMBLOCK_NODE_MAP
3333 select HAVE_DMA_CONTIGUOUS
3434 select HAVE_FUTEX_CMPXCHG if FUTEX
35− select HAVE_GENERIC_DMA_COHERENT
3635 select HAVE_PERF_EVENTS
3736 select HAVE_SYSCALL_TRACEPOINTS
3837 select IRQ_DOMAIN
arch/sh/Kconfig+1−1
@@ -7,11 +7,11 @@ config SUPERH · 6 unmodified lines
77 select ARCH_NO_COHERENT_DMA_MMAP if !MMU
88 select HAVE_PATA_PLATFORM
99 select CLKDEV_LOOKUP
10+ select DMA_DECLARE_COHERENT
1011 select HAVE_IDE if HAS_IOPORT_MAP
1112 select HAVE_MEMBLOCK_NODE_MAP
1213 select ARCH_DISCARD_MEMBLOCK
1314 select HAVE_OPROFILE
14− select HAVE_GENERIC_DMA_COHERENT
1515 select HAVE_ARCH_TRACEHOOK
1616 select HAVE_PERF_EVENTS
1717 select HAVE_DEBUG_BUGVERBOSE
arch/unicore32/Kconfig+0−1
@@ -4,7 +4,6 @@ config UNICORE32 · 3 unmodified lines
44 select ARCH_HAS_DEVMEM_IS_ALLOWED
55 select ARCH_MIGHT_HAVE_PC_PARPORT
66 select ARCH_MIGHT_HAVE_PC_SERIO
7− select HAVE_GENERIC_DMA_COHERENT
87 select HAVE_KERNEL_GZIP
98 select HAVE_KERNEL_BZIP2
109 select GENERIC_ATOMIC64
arch/x86/Kconfig+0−1
@@ -15,7 +15,6 @@ config X86_32 · 14 unmodified lines
1515 select CLKSRC_I8253
1616 select CLONE_BACKWARDS
1717 select HAVE_AOUT
18− select HAVE_GENERIC_DMA_COHERENT
1918 select MODULES_USE_ELF_REL
2019 select OLD_SIGACTION
2120
drivers/mfd/Kconfig+2−0
@@ -1067,6 +1067,7 @@ config MFD_SI476X_CORE · 1066 unmodified lines
10671067 config MFD_SM501
10681068 tristate "Silicon Motion SM501"
10691069 depends on HAS_DMA
1070+ select DMA_DECLARE_COHERENT
10701071 ---help---
10711072 This is the core driver for the Silicon Motion SM501 multimedia
10721073 companion chip. This device is a multifunction device which may
@@ -1675,6 +1676,7 @@ config MFD_TC6393XB · 602 unmodified lines
16751676 select GPIOLIB
16761677 select MFD_CORE
16771678 select MFD_TMIO
1679+ select DMA_DECLARE_COHERENT
16781680 help
16791681 Support for Toshiba Mobile IO Controller TC6393XB
16801682
drivers/of/Kconfig+2−1
@@ -43,6 +43,7 @@ config OF_FLATTREE · 42 unmodified lines
4343
4444 config OF_EARLY_FLATTREE
4545 bool
46+ select DMA_DECLARE_COHERENT if HAS_DMA
4647 select OF_FLATTREE
4748
4849 config OF_PROMTREE
@@ -83,7 +84,7 @@ config OF_MDIO · 34 unmodified lines
8384 config OF_RESERVED_MEM
8485 bool
8586 depends on OF_EARLY_FLATTREE
86− default y if HAVE_GENERIC_DMA_COHERENT || DMA_CMA
87+ default y if DMA_DECLARE_COHERENT || DMA_CMA
8788
8889 config OF_RESOLVE
8990 bool
include/linux/device.h+1−1
@@ -1017,7 +1017,7 @@ struct device { · 1016 unmodified lines
10171017
10181018 struct list_head dma_pools; /* dma pools (if dma'ble) */
10191019
1020−#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
1020+#ifdef CONFIG_DMA_DECLARE_COHERENT
10211021 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
10221022 override */
10231023 #endif
include/linux/dma-mapping.h+4−4
@@ -153,7 +153,7 @@ static inline int is_device_dma_capable(struct device *dev) · 152 unmodified lines
153153 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
154154 }
155155
156−#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
156+#ifdef CONFIG_DMA_DECLARE_COHERENT
157157 /*
158158 * These three functions are only for dma allocator.
159159 * Don't use them in device drivers.
@@ -192,7 +192,7 @@ static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma, · 32 unmodified lines
192192 {
193193 return 0;
194194 }
195−#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
195+#endif /* CONFIG_DMA_DECLARE_COHERENT */
196196
197197 static inline bool dma_is_direct(const struct dma_map_ops *ops)
198198 {
@@ -739,7 +739,7 @@ static inline int dma_get_cache_alignment(void) · 540 unmodified lines
739739 /* flags for the coherent memory api */
740740 #define DMA_MEMORY_EXCLUSIVE 0x01
741741
742−#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
742+#ifdef CONFIG_DMA_DECLARE_COHERENT
743743 int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
744744 dma_addr_t device_addr, size_t size, int flags);
745745 void dma_release_declared_memory(struct device *dev);
@@ -764,7 +764,7 @@ dma_mark_declared_memory_occupied(struct device *dev, · 18 unmodified lines
764764 {
765765 return ERR_PTR(-EBUSY);
766766 }
767−#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
767+#endif /* CONFIG_DMA_DECLARE_COHERENT */
768768
769769 static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
770770 dma_addr_t *dma_handle, gfp_t gfp)
kernel/dma/Kconfig+1−1
@@ -16,7 +16,7 @@ config ARCH_DMA_ADDR_T_64BIT · 15 unmodified lines
1616 config ARCH_HAS_DMA_COHERENCE_H
1717 bool
1818
19−config HAVE_GENERIC_DMA_COHERENT
19+config DMA_DECLARE_COHERENT
2020 bool
2121
2222 config ARCH_HAS_SETUP_DMA_OPS
kernel/dma/Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o
44 obj-$(CONFIG_DMA_CMA) += contiguous.o
5−obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += coherent.o
5+obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o
66 obj-$(CONFIG_DMA_VIRT_OPS) += virt.o
77 obj-$(CONFIG_DMA_API_DEBUG) += debug.o
88 obj-$(CONFIG_SWIOTLB) += swiotlb.o

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t