Kconfig 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. config NO_DMA
  3. bool
  4. config HAS_DMA
  5. bool
  6. depends on !NO_DMA
  7. default y
  8. config DMA_OPS_HELPERS
  9. bool
  10. #
  11. # IOMMU drivers that can bypass the IOMMU code and optionally use the direct
  12. # mapping fast path should select this option and set the dma_ops_bypass
  13. # flag in struct device where applicable
  14. #
  15. config DMA_OPS_BYPASS
  16. bool
  17. # Lets platform IOMMU driver choose between bypass and IOMMU
  18. config ARCH_HAS_DMA_MAP_DIRECT
  19. bool
  20. config NEED_SG_DMA_FLAGS
  21. bool
  22. config NEED_SG_DMA_LENGTH
  23. bool
  24. config NEED_DMA_MAP_STATE
  25. bool
  26. config ARCH_DMA_ADDR_T_64BIT
  27. def_bool 64BIT || PHYS_ADDR_T_64BIT
  28. config ARCH_HAS_DMA_SET_MASK
  29. bool
  30. #
  31. # Select this option if the architecture needs special handling for
  32. # DMA_ATTR_WRITE_COMBINE. Normally the "uncached" mapping should be what
  33. # people think of when saying write combine, so very few platforms should
  34. # need to enable this.
  35. #
  36. config ARCH_HAS_DMA_WRITE_COMBINE
  37. bool
  38. #
  39. # Select if the architectures provides the arch_dma_mark_clean hook
  40. #
  41. config ARCH_HAS_DMA_MARK_CLEAN
  42. bool
  43. config DMA_DECLARE_COHERENT
  44. bool
  45. config ARCH_HAS_SETUP_DMA_OPS
  46. bool
  47. config ARCH_HAS_TEARDOWN_DMA_OPS
  48. bool
  49. config ARCH_HAS_SYNC_DMA_FOR_DEVICE
  50. bool
  51. config ARCH_HAS_SYNC_DMA_FOR_CPU
  52. bool
  53. select NEED_DMA_MAP_STATE
  54. config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
  55. bool
  56. config ARCH_HAS_DMA_PREP_COHERENT
  57. bool
  58. config ARCH_HAS_FORCE_DMA_UNENCRYPTED
  59. bool
  60. #
  61. # Select this option if the architecture assumes DMA devices are coherent
  62. # by default.
  63. #
  64. config ARCH_DMA_DEFAULT_COHERENT
  65. bool
  66. config SWIOTLB
  67. bool
  68. select NEED_DMA_MAP_STATE
  69. config SWIOTLB_DYNAMIC
  70. bool "Dynamic allocation of DMA bounce buffers"
  71. default n
  72. depends on SWIOTLB
  73. help
  74. This enables dynamic resizing of the software IO TLB. The kernel
  75. starts with one memory pool at boot and it will allocate additional
  76. pools as needed. To reduce run-time kernel memory requirements, you
  77. may have to specify a smaller size of the initial pool using
  78. "swiotlb=" on the kernel command line.
  79. If unsure, say N.
  80. config DMA_BOUNCE_UNALIGNED_KMALLOC
  81. bool
  82. depends on SWIOTLB
  83. config DMA_NEED_SYNC
  84. def_bool ARCH_HAS_SYNC_DMA_FOR_DEVICE || ARCH_HAS_SYNC_DMA_FOR_CPU || \
  85. ARCH_HAS_SYNC_DMA_FOR_CPU_ALL || DMA_API_DEBUG || \
  86. ARCH_HAS_DMA_OPS || SWIOTLB
  87. config DMA_RESTRICTED_POOL
  88. bool "DMA Restricted Pool"
  89. depends on OF && OF_RESERVED_MEM && SWIOTLB
  90. help
  91. This enables support for restricted DMA pools which provide a level of
  92. DMA memory protection on systems with limited hardware protection
  93. capabilities, such as those lacking an IOMMU.
  94. For more information see
  95. <Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt>
  96. and <kernel/dma/swiotlb.c>.
  97. If unsure, say "n".
  98. #
  99. # Should be selected if we can mmap non-coherent mappings to userspace.
  100. # The only thing that is really required is a way to set an uncached bit
  101. # in the pagetables
  102. #
  103. config DMA_NONCOHERENT_MMAP
  104. default y if !MMU
  105. bool
  106. config DMA_COHERENT_POOL
  107. select GENERIC_ALLOCATOR
  108. bool
  109. config DMA_GLOBAL_POOL
  110. select DMA_DECLARE_COHERENT
  111. depends on !ARCH_HAS_DMA_SET_UNCACHED
  112. depends on !DMA_DIRECT_REMAP
  113. bool
  114. config DMA_DIRECT_REMAP
  115. bool
  116. select DMA_COHERENT_POOL
  117. select DMA_NONCOHERENT_MMAP
  118. #
  119. # Fallback to arch code for DMA allocations. This should eventually go away.
  120. #
  121. config ARCH_HAS_DMA_ALLOC
  122. depends on !ARCH_HAS_DMA_SET_UNCACHED
  123. depends on !DMA_DIRECT_REMAP
  124. depends on !DMA_GLOBAL_POOL
  125. bool
  126. config DMA_CMA
  127. bool "DMA Contiguous Memory Allocator"
  128. depends on HAVE_DMA_CONTIGUOUS && CMA
  129. help
  130. This enables the Contiguous Memory Allocator which allows drivers
  131. to allocate big physically-contiguous blocks of memory for use with
  132. hardware components that do not support I/O map nor scatter-gather.
  133. You can disable CMA by specifying "cma=0" on the kernel's command
  134. line.
  135. For more information see <kernel/dma/contiguous.c>.
  136. If unsure, say "n".
  137. if DMA_CMA
  138. config DMA_NUMA_CMA
  139. bool "Enable separate DMA Contiguous Memory Area for NUMA Node"
  140. depends on NUMA
  141. help
  142. Enable this option to get numa CMA areas so that NUMA devices
  143. can get local memory by DMA coherent APIs.
  144. You can set the size of pernuma CMA by specifying "cma_pernuma=size"
  145. or set the node id and its size of CMA by specifying "numa_cma=
  146. <node>:size[,<node>:size]" on the kernel's command line.
  147. comment "Default contiguous memory area size:"
  148. config CMA_SIZE_MBYTES
  149. int "Size in Mega Bytes"
  150. depends on !CMA_SIZE_SEL_PERCENTAGE
  151. default 0 if X86
  152. default 16
  153. help
  154. Defines the size (in MiB) of the default memory area for Contiguous
  155. Memory Allocator. If the size of 0 is selected, CMA is disabled by
  156. default, but it can be enabled by passing cma=size[MG] to the kernel.
  157. config CMA_SIZE_PERCENTAGE
  158. int "Percentage of total memory"
  159. depends on !CMA_SIZE_SEL_MBYTES
  160. default 0 if X86
  161. default 10
  162. help
  163. Defines the size of the default memory area for Contiguous Memory
  164. Allocator as a percentage of the total memory in the system.
  165. If 0 percent is selected, CMA is disabled by default, but it can be
  166. enabled by passing cma=size[MG] to the kernel.
  167. choice
  168. prompt "Selected region size"
  169. default CMA_SIZE_SEL_MBYTES
  170. config CMA_SIZE_SEL_MBYTES
  171. bool "Use mega bytes value only"
  172. config CMA_SIZE_SEL_PERCENTAGE
  173. bool "Use percentage value only"
  174. config CMA_SIZE_SEL_MIN
  175. bool "Use lower value (minimum)"
  176. config CMA_SIZE_SEL_MAX
  177. bool "Use higher value (maximum)"
  178. endchoice
  179. config CMA_ALIGNMENT
  180. int "Maximum PAGE_SIZE order of alignment for contiguous buffers"
  181. range 2 12
  182. default 8
  183. help
  184. DMA mapping framework by default aligns all buffers to the smallest
  185. PAGE_SIZE order which is greater than or equal to the requested buffer
  186. size. This works well for buffers up to a few hundreds kilobytes, but
  187. for larger buffers it just a memory waste. With this parameter you can
  188. specify the maximum PAGE_SIZE order for contiguous buffers. Larger
  189. buffers will be aligned only to this specified order. The order is
  190. expressed as a power of two multiplied by the PAGE_SIZE.
  191. For example, if your system defaults to 4KiB pages, the order value
  192. of 8 means that the buffers will be aligned up to 1MiB only.
  193. If unsure, leave the default value "8".
  194. endif
  195. config DMA_API_DEBUG
  196. bool "Enable debugging of DMA-API usage"
  197. select NEED_DMA_MAP_STATE
  198. help
  199. Enable this option to debug the use of the DMA API by device drivers.
  200. With this option you will be able to detect common bugs in device
  201. drivers like double-freeing of DMA mappings or freeing mappings that
  202. were never allocated.
  203. This option causes a performance degradation. Use only if you want to
  204. debug device drivers and dma interactions.
  205. If unsure, say N.
  206. config DMA_API_DEBUG_SG
  207. bool "Debug DMA scatter-gather usage"
  208. default y
  209. depends on DMA_API_DEBUG
  210. help
  211. Perform extra checking that callers of dma_map_sg() have respected the
  212. appropriate segment length/boundary limits for the given device when
  213. preparing DMA scatterlists.
  214. This is particularly likely to have been overlooked in cases where the
  215. dma_map_sg() API is used for general bulk mapping of pages rather than
  216. preparing literal scatter-gather descriptors, where there is a risk of
  217. unexpected behaviour from DMA API implementations if the scatterlist
  218. is technically out-of-spec.
  219. If unsure, say N.
  220. config DMA_MAP_BENCHMARK
  221. bool "Enable benchmarking of streaming DMA mapping"
  222. depends on DEBUG_FS
  223. help
  224. Provides /sys/kernel/debug/dma_map_benchmark that helps with testing
  225. performance of dma_(un)map_page.
  226. See tools/testing/selftests/dma/dma_map_benchmark.c