]> www.infradead.org Git - users/hch/block.git/commit
blk-mq: add scatterlist-less DMA mapping helpers
authorChristoph Hellwig <hch@lst.de>
Sat, 5 Oct 2024 05:46:26 +0000 (07:46 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 5 Oct 2024 17:19:34 +0000 (19:19 +0200)
commitac009ee43fe386b4c2c0834ebd28478189fb8c4c
treefa43c83cba701c3b715cfb1058b4c23b0c44ae8b
parent8273e482f73d244c61a750e8b3757429c3d898df
blk-mq: add scatterlist-less DMA mapping helpers

Add a new blk_rq_dma_map / blk_rq_dma_unmap pair that does away with
the wasteful scatterlist structure.  Instead it uses the mapping iterator
to either add segments to the IOVA for IOMMU operations, or just maps
them one by one for the direct mapping.  For the IOMMU case instead of
a scatterlist with an entry for each segment, only a single [dma_addr,len]
pair needs to be stored for processing a request, and for the direct
mapping the per-segment allocation shrinks from
[page,offset,len,dma_addr,dma_len] to just [dma_addr,len].

The major downѕide of this API is that the IOVA collapsing only works
when the driver sets a virt_boundary that matches the IOMMU granule.

Note that struct blk_dma_vec, struct blk_dma_mapping and blk_rq_dma_unmap
aren't really block specific, but for they are kept with the only mapping
routine to keep things simple.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/blk-merge.c
include/linux/blk-mq.h