dma_opt_mapping_size returns way too low sizes when using IOMMU

Christoph Hellwig hch at lst.de
Mon Aug 17 01:36:54 PDT 2026


Hi all,

I got reports that NVMe devices were arbitrarily limited to 128kiB
transfers in recent kernel.  It turns out that this only happens when
using an IOMMU and is caused by iommu_dma_opt_mapping_size returning
iova_rcache_range(), which is defined as follows:

unsigned long iova_rcache_range(void)
{
	return PAGE_SIZE << (IOVA_RANGE_CACHE_MAX_SIZE - 1);
}

and thus indeed hardcodes a 128kiB return on 4k page size architectures.

Both the NVMe performance numbers and common sense suggest that this
is NOT the optimal DMA mapping granularity.  Can we pick a saner value
for iommu_dma_opt_mapping_size that does not restrict common I/O sizes?



More information about the Linux-nvme mailing list