mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
x86: Use physical address for DMA mapping
Perform mechanical conversion from DMA .map_page to .map_phys. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20251015-remove-map-page-v5-12-3bbfe3a25cdf@kernel.org
This commit is contained in:
committed by
Marek Szyprowski
parent
38c0d0ebf5
commit
33d2c5ee10
@@ -222,13 +222,14 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
|
||||
}
|
||||
|
||||
/* Map a single area into the IOMMU */
|
||||
static dma_addr_t gart_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction dir,
|
||||
static dma_addr_t gart_map_phys(struct device *dev, phys_addr_t paddr,
|
||||
size_t size, enum dma_data_direction dir,
|
||||
unsigned long attrs)
|
||||
{
|
||||
unsigned long bus;
|
||||
phys_addr_t paddr = page_to_phys(page) + offset;
|
||||
|
||||
if (unlikely(attrs & DMA_ATTR_MMIO))
|
||||
return DMA_MAPPING_ERROR;
|
||||
|
||||
if (!need_iommu(dev, paddr, size))
|
||||
return paddr;
|
||||
@@ -242,7 +243,7 @@ static dma_addr_t gart_map_page(struct device *dev, struct page *page,
|
||||
/*
|
||||
* Free a DMA mapping.
|
||||
*/
|
||||
static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr,
|
||||
static void gart_unmap_phys(struct device *dev, dma_addr_t dma_addr,
|
||||
size_t size, enum dma_data_direction dir,
|
||||
unsigned long attrs)
|
||||
{
|
||||
@@ -282,7 +283,7 @@ static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
|
||||
for_each_sg(sg, s, nents, i) {
|
||||
if (!s->dma_length || !s->length)
|
||||
break;
|
||||
gart_unmap_page(dev, s->dma_address, s->dma_length, dir, 0);
|
||||
gart_unmap_phys(dev, s->dma_address, s->dma_length, dir, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@ static void
|
||||
gart_free_coherent(struct device *dev, size_t size, void *vaddr,
|
||||
dma_addr_t dma_addr, unsigned long attrs)
|
||||
{
|
||||
gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, 0);
|
||||
gart_unmap_phys(dev, dma_addr, size, DMA_BIDIRECTIONAL, 0);
|
||||
dma_direct_free(dev, size, vaddr, dma_addr, attrs);
|
||||
}
|
||||
|
||||
@@ -668,8 +669,8 @@ static __init int init_amd_gatt(struct agp_kern_info *info)
|
||||
static const struct dma_map_ops gart_dma_ops = {
|
||||
.map_sg = gart_map_sg,
|
||||
.unmap_sg = gart_unmap_sg,
|
||||
.map_page = gart_map_page,
|
||||
.unmap_page = gart_unmap_page,
|
||||
.map_phys = gart_map_phys,
|
||||
.unmap_phys = gart_unmap_phys,
|
||||
.alloc = gart_alloc_coherent,
|
||||
.free = gart_free_coherent,
|
||||
.mmap = dma_common_mmap,
|
||||
|
||||
Reference in New Issue
Block a user