Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0-only
0002 
0003 config NO_DMA
0004         bool
0005 
0006 config HAS_DMA
0007         bool
0008         depends on !NO_DMA
0009         default y
0010 
0011 config DMA_OPS
0012         depends on HAS_DMA
0013         bool
0014 
0015 #
0016 # IOMMU drivers that can bypass the IOMMU code and optionally use the direct
0017 # mapping fast path should select this option and set the dma_ops_bypass
0018 # flag in struct device where applicable
0019 #
0020 config DMA_OPS_BYPASS
0021         bool
0022 
0023 # Lets platform IOMMU driver choose between bypass and IOMMU
0024 config ARCH_HAS_DMA_MAP_DIRECT
0025         bool
0026 
0027 config NEED_SG_DMA_LENGTH
0028         bool
0029 
0030 config NEED_DMA_MAP_STATE
0031         bool
0032 
0033 config ARCH_DMA_ADDR_T_64BIT
0034         def_bool 64BIT || PHYS_ADDR_T_64BIT
0035 
0036 config ARCH_HAS_DMA_SET_MASK
0037         bool
0038 
0039 #
0040 # Select this option if the architecture needs special handling for
0041 # DMA_ATTR_WRITE_COMBINE.  Normally the "uncached" mapping should be what
0042 # people thing of when saying write combine, so very few platforms should
0043 # need to enable this.
0044 #
0045 config ARCH_HAS_DMA_WRITE_COMBINE
0046         bool
0047 
0048 #
0049 # Select if the architectures provides the arch_dma_mark_clean hook
0050 #
0051 config ARCH_HAS_DMA_MARK_CLEAN
0052         bool
0053 
0054 config DMA_DECLARE_COHERENT
0055         bool
0056 
0057 config ARCH_HAS_SETUP_DMA_OPS
0058         bool
0059 
0060 config ARCH_HAS_TEARDOWN_DMA_OPS
0061         bool
0062 
0063 config ARCH_HAS_SYNC_DMA_FOR_DEVICE
0064         bool
0065 
0066 config ARCH_HAS_SYNC_DMA_FOR_CPU
0067         bool
0068         select NEED_DMA_MAP_STATE
0069 
0070 config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
0071         bool
0072 
0073 config ARCH_HAS_DMA_PREP_COHERENT
0074         bool
0075 
0076 config ARCH_HAS_FORCE_DMA_UNENCRYPTED
0077         bool
0078 
0079 config SWIOTLB
0080         bool
0081         select NEED_DMA_MAP_STATE
0082 
0083 config DMA_RESTRICTED_POOL
0084         bool "DMA Restricted Pool"
0085         depends on OF && OF_RESERVED_MEM && SWIOTLB
0086         help
0087           This enables support for restricted DMA pools which provide a level of
0088           DMA memory protection on systems with limited hardware protection
0089           capabilities, such as those lacking an IOMMU.
0090 
0091           For more information see
0092           <Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt>
0093           and <kernel/dma/swiotlb.c>.
0094           If unsure, say "n".
0095 
0096 #
0097 # Should be selected if we can mmap non-coherent mappings to userspace.
0098 # The only thing that is really required is a way to set an uncached bit
0099 # in the pagetables
0100 #
0101 config DMA_NONCOHERENT_MMAP
0102         default y if !MMU
0103         bool
0104 
0105 config DMA_COHERENT_POOL
0106         select GENERIC_ALLOCATOR
0107         bool
0108 
0109 config DMA_GLOBAL_POOL
0110         select DMA_DECLARE_COHERENT
0111         bool
0112 
0113 config DMA_DIRECT_REMAP
0114         bool
0115         select DMA_COHERENT_POOL
0116         select DMA_NONCOHERENT_MMAP
0117 
0118 config DMA_CMA
0119         bool "DMA Contiguous Memory Allocator"
0120         depends on HAVE_DMA_CONTIGUOUS && CMA
0121         help
0122           This enables the Contiguous Memory Allocator which allows drivers
0123           to allocate big physically-contiguous blocks of memory for use with
0124           hardware components that do not support I/O map nor scatter-gather.
0125 
0126           You can disable CMA by specifying "cma=0" on the kernel's command
0127           line.
0128 
0129           For more information see <kernel/dma/contiguous.c>.
0130           If unsure, say "n".
0131 
0132 if  DMA_CMA
0133 
0134 config DMA_PERNUMA_CMA
0135         bool "Enable separate DMA Contiguous Memory Area for each NUMA Node"
0136         default NUMA && ARM64
0137         help
0138           Enable this option to get pernuma CMA areas so that devices like
0139           ARM64 SMMU can get local memory by DMA coherent APIs.
0140 
0141           You can set the size of pernuma CMA by specifying "cma_pernuma=size"
0142           on the kernel's command line.
0143 
0144 comment "Default contiguous memory area size:"
0145 
0146 config CMA_SIZE_MBYTES
0147         int "Size in Mega Bytes"
0148         depends on !CMA_SIZE_SEL_PERCENTAGE
0149         default 0 if X86
0150         default 16
0151         help
0152           Defines the size (in MiB) of the default memory area for Contiguous
0153           Memory Allocator.  If the size of 0 is selected, CMA is disabled by
0154           default, but it can be enabled by passing cma=size[MG] to the kernel.
0155 
0156 
0157 config CMA_SIZE_PERCENTAGE
0158         int "Percentage of total memory"
0159         depends on !CMA_SIZE_SEL_MBYTES
0160         default 0 if X86
0161         default 10
0162         help
0163           Defines the size of the default memory area for Contiguous Memory
0164           Allocator as a percentage of the total memory in the system.
0165           If 0 percent is selected, CMA is disabled by default, but it can be
0166           enabled by passing cma=size[MG] to the kernel.
0167 
0168 choice
0169         prompt "Selected region size"
0170         default CMA_SIZE_SEL_MBYTES
0171 
0172 config CMA_SIZE_SEL_MBYTES
0173         bool "Use mega bytes value only"
0174 
0175 config CMA_SIZE_SEL_PERCENTAGE
0176         bool "Use percentage value only"
0177 
0178 config CMA_SIZE_SEL_MIN
0179         bool "Use lower value (minimum)"
0180 
0181 config CMA_SIZE_SEL_MAX
0182         bool "Use higher value (maximum)"
0183 
0184 endchoice
0185 
0186 config CMA_ALIGNMENT
0187         int "Maximum PAGE_SIZE order of alignment for contiguous buffers"
0188         range 2 12
0189         default 8
0190         help
0191           DMA mapping framework by default aligns all buffers to the smallest
0192           PAGE_SIZE order which is greater than or equal to the requested buffer
0193           size. This works well for buffers up to a few hundreds kilobytes, but
0194           for larger buffers it just a memory waste. With this parameter you can
0195           specify the maximum PAGE_SIZE order for contiguous buffers. Larger
0196           buffers will be aligned only to this specified order. The order is
0197           expressed as a power of two multiplied by the PAGE_SIZE.
0198 
0199           For example, if your system defaults to 4KiB pages, the order value
0200           of 8 means that the buffers will be aligned up to 1MiB only.
0201 
0202           If unsure, leave the default value "8".
0203 
0204 endif
0205 
0206 config DMA_API_DEBUG
0207         bool "Enable debugging of DMA-API usage"
0208         select NEED_DMA_MAP_STATE
0209         help
0210           Enable this option to debug the use of the DMA API by device drivers.
0211           With this option you will be able to detect common bugs in device
0212           drivers like double-freeing of DMA mappings or freeing mappings that
0213           were never allocated.
0214 
0215           This option causes a performance degradation.  Use only if you want to
0216           debug device drivers and dma interactions.
0217 
0218           If unsure, say N.
0219 
0220 config DMA_API_DEBUG_SG
0221         bool "Debug DMA scatter-gather usage"
0222         default y
0223         depends on DMA_API_DEBUG
0224         help
0225           Perform extra checking that callers of dma_map_sg() have respected the
0226           appropriate segment length/boundary limits for the given device when
0227           preparing DMA scatterlists.
0228 
0229           This is particularly likely to have been overlooked in cases where the
0230           dma_map_sg() API is used for general bulk mapping of pages rather than
0231           preparing literal scatter-gather descriptors, where there is a risk of
0232           unexpected behaviour from DMA API implementations if the scatterlist
0233           is technically out-of-spec.
0234 
0235           If unsure, say N.
0236 
0237 config DMA_MAP_BENCHMARK
0238         bool "Enable benchmarking of streaming DMA mapping"
0239         depends on DEBUG_FS
0240         help
0241           Provides /sys/kernel/debug/dma_map_benchmark that helps with testing
0242           performance of dma_(un)map_page.
0243 
0244           See tools/testing/selftests/dma/dma_map_benchmark.c