]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dma-mapping: export new dma_*map_phys() interface
authorLeon Romanovsky <leonro@nvidia.com>
Tue, 9 Sep 2025 13:27:39 +0000 (16:27 +0300)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 11 Sep 2025 22:18:21 +0000 (00:18 +0200)
commitf7326196a781622b33bfbdabb00f5e72b5fb5679
tree3f8450ea4808ff6ca230f24b2e9164a9b4a9bb5b
parentbf0ecb3c32396b3518f787d962c575f5a5cf097e
dma-mapping: export new dma_*map_phys() interface

Introduce new DMA mapping functions dma_map_phys() and dma_unmap_phys()
that operate directly on physical addresses instead of page+offset
parameters. This provides a more efficient interface for drivers that
already have physical addresses available.

The new functions are implemented as the primary mapping layer, with
the existing dma_map_page_attrs()/dma_map_resource() and
dma_unmap_page_attrs()/dma_unmap_resource() functions converted to simple
wrappers around the phys-based implementations.

In case dma_map_page_attrs(), the struct page is converted to physical
address with help of page_to_phys() function and dma_map_resource()
provides physical address as is together with addition of DMA_ATTR_MMIO
attribute.

The old page-based API is preserved in mapping.c to ensure that existing
code won't be affected by changing EXPORT_SYMBOL to EXPORT_SYMBOL_GPL
variant for dma_*map_phys().

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/54cc52af91777906bbe4a386113437ba0bcfba9c.1757423202.git.leonro@nvidia.com
drivers/iommu/dma-iommu.c
include/linux/dma-direct.h
include/linux/dma-mapping.h
include/linux/iommu-dma.h
include/trace/events/dma.h
kernel/dma/debug.c
kernel/dma/debug.h
kernel/dma/direct.c
kernel/dma/mapping.c