Kconfig 6.7 KB

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