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