dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
[linux-2.6-block.git] / kernel / dma / Kconfig
CommitLineData
ec8f24b7 1# SPDX-License-Identifier: GPL-2.0-only
cf65a0f6 2
846f9e1f
CH
3config NO_DMA
4 bool
5
cf65a0f6
CH
6config HAS_DMA
7 bool
8 depends on !NO_DMA
9 default y
10
11config NEED_SG_DMA_LENGTH
12 bool
13
14config NEED_DMA_MAP_STATE
15 bool
16
17config ARCH_DMA_ADDR_T_64BIT
18 def_bool 64BIT || PHYS_ADDR_T_64BIT
19
f3ecc0ff
CH
20config ARCH_HAS_DMA_COHERENCE_H
21 bool
22
11ddce15
CH
23config ARCH_HAS_DMA_SET_MASK
24 bool
25
419e2f18
CH
26#
27# Select this option if the architecture needs special handling for
28# DMA_ATTR_WRITE_COMBINE. Normally the "uncached" mapping should be what
29# people thing of when saying write combine, so very few platforms should
30# need to enable this.
31#
32config ARCH_HAS_DMA_WRITE_COMBINE
33 bool
34
ff4c25f2 35config DMA_DECLARE_COHERENT
cf65a0f6
CH
36 bool
37
347cb6af
CH
38config ARCH_HAS_SETUP_DMA_OPS
39 bool
40
dc2acded 41config ARCH_HAS_TEARDOWN_DMA_OPS
cf65a0f6
CH
42 bool
43
44config ARCH_HAS_SYNC_DMA_FOR_DEVICE
45 bool
46
47config ARCH_HAS_SYNC_DMA_FOR_CPU
48 bool
49 select NEED_DMA_MAP_STATE
50
684f7e91
CH
51config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
52 bool
53
13bf5ced
CH
54config ARCH_HAS_DMA_PREP_COHERENT
55 bool
56
9087c375
TL
57config ARCH_HAS_FORCE_DMA_UNENCRYPTED
58 bool
59
cf65a0f6
CH
60config DMA_NONCOHERENT_CACHE_SYNC
61 bool
cf65a0f6
CH
62
63config DMA_VIRT_OPS
64 bool
65 depends on HAS_DMA
66
67config SWIOTLB
68 bool
cf65a0f6 69 select NEED_DMA_MAP_STATE
f0edfea8 70
34dc0ea6
CH
71#
72# Should be selected if we can mmap non-coherent mappings to userspace.
73# The only thing that is really required is a way to set an uncached bit
74# in the pagetables
75#
76config DMA_NONCOHERENT_MMAP
1fbf57d0 77 default y if !MMU
34dc0ea6
CH
78 bool
79
dbed452a 80config DMA_COHERENT_POOL
d07ae4c4 81 select GENERIC_ALLOCATOR
dbed452a
DR
82 bool
83
f0edfea8 84config DMA_REMAP
dbed452a 85 bool
f0edfea8 86 depends on MMU
34dc0ea6 87 select DMA_NONCOHERENT_MMAP
70ca7ba2 88
e860c299
DR
89config DMA_DIRECT_REMAP
90 bool
dbed452a 91 select DMA_REMAP
e860c299
DR
92 select DMA_COHERENT_POOL
93
ddb26d8e
CH
94config DMA_CMA
95 bool "DMA Contiguous Memory Allocator"
96 depends on HAVE_DMA_CONTIGUOUS && CMA
97 help
98 This enables the Contiguous Memory Allocator which allows drivers
99 to allocate big physically-contiguous blocks of memory for use with
100 hardware components that do not support I/O map nor scatter-gather.
101
102 You can disable CMA by specifying "cma=0" on the kernel's command
103 line.
104
105 For more information see <include/linux/dma-contiguous.h>.
106 If unsure, say "n".
107
108if DMA_CMA
109comment "Default contiguous memory area size:"
110
111config CMA_SIZE_MBYTES
112 int "Size in Mega Bytes"
113 depends on !CMA_SIZE_SEL_PERCENTAGE
114 default 0 if X86
115 default 16
116 help
117 Defines the size (in MiB) of the default memory area for Contiguous
118 Memory Allocator. If the size of 0 is selected, CMA is disabled by
119 default, but it can be enabled by passing cma=size[MG] to the kernel.
120
121
122config CMA_SIZE_PERCENTAGE
123 int "Percentage of total memory"
124 depends on !CMA_SIZE_SEL_MBYTES
125 default 0 if X86
126 default 10
127 help
128 Defines the size of the default memory area for Contiguous Memory
129 Allocator as a percentage of the total memory in the system.
130 If 0 percent is selected, CMA is disabled by default, but it can be
131 enabled by passing cma=size[MG] to the kernel.
132
133choice
134 prompt "Selected region size"
135 default CMA_SIZE_SEL_MBYTES
136
137config CMA_SIZE_SEL_MBYTES
138 bool "Use mega bytes value only"
139
140config CMA_SIZE_SEL_PERCENTAGE
141 bool "Use percentage value only"
142
143config CMA_SIZE_SEL_MIN
144 bool "Use lower value (minimum)"
145
146config CMA_SIZE_SEL_MAX
147 bool "Use higher value (maximum)"
148
149endchoice
150
151config CMA_ALIGNMENT
152 int "Maximum PAGE_SIZE order of alignment for contiguous buffers"
153 range 4 12
154 default 8
155 help
156 DMA mapping framework by default aligns all buffers to the smallest
157 PAGE_SIZE order which is greater than or equal to the requested buffer
158 size. This works well for buffers up to a few hundreds kilobytes, but
159 for larger buffers it just a memory waste. With this parameter you can
160 specify the maximum PAGE_SIZE order for contiguous buffers. Larger
161 buffers will be aligned only to this specified order. The order is
162 expressed as a power of two multiplied by the PAGE_SIZE.
163
164 For example, if your system defaults to 4KiB pages, the order value
165 of 8 means that the buffers will be aligned up to 1MiB only.
166
167 If unsure, leave the default value "8".
168
169endif
170
70ca7ba2
AS
171config DMA_API_DEBUG
172 bool "Enable debugging of DMA-API usage"
173 select NEED_DMA_MAP_STATE
174 help
175 Enable this option to debug the use of the DMA API by device drivers.
176 With this option you will be able to detect common bugs in device
177 drivers like double-freeing of DMA mappings or freeing mappings that
178 were never allocated.
179
180 This also attempts to catch cases where a page owned by DMA is
181 accessed by the cpu in a way that could cause data corruption. For
182 example, this enables cow_user_page() to check that the source page is
183 not undergoing DMA.
184
185 This option causes a performance degradation. Use only if you want to
186 debug device drivers and dma interactions.
187
188 If unsure, say N.
189
190config DMA_API_DEBUG_SG
191 bool "Debug DMA scatter-gather usage"
192 default y
193 depends on DMA_API_DEBUG
194 help
195 Perform extra checking that callers of dma_map_sg() have respected the
196 appropriate segment length/boundary limits for the given device when
197 preparing DMA scatterlists.
198
199 This is particularly likely to have been overlooked in cases where the
200 dma_map_sg() API is used for general bulk mapping of pages rather than
201 preparing literal scatter-gather descriptors, where there is a risk of
202 unexpected behaviour from DMA API implementations if the scatterlist
203 is technically out-of-spec.
204
205 If unsure, say N.