mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 11:06:41 -05:00
MIPS/jazzdma: Provide physical address directly
MIPS jazz uses physical addresses for mapping pages, so convert it to get them directly from DMA mapping routine. 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-8-3bbfe3a25cdf@kernel.org
This commit is contained in:
committed by
Marek Szyprowski
parent
6aaecdf0d8
commit
e4e3fff66a
@@ -521,18 +521,24 @@ static void jazz_dma_free(struct device *dev, size_t size, void *vaddr,
|
||||
__free_pages(virt_to_page(vaddr), get_order(size));
|
||||
}
|
||||
|
||||
static dma_addr_t jazz_dma_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size, enum dma_data_direction dir,
|
||||
unsigned long attrs)
|
||||
static dma_addr_t jazz_dma_map_phys(struct device *dev, phys_addr_t phys,
|
||||
size_t size, enum dma_data_direction dir, unsigned long attrs)
|
||||
{
|
||||
phys_addr_t phys = page_to_phys(page) + offset;
|
||||
if (unlikely(attrs & DMA_ATTR_MMIO))
|
||||
/*
|
||||
* This check is included because older versions of the code lacked
|
||||
* MMIO path support, and my ability to test this path is limited.
|
||||
* However, from a software technical standpoint, there is no restriction,
|
||||
* as the following code operates solely on physical addresses.
|
||||
*/
|
||||
return DMA_MAPPING_ERROR;
|
||||
|
||||
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
|
||||
arch_sync_dma_for_device(phys, size, dir);
|
||||
return vdma_alloc(phys, size);
|
||||
}
|
||||
|
||||
static void jazz_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
|
||||
static void jazz_dma_unmap_phys(struct device *dev, dma_addr_t dma_addr,
|
||||
size_t size, enum dma_data_direction dir, unsigned long attrs)
|
||||
{
|
||||
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
|
||||
@@ -607,8 +613,8 @@ static void jazz_dma_sync_sg_for_cpu(struct device *dev,
|
||||
const struct dma_map_ops jazz_dma_ops = {
|
||||
.alloc = jazz_dma_alloc,
|
||||
.free = jazz_dma_free,
|
||||
.map_page = jazz_dma_map_page,
|
||||
.unmap_page = jazz_dma_unmap_page,
|
||||
.map_phys = jazz_dma_map_phys,
|
||||
.unmap_phys = jazz_dma_unmap_phys,
|
||||
.map_sg = jazz_dma_map_sg,
|
||||
.unmap_sg = jazz_dma_unmap_sg,
|
||||
.sync_single_for_cpu = jazz_dma_sync_single_for_cpu,
|
||||
|
||||
Reference in New Issue
Block a user