swiotlb: Limit max bounce buffer size

Limiting to 4096, assuming this is used for virtual io block device. The
default maximum (256kB) would result in overflowing of bounce buffers
and stalling of IO (max_segments of 254 for block device and max
bounce size of 256kB could result in block layer submitting a huge IO
request that can never be finished successfully). With 4096, we have
the max size of request set to 254*4096, which is a reasonable space
to set aside per block device.

Change-Id: I8a3b0ec6d26a1b7f5ccdcee649f02c3556bce93b
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
This commit is contained in:
Srivatsa Vaddagiri 2021-01-07 09:08:14 -08:00 committed by Gerrit - the friendly Code Review server
parent 13a1aaf641
commit 8dbe481c45

View File

@ -794,7 +794,12 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t paddr, size_t size,
}
#ifdef CONFIG_SWIOTLB_NONLINEAR
EXPORT_SYMBOL(swiotlb_map);
#endif
size_t swiotlb_max_mapping_size(struct device *dev)
{
return 4096;
}
#else
size_t swiotlb_max_mapping_size(struct device *dev)
{
@ -811,6 +816,7 @@ size_t swiotlb_max_mapping_size(struct device *dev)
return ((size_t)IO_TLB_SIZE) * IO_TLB_SEGSIZE - min_align;
}
#endif
bool is_swiotlb_active(struct device *dev)
{