Re: [PATCH 3/4] dma-mapping: add DMA_IOVA_FLAGS mask for the dma_iova_state size flags

From: Jason Gunthorpe

Date: Fri Nov 27 2026 - 09:40:28 EST


On Fri, Nov 27, 2026 at 12:58:47PM +0100, Marek Szyprowski wrote:
> dma_iova_state::__size uses its top bit to record that SWIOTLB was used
> for one of the linked ranges. Users that mask or validate sizes refer to
> DMA_IOVA_USE_SWIOTLB directly, so adding another flag would require
> updating all of them.
>
> Add DMA_IOVA_FLAGS covering all flags kept in __size and use it in
> dma_iova_size(), in the size check of dma_iova_try_alloc() and in the
> vfio-pci dma-buf length validation. No functional change.
>
> Cc: stable@xxxxxxxxxxxxxxx # v7.3+
> Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> ---
> drivers/iommu/dma-iommu.c | 8 ++++----
> drivers/vfio/pci/vfio_pci_dmabuf.c | 2 +-
> include/linux/dma-mapping.h | 8 +++++++-
> 3 files changed, 12 insertions(+), 6 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason