Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm64/configs/qcom.config
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ CONFIG_STM_PROTO_SYS_T=m
CONFIG_STM_SOURCE_CONSOLE=m
CONFIG_STM_SOURCE_FTRACE=m
CONFIG_STM_SOURCE_HEARTBEAT=m
CONFIG_SWIOTLB_DEFAULT_SIZE_MB=2
CONFIG_SENSORS_AMC6821=y
CONFIG_SENSORS_EMC2305=y
CONFIG_SENSORS_QCOM_BCL=y
Expand Down
12 changes: 10 additions & 2 deletions include/linux/swiotlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ struct scatterlist;
#define IO_TLB_SHIFT 11
#define IO_TLB_SIZE (1 << IO_TLB_SHIFT)

/* default to 64MB */
#define IO_TLB_DEFAULT_SIZE (64UL<<20)
/*
* Default SWIOTLB bounce buffer pool size.
* Configurable at compile time via CONFIG_SWIOTLB_DEFAULT_SIZE_MB.
* Falls back to 64 MB if not set via Kconfig.
*/
#if defined(CONFIG_SWIOTLB) && defined(CONFIG_SWIOTLB_DEFAULT_SIZE_MB)
#define IO_TLB_DEFAULT_SIZE ((unsigned long)CONFIG_SWIOTLB_DEFAULT_SIZE_MB << 20)
#else
#define IO_TLB_DEFAULT_SIZE (64UL << 20)
#endif

unsigned long swiotlb_size_or_default(void);
void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
Expand Down
21 changes: 21 additions & 0 deletions kernel/dma/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ config SWIOTLB
bool
select NEED_DMA_MAP_STATE

config SWIOTLB_DEFAULT_SIZE_MB
int "Default SWIOTLB bounce buffer size in MB"
depends on SWIOTLB
range 1 64
default 64
help
Sets the default size of the software IO TLB (SWIOTLB) bounce buffer
pool allocated at boot time. The default is 64 MB.

On memory-constrained embedded or mobile platforms (e.g., those with
a hardware IOMMU such as ARM SMMU covering most DMA-capable devices),
a smaller value such as 4 or 8 MB may be sufficient. The SWIOTLB is
then only needed for devices that bypass the IOMMU or have restricted
DMA address ranges.

The minimum allowed value is 1 MB. This compile-time default can be
overridden at runtime using the "swiotlb=<nslabs>" kernel command line
parameter, where nslabs = (desired_size_in_bytes / 2048).

If unsure, leave at the default value of 64.

config SWIOTLB_DYNAMIC
bool "Dynamic allocation of DMA bounce buffers"
default n
Expand Down