From: Li Hua Qian <huaqian.li@xxxxxxxxxxx> In some applications, the default value of 128 is not sufficient for memory allocation and can cause runtime errors. This change makes IO_TLB_SEGSIZE configurable, allowing it to be increased if needed. Signed-off-by: Li Hua Qian <huaqian.li@xxxxxxxxxxx> --- include/linux/swiotlb.h | 2 +- kernel/dma/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 3dae0f592063..145c71f8329d 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -23,7 +23,7 @@ struct scatterlist; * must be a power of 2. What is the appropriate value ? * The complexity of {map,unmap}_single is linearly dependent on this value. */ -#define IO_TLB_SEGSIZE 128 +#define IO_TLB_SEGSIZE CONFIG_SWIOTLB_SEGSIZE /* * log of the size of each IO TLB slab. The number of slabs is command line diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 31cfdb6b4bc3..38bfa84b96b6 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -102,6 +102,13 @@ config SWIOTLB_DYNAMIC If unsure, say N. +config SWIOTLB_SEGSIZE + int "SWIOTLB segment size" + default 128 + help + Set the maximum allowable number of contiguous slabs to map. + Must be a power of 2. + config DMA_BOUNCE_UNALIGNED_KMALLOC bool depends on SWIOTLB -- 2.34.1