Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Leon Romanovsky and committed by
Marek Szyprowski
e4e3fff6 6aaecdf0

+13 -7
+13 -7
arch/mips/jazz/jazzdma.c
··· 521 521 __free_pages(virt_to_page(vaddr), get_order(size)); 522 522 } 523 523 524 - static dma_addr_t jazz_dma_map_page(struct device *dev, struct page *page, 525 - unsigned long offset, size_t size, enum dma_data_direction dir, 526 - unsigned long attrs) 524 + static dma_addr_t jazz_dma_map_phys(struct device *dev, phys_addr_t phys, 525 + size_t size, enum dma_data_direction dir, unsigned long attrs) 527 526 { 528 - phys_addr_t phys = page_to_phys(page) + offset; 527 + if (unlikely(attrs & DMA_ATTR_MMIO)) 528 + /* 529 + * This check is included because older versions of the code lacked 530 + * MMIO path support, and my ability to test this path is limited. 531 + * However, from a software technical standpoint, there is no restriction, 532 + * as the following code operates solely on physical addresses. 533 + */ 534 + return DMA_MAPPING_ERROR; 529 535 530 536 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) 531 537 arch_sync_dma_for_device(phys, size, dir); 532 538 return vdma_alloc(phys, size); 533 539 } 534 540 535 - static void jazz_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, 541 + static void jazz_dma_unmap_phys(struct device *dev, dma_addr_t dma_addr, 536 542 size_t size, enum dma_data_direction dir, unsigned long attrs) 537 543 { 538 544 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) ··· 613 607 const struct dma_map_ops jazz_dma_ops = { 614 608 .alloc = jazz_dma_alloc, 615 609 .free = jazz_dma_free, 616 - .map_page = jazz_dma_map_page, 617 - .unmap_page = jazz_dma_unmap_page, 610 + .map_phys = jazz_dma_map_phys, 611 + .unmap_phys = jazz_dma_unmap_phys, 618 612 .map_sg = jazz_dma_map_sg, 619 613 .unmap_sg = jazz_dma_unmap_sg, 620 614 .sync_single_for_cpu = jazz_dma_sync_single_for_cpu,