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
31 select HAVE_ARCH_TRACEHOOK31 select HAVE_ARCH_TRACEHOOK
32 select HAVE_DEBUG_STACKOVERFLOW32 select HAVE_DEBUG_STACKOVERFLOW
33 select HAVE_FUTEX_CMPXCHG if FUTEX33 select HAVE_FUTEX_CMPXCHG if FUTEX
34 select HAVE_GENERIC_DMA_COHERENT
35 select HAVE_IOREMAP_PROT34 select HAVE_IOREMAP_PROT
36 select HAVE_KERNEL_GZIP35 select HAVE_KERNEL_GZIP
37 select HAVE_KERNEL_LZMA36 select HAVE_KERNEL_LZMA
arch/arm/Kconfig+1−1
@@ -32,6 +32,7 @@ config ARM · 31 unmodified lines
32 select CLONE_BACKWARDS32 select CLONE_BACKWARDS
33 select CPU_PM if SUSPEND || CPU_IDLE33 select CPU_PM if SUSPEND || CPU_IDLE
34 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS34 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
35 select DMA_DECLARE_COHERENT
35 select DMA_REMAP if MMU36 select DMA_REMAP if MMU
36 select EDAC_SUPPORT37 select EDAC_SUPPORT
37 select EDAC_ATOMIC_SCRUB38 select EDAC_ATOMIC_SCRUB
@@ -74,7 +75,6 @@ config ARM · 36 unmodified lines
74 select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL75 select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL
75 select HAVE_FUNCTION_TRACER if !XIP_KERNEL76 select HAVE_FUNCTION_TRACER if !XIP_KERNEL
76 select HAVE_GCC_PLUGINS77 select HAVE_GCC_PLUGINS
77 select HAVE_GENERIC_DMA_COHERENT
78 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)78 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
79 select HAVE_IDE if PCI || ISA || PCMCIA79 select HAVE_IDE if PCI || ISA || PCMCIA
80 select HAVE_IRQ_TIME_ACCOUNTING80 select HAVE_IRQ_TIME_ACCOUNTING
arch/arm64/Kconfig+0−1
@@ -139,7 +139,6 @@ config ARM64 · 138 unmodified lines
139 select HAVE_FUNCTION_TRACER139 select HAVE_FUNCTION_TRACER
140 select HAVE_FUNCTION_GRAPH_TRACER140 select HAVE_FUNCTION_GRAPH_TRACER
141 select HAVE_GCC_PLUGINS141 select HAVE_GCC_PLUGINS
142 select HAVE_GENERIC_DMA_COHERENT
143 select HAVE_HW_BREAKPOINT if PERF_EVENTS142 select HAVE_HW_BREAKPOINT if PERF_EVENTS
144 select HAVE_IRQ_TIME_ACCOUNTING143 select HAVE_IRQ_TIME_ACCOUNTING
145 select HAVE_MEMBLOCK_NODE_MAP if NUMA144 select HAVE_MEMBLOCK_NODE_MAP if NUMA
arch/csky/Kconfig+0−1
@@ -30,7 +30,6 @@ config CSKY · 29 unmodified lines
30 select HAVE_ARCH_TRACEHOOK30 select HAVE_ARCH_TRACEHOOK
31 select HAVE_FUNCTION_TRACER31 select HAVE_FUNCTION_TRACER
32 select HAVE_FUNCTION_GRAPH_TRACER32 select HAVE_FUNCTION_GRAPH_TRACER
33 select HAVE_GENERIC_DMA_COHERENT
34 select HAVE_KERNEL_GZIP33 select HAVE_KERNEL_GZIP
35 select HAVE_KERNEL_LZO34 select HAVE_KERNEL_LZO
36 select HAVE_KERNEL_LZMA35 select HAVE_KERNEL_LZMA
arch/mips/Kconfig+0−1
@@ -56,7 +56,6 @@ config MIPS · 55 unmodified lines
56 select HAVE_FTRACE_MCOUNT_RECORD56 select HAVE_FTRACE_MCOUNT_RECORD
57 select HAVE_FUNCTION_GRAPH_TRACER57 select HAVE_FUNCTION_GRAPH_TRACER
58 select HAVE_FUNCTION_TRACER58 select HAVE_FUNCTION_TRACER
59 select HAVE_GENERIC_DMA_COHERENT
60 select HAVE_IDE59 select HAVE_IDE
61 select HAVE_IOREMAP_PROT60 select HAVE_IOREMAP_PROT
62 select HAVE_IRQ_EXIT_ON_IRQ_STACK61 select HAVE_IRQ_EXIT_ON_IRQ_STACK
arch/riscv/Kconfig+0−1
@@ -32,7 +32,6 @@ config RISCV · 31 unmodified lines
32 select HAVE_MEMBLOCK_NODE_MAP32 select HAVE_MEMBLOCK_NODE_MAP
33 select HAVE_DMA_CONTIGUOUS33 select HAVE_DMA_CONTIGUOUS
34 select HAVE_FUTEX_CMPXCHG if FUTEX34 select HAVE_FUTEX_CMPXCHG if FUTEX
35 select HAVE_GENERIC_DMA_COHERENT
36 select HAVE_PERF_EVENTS35 select HAVE_PERF_EVENTS
37 select HAVE_SYSCALL_TRACEPOINTS36 select HAVE_SYSCALL_TRACEPOINTS
38 select IRQ_DOMAIN37 select IRQ_DOMAIN
arch/sh/Kconfig+1−1
@@ -7,11 +7,11 @@ config SUPERH · 6 unmodified lines
7 select ARCH_NO_COHERENT_DMA_MMAP if !MMU7 select ARCH_NO_COHERENT_DMA_MMAP if !MMU
8 select HAVE_PATA_PLATFORM8 select HAVE_PATA_PLATFORM
9 select CLKDEV_LOOKUP9 select CLKDEV_LOOKUP
10 select DMA_DECLARE_COHERENT
10 select HAVE_IDE if HAS_IOPORT_MAP11 select HAVE_IDE if HAS_IOPORT_MAP
11 select HAVE_MEMBLOCK_NODE_MAP12 select HAVE_MEMBLOCK_NODE_MAP
12 select ARCH_DISCARD_MEMBLOCK13 select ARCH_DISCARD_MEMBLOCK
13 select HAVE_OPROFILE14 select HAVE_OPROFILE
14 select HAVE_GENERIC_DMA_COHERENT
15 select HAVE_ARCH_TRACEHOOK15 select HAVE_ARCH_TRACEHOOK
16 select HAVE_PERF_EVENTS16 select HAVE_PERF_EVENTS
17 select HAVE_DEBUG_BUGVERBOSE17 select HAVE_DEBUG_BUGVERBOSE
arch/unicore32/Kconfig+0−1
@@ -4,7 +4,6 @@ config UNICORE32 · 3 unmodified lines
4 select ARCH_HAS_DEVMEM_IS_ALLOWED4 select ARCH_HAS_DEVMEM_IS_ALLOWED
5 select ARCH_MIGHT_HAVE_PC_PARPORT5 select ARCH_MIGHT_HAVE_PC_PARPORT
6 select ARCH_MIGHT_HAVE_PC_SERIO6 select ARCH_MIGHT_HAVE_PC_SERIO
7 select HAVE_GENERIC_DMA_COHERENT
8 select HAVE_KERNEL_GZIP7 select HAVE_KERNEL_GZIP
9 select HAVE_KERNEL_BZIP28 select HAVE_KERNEL_BZIP2
10 select GENERIC_ATOMIC649 select GENERIC_ATOMIC64
arch/x86/Kconfig+0−1
@@ -15,7 +15,6 @@ config X86_32 · 14 unmodified lines
15 select CLKSRC_I825315 select CLKSRC_I8253
16 select CLONE_BACKWARDS16 select CLONE_BACKWARDS
17 select HAVE_AOUT17 select HAVE_AOUT
18 select HAVE_GENERIC_DMA_COHERENT
19 select MODULES_USE_ELF_REL18 select MODULES_USE_ELF_REL
20 select OLD_SIGACTION19 select OLD_SIGACTION
21 20
drivers/mfd/Kconfig+2−0
@@ -1067,6 +1067,7 @@ config MFD_SI476X_CORE · 1066 unmodified lines
1067config MFD_SM5011067config MFD_SM501
1068 tristate "Silicon Motion SM501"1068 tristate "Silicon Motion SM501"
1069 depends on HAS_DMA1069 depends on HAS_DMA
1070 select DMA_DECLARE_COHERENT
1070 ---help---1071 ---help---
1071 This is the core driver for the Silicon Motion SM501 multimedia1072 This is the core driver for the Silicon Motion SM501 multimedia
1072 companion chip. This device is a multifunction device which may1073 companion chip. This device is a multifunction device which may
@@ -1675,6 +1676,7 @@ config MFD_TC6393XB · 602 unmodified lines
1675 select GPIOLIB1676 select GPIOLIB
1676 select MFD_CORE1677 select MFD_CORE
1677 select MFD_TMIO1678 select MFD_TMIO
1679 select DMA_DECLARE_COHERENT
1678 help1680 help
1679 Support for Toshiba Mobile IO Controller TC6393XB1681 Support for Toshiba Mobile IO Controller TC6393XB
1680 1682
drivers/of/Kconfig+2−1
@@ -43,6 +43,7 @@ config OF_FLATTREE · 42 unmodified lines
43 43
44config OF_EARLY_FLATTREE44config OF_EARLY_FLATTREE
45 bool45 bool
46 select DMA_DECLARE_COHERENT if HAS_DMA
46 select OF_FLATTREE47 select OF_FLATTREE
47 48
48config OF_PROMTREE49config OF_PROMTREE
@@ -83,7 +84,7 @@ config OF_MDIO · 34 unmodified lines
83config OF_RESERVED_MEM84config OF_RESERVED_MEM
84 bool85 bool
85 depends on OF_EARLY_FLATTREE86 depends on OF_EARLY_FLATTREE
86 default y if HAVE_GENERIC_DMA_COHERENT || DMA_CMA87 default y if DMA_DECLARE_COHERENT || DMA_CMA
87 88
88config OF_RESOLVE89config OF_RESOLVE
89 bool90 bool
include/linux/device.h+1−1
@@ -1017,7 +1017,7 @@ struct device { · 1016 unmodified lines
1017 1017
1018 struct list_head dma_pools; /* dma pools (if dma'ble) */1018 struct list_head dma_pools; /* dma pools (if dma'ble) */
1019 1019
1020#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT1020#ifdef CONFIG_DMA_DECLARE_COHERENT
1021 struct dma_coherent_mem *dma_mem; /* internal for coherent mem1021 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
1022 override */1022 override */
1023#endif1023#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
153 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;153 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
154}154}
155 155
156#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT156#ifdef CONFIG_DMA_DECLARE_COHERENT
157/*157/*
158 * These three functions are only for dma allocator.158 * These three functions are only for dma allocator.
159 * Don't use them in device drivers.159 * 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
192{192{
193 return 0;193 return 0;
194}194}
195#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */195#endif /* CONFIG_DMA_DECLARE_COHERENT */
196 196
197static inline bool dma_is_direct(const struct dma_map_ops *ops)197static inline bool dma_is_direct(const struct dma_map_ops *ops)
198{198{
@@ -739,7 +739,7 @@ static inline int dma_get_cache_alignment(void) · 540 unmodified lines
739/* flags for the coherent memory api */739/* flags for the coherent memory api */
740#define DMA_MEMORY_EXCLUSIVE 0x01740#define DMA_MEMORY_EXCLUSIVE 0x01
741 741
742#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT742#ifdef CONFIG_DMA_DECLARE_COHERENT
743int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,743int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
744 dma_addr_t device_addr, size_t size, int flags);744 dma_addr_t device_addr, size_t size, int flags);
745void dma_release_declared_memory(struct device *dev);745void dma_release_declared_memory(struct device *dev);
@@ -764,7 +764,7 @@ dma_mark_declared_memory_occupied(struct device *dev, · 18 unmodified lines
764{764{
765 return ERR_PTR(-EBUSY);765 return ERR_PTR(-EBUSY);
766}766}
767#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */767#endif /* CONFIG_DMA_DECLARE_COHERENT */
768 768
769static inline void *dmam_alloc_coherent(struct device *dev, size_t size,769static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
770 dma_addr_t *dma_handle, gfp_t gfp)770 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
16config ARCH_HAS_DMA_COHERENCE_H16config ARCH_HAS_DMA_COHERENCE_H
17 bool17 bool
18 18
19config HAVE_GENERIC_DMA_COHERENT19config DMA_DECLARE_COHERENT
20 bool20 bool
21 21
22config ARCH_HAS_SETUP_DMA_OPS22config ARCH_HAS_SETUP_DMA_OPS
kernel/dma/Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2 2
3obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o3obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o
4obj-$(CONFIG_DMA_CMA) += contiguous.o4obj-$(CONFIG_DMA_CMA) += contiguous.o
5obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += coherent.o5obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o
6obj-$(CONFIG_DMA_VIRT_OPS) += virt.o6obj-$(CONFIG_DMA_VIRT_OPS) += virt.o
7obj-$(CONFIG_DMA_API_DEBUG) += debug.o7obj-$(CONFIG_DMA_API_DEBUG) += debug.o
8obj-$(CONFIG_SWIOTLB) += swiotlb.o8obj-$(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