1*ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2cf65a0f6SChristoph Hellwig 3cf65a0f6SChristoph Hellwigconfig HAS_DMA 4cf65a0f6SChristoph Hellwig bool 5cf65a0f6SChristoph Hellwig depends on !NO_DMA 6cf65a0f6SChristoph Hellwig default y 7cf65a0f6SChristoph Hellwig 8cf65a0f6SChristoph Hellwigconfig NEED_SG_DMA_LENGTH 9cf65a0f6SChristoph Hellwig bool 10cf65a0f6SChristoph Hellwig 11cf65a0f6SChristoph Hellwigconfig NEED_DMA_MAP_STATE 12cf65a0f6SChristoph Hellwig bool 13cf65a0f6SChristoph Hellwig 14cf65a0f6SChristoph Hellwigconfig ARCH_DMA_ADDR_T_64BIT 15cf65a0f6SChristoph Hellwig def_bool 64BIT || PHYS_ADDR_T_64BIT 16cf65a0f6SChristoph Hellwig 17f3ecc0ffSChristoph Hellwigconfig ARCH_HAS_DMA_COHERENCE_H 18f3ecc0ffSChristoph Hellwig bool 19f3ecc0ffSChristoph Hellwig 2011ddce15SChristoph Hellwigconfig ARCH_HAS_DMA_SET_MASK 2111ddce15SChristoph Hellwig bool 2211ddce15SChristoph Hellwig 23ff4c25f2SChristoph Hellwigconfig DMA_DECLARE_COHERENT 24cf65a0f6SChristoph Hellwig bool 25cf65a0f6SChristoph Hellwig 26347cb6afSChristoph Hellwigconfig ARCH_HAS_SETUP_DMA_OPS 27347cb6afSChristoph Hellwig bool 28347cb6afSChristoph Hellwig 29dc2acdedSChristoph Hellwigconfig ARCH_HAS_TEARDOWN_DMA_OPS 30cf65a0f6SChristoph Hellwig bool 31cf65a0f6SChristoph Hellwig 32cf65a0f6SChristoph Hellwigconfig ARCH_HAS_SYNC_DMA_FOR_DEVICE 33cf65a0f6SChristoph Hellwig bool 34cf65a0f6SChristoph Hellwig 35cf65a0f6SChristoph Hellwigconfig ARCH_HAS_SYNC_DMA_FOR_CPU 36cf65a0f6SChristoph Hellwig bool 37cf65a0f6SChristoph Hellwig select NEED_DMA_MAP_STATE 38cf65a0f6SChristoph Hellwig 39684f7e91SChristoph Hellwigconfig ARCH_HAS_SYNC_DMA_FOR_CPU_ALL 40684f7e91SChristoph Hellwig bool 41684f7e91SChristoph Hellwig 4213bf5cedSChristoph Hellwigconfig ARCH_HAS_DMA_PREP_COHERENT 4313bf5cedSChristoph Hellwig bool 4413bf5cedSChristoph Hellwig 4558b04406SChristoph Hellwigconfig ARCH_HAS_DMA_COHERENT_TO_PFN 4658b04406SChristoph Hellwig bool 4758b04406SChristoph Hellwig 4858b04406SChristoph Hellwigconfig ARCH_HAS_DMA_MMAP_PGPROT 4958b04406SChristoph Hellwig bool 5058b04406SChristoph Hellwig 51cf65a0f6SChristoph Hellwigconfig DMA_NONCOHERENT_CACHE_SYNC 52cf65a0f6SChristoph Hellwig bool 53cf65a0f6SChristoph Hellwig 54cf65a0f6SChristoph Hellwigconfig DMA_VIRT_OPS 55cf65a0f6SChristoph Hellwig bool 56cf65a0f6SChristoph Hellwig depends on HAS_DMA 57cf65a0f6SChristoph Hellwig 58cf65a0f6SChristoph Hellwigconfig SWIOTLB 59cf65a0f6SChristoph Hellwig bool 60cf65a0f6SChristoph Hellwig select NEED_DMA_MAP_STATE 61f0edfea8SChristoph Hellwig 62f0edfea8SChristoph Hellwigconfig DMA_REMAP 63f0edfea8SChristoph Hellwig depends on MMU 64c13edf81SClément Leger select GENERIC_ALLOCATOR 65f0edfea8SChristoph Hellwig bool 660c3b3171SChristoph Hellwig 670c3b3171SChristoph Hellwigconfig DMA_DIRECT_REMAP 680c3b3171SChristoph Hellwig bool 690c3b3171SChristoph Hellwig select DMA_REMAP 7070ca7ba2SAndy Shevchenko 71ddb26d8eSChristoph Hellwigconfig DMA_CMA 72ddb26d8eSChristoph Hellwig bool "DMA Contiguous Memory Allocator" 73ddb26d8eSChristoph Hellwig depends on HAVE_DMA_CONTIGUOUS && CMA 74ddb26d8eSChristoph Hellwig help 75ddb26d8eSChristoph Hellwig This enables the Contiguous Memory Allocator which allows drivers 76ddb26d8eSChristoph Hellwig to allocate big physically-contiguous blocks of memory for use with 77ddb26d8eSChristoph Hellwig hardware components that do not support I/O map nor scatter-gather. 78ddb26d8eSChristoph Hellwig 79ddb26d8eSChristoph Hellwig You can disable CMA by specifying "cma=0" on the kernel's command 80ddb26d8eSChristoph Hellwig line. 81ddb26d8eSChristoph Hellwig 82ddb26d8eSChristoph Hellwig For more information see <include/linux/dma-contiguous.h>. 83ddb26d8eSChristoph Hellwig If unsure, say "n". 84ddb26d8eSChristoph Hellwig 85ddb26d8eSChristoph Hellwigif DMA_CMA 86ddb26d8eSChristoph Hellwigcomment "Default contiguous memory area size:" 87ddb26d8eSChristoph Hellwig 88ddb26d8eSChristoph Hellwigconfig CMA_SIZE_MBYTES 89ddb26d8eSChristoph Hellwig int "Size in Mega Bytes" 90ddb26d8eSChristoph Hellwig depends on !CMA_SIZE_SEL_PERCENTAGE 91ddb26d8eSChristoph Hellwig default 0 if X86 92ddb26d8eSChristoph Hellwig default 16 93ddb26d8eSChristoph Hellwig help 94ddb26d8eSChristoph Hellwig Defines the size (in MiB) of the default memory area for Contiguous 95ddb26d8eSChristoph Hellwig Memory Allocator. If the size of 0 is selected, CMA is disabled by 96ddb26d8eSChristoph Hellwig default, but it can be enabled by passing cma=size[MG] to the kernel. 97ddb26d8eSChristoph Hellwig 98ddb26d8eSChristoph Hellwig 99ddb26d8eSChristoph Hellwigconfig CMA_SIZE_PERCENTAGE 100ddb26d8eSChristoph Hellwig int "Percentage of total memory" 101ddb26d8eSChristoph Hellwig depends on !CMA_SIZE_SEL_MBYTES 102ddb26d8eSChristoph Hellwig default 0 if X86 103ddb26d8eSChristoph Hellwig default 10 104ddb26d8eSChristoph Hellwig help 105ddb26d8eSChristoph Hellwig Defines the size of the default memory area for Contiguous Memory 106ddb26d8eSChristoph Hellwig Allocator as a percentage of the total memory in the system. 107ddb26d8eSChristoph Hellwig If 0 percent is selected, CMA is disabled by default, but it can be 108ddb26d8eSChristoph Hellwig enabled by passing cma=size[MG] to the kernel. 109ddb26d8eSChristoph Hellwig 110ddb26d8eSChristoph Hellwigchoice 111ddb26d8eSChristoph Hellwig prompt "Selected region size" 112ddb26d8eSChristoph Hellwig default CMA_SIZE_SEL_MBYTES 113ddb26d8eSChristoph Hellwig 114ddb26d8eSChristoph Hellwigconfig CMA_SIZE_SEL_MBYTES 115ddb26d8eSChristoph Hellwig bool "Use mega bytes value only" 116ddb26d8eSChristoph Hellwig 117ddb26d8eSChristoph Hellwigconfig CMA_SIZE_SEL_PERCENTAGE 118ddb26d8eSChristoph Hellwig bool "Use percentage value only" 119ddb26d8eSChristoph Hellwig 120ddb26d8eSChristoph Hellwigconfig CMA_SIZE_SEL_MIN 121ddb26d8eSChristoph Hellwig bool "Use lower value (minimum)" 122ddb26d8eSChristoph Hellwig 123ddb26d8eSChristoph Hellwigconfig CMA_SIZE_SEL_MAX 124ddb26d8eSChristoph Hellwig bool "Use higher value (maximum)" 125ddb26d8eSChristoph Hellwig 126ddb26d8eSChristoph Hellwigendchoice 127ddb26d8eSChristoph Hellwig 128ddb26d8eSChristoph Hellwigconfig CMA_ALIGNMENT 129ddb26d8eSChristoph Hellwig int "Maximum PAGE_SIZE order of alignment for contiguous buffers" 130ddb26d8eSChristoph Hellwig range 4 12 131ddb26d8eSChristoph Hellwig default 8 132ddb26d8eSChristoph Hellwig help 133ddb26d8eSChristoph Hellwig DMA mapping framework by default aligns all buffers to the smallest 134ddb26d8eSChristoph Hellwig PAGE_SIZE order which is greater than or equal to the requested buffer 135ddb26d8eSChristoph Hellwig size. This works well for buffers up to a few hundreds kilobytes, but 136ddb26d8eSChristoph Hellwig for larger buffers it just a memory waste. With this parameter you can 137ddb26d8eSChristoph Hellwig specify the maximum PAGE_SIZE order for contiguous buffers. Larger 138ddb26d8eSChristoph Hellwig buffers will be aligned only to this specified order. The order is 139ddb26d8eSChristoph Hellwig expressed as a power of two multiplied by the PAGE_SIZE. 140ddb26d8eSChristoph Hellwig 141ddb26d8eSChristoph Hellwig For example, if your system defaults to 4KiB pages, the order value 142ddb26d8eSChristoph Hellwig of 8 means that the buffers will be aligned up to 1MiB only. 143ddb26d8eSChristoph Hellwig 144ddb26d8eSChristoph Hellwig If unsure, leave the default value "8". 145ddb26d8eSChristoph Hellwig 146ddb26d8eSChristoph Hellwigendif 147ddb26d8eSChristoph Hellwig 14870ca7ba2SAndy Shevchenkoconfig DMA_API_DEBUG 14970ca7ba2SAndy Shevchenko bool "Enable debugging of DMA-API usage" 15070ca7ba2SAndy Shevchenko select NEED_DMA_MAP_STATE 15170ca7ba2SAndy Shevchenko help 15270ca7ba2SAndy Shevchenko Enable this option to debug the use of the DMA API by device drivers. 15370ca7ba2SAndy Shevchenko With this option you will be able to detect common bugs in device 15470ca7ba2SAndy Shevchenko drivers like double-freeing of DMA mappings or freeing mappings that 15570ca7ba2SAndy Shevchenko were never allocated. 15670ca7ba2SAndy Shevchenko 15770ca7ba2SAndy Shevchenko This also attempts to catch cases where a page owned by DMA is 15870ca7ba2SAndy Shevchenko accessed by the cpu in a way that could cause data corruption. For 15970ca7ba2SAndy Shevchenko example, this enables cow_user_page() to check that the source page is 16070ca7ba2SAndy Shevchenko not undergoing DMA. 16170ca7ba2SAndy Shevchenko 16270ca7ba2SAndy Shevchenko This option causes a performance degradation. Use only if you want to 16370ca7ba2SAndy Shevchenko debug device drivers and dma interactions. 16470ca7ba2SAndy Shevchenko 16570ca7ba2SAndy Shevchenko If unsure, say N. 16670ca7ba2SAndy Shevchenko 16770ca7ba2SAndy Shevchenkoconfig DMA_API_DEBUG_SG 16870ca7ba2SAndy Shevchenko bool "Debug DMA scatter-gather usage" 16970ca7ba2SAndy Shevchenko default y 17070ca7ba2SAndy Shevchenko depends on DMA_API_DEBUG 17170ca7ba2SAndy Shevchenko help 17270ca7ba2SAndy Shevchenko Perform extra checking that callers of dma_map_sg() have respected the 17370ca7ba2SAndy Shevchenko appropriate segment length/boundary limits for the given device when 17470ca7ba2SAndy Shevchenko preparing DMA scatterlists. 17570ca7ba2SAndy Shevchenko 17670ca7ba2SAndy Shevchenko This is particularly likely to have been overlooked in cases where the 17770ca7ba2SAndy Shevchenko dma_map_sg() API is used for general bulk mapping of pages rather than 17870ca7ba2SAndy Shevchenko preparing literal scatter-gather descriptors, where there is a risk of 17970ca7ba2SAndy Shevchenko unexpected behaviour from DMA API implementations if the scatterlist 18070ca7ba2SAndy Shevchenko is technically out-of-spec. 18170ca7ba2SAndy Shevchenko 18270ca7ba2SAndy Shevchenko If unsure, say N. 183