Re: [PATCH v5 11/14] sparc: Use physical address DMA mapping
Leon Romanovsky <[email protected]>
| Newsgroups | org.kernel.vger.sparclinux,dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-alpha,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kernel.vger.linux-parisc,org.ozlabs.lists.linuxppc-dev,org.xenproject.lists.xen-devel |
|---|---|
| Message-ID | <20260217131525.GK12989@unreal> |
On Tue, Feb 17, 2026 at 01:55:56PM +0100, Marek Szyprowski wrote: > On 17.02.2026 13:27, John Paul Adrian Glaubitz wrote: > > On Wed, 2025-10-15 at 12:12 +0300, Leon Romanovsky wrote: > >> From: Leon Romanovsky <[email protected]> > >> > >> Convert sparc architecture DMA code to use .map_phys callback. > >> > >> Signed-off-by: Leon Romanovsky <[email protected]> > >> --- > >> arch/sparc/kernel/iommu.c | 30 +++++++++++++++++----------- > >> arch/sparc/kernel/pci_sun4v.c | 31 ++++++++++++++++++----------- > >> arch/sparc/mm/io-unit.c | 38 ++++++++++++++++++----------------- > >> arch/sparc/mm/iommu.c | 46 ++++++++++++++++++++++--------------------- > >> 4 files changed, 82 insertions(+), 63 deletions(-) <...> > >> @@ -296,7 +305,6 @@ static dma_addr_t dma_4u_map_page(struct device *dev, struct page *page, > >> bus_addr = (iommu->tbl.table_map_base + > >> ((base - iommu->page_table) << IO_PAGE_SHIFT)); > >> ret = bus_addr | (oaddr & ~IO_PAGE_MASK); > >> - base_paddr = __pa(oaddr & IO_PAGE_MASK); > >> if (strbuf->strbuf_enabled) > >> iopte_protection = IOPTE_STREAMING(ctx); > >> else > >> @@ -304,8 +312,8 @@ static dma_addr_t dma_4u_map_page(struct device *dev, struct page *page, > >> if (direction != DMA_TO_DEVICE) > >> iopte_protection |= IOPTE_WRITE; > >> > >> - for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE) > >> - iopte_val(*base) = iopte_protection | base_paddr; > >> + for (i = 0; i < npages; i++, base++, phys += IO_PAGE_SIZE) > >> + iopte_val(*base) = iopte_protection | phys; > > 'base_paddr' was aligned to start of a page before this patch, while > 'phys'Â includes the offset within a page. Thanks for the fix. I had assumed we needed to revert all changes in iounit_get_area(). Thanks > > > Could You check if the following change fixes the issue? > > diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c > index 46ef88bc9c26..edb0ffb21e2f 100644 > --- a/arch/sparc/kernel/iommu.c > +++ b/arch/sparc/kernel/iommu.c > @@ -312,6 +312,7 @@ static dma_addr_t dma_4u_map_phys(struct device > *dev, phys_addr_t phys, > Â Â Â Â Â Â Â if (direction != DMA_TO_DEVICE) > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â iopte_protection |= IOPTE_WRITE; > > +Â Â Â Â Â Â phys -= offset_in_page(phys); > Â Â Â Â Â Â Â for (i = 0; i < npages; i++, base++, phys += IO_PAGE_SIZE) > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â iopte_val(*base) = iopte_protection | phys; > > >> ... > > Best regards > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland >