[PATCH v1 3/9] parisc: Convert DMA map_page to map_phys interface

James Bottomley James.Bottomley at HansenPartnership.com
Mon Oct 6 01:29:19 AEDT 2025


On Fri, 2025-10-03 at 13:18 -0400, John David Anglin wrote:
> On 2025-10-03 11:01 a.m., Jason Gunthorpe wrote:
> > This doesn't actually use the virt at all:
> > 
> > 	offset = ((unsigned long) addr) & ~IOVP_MASK;
> > 	if((size % L1_CACHE_BYTES) || ((unsigned long)addr %
> > L1_CACHE_BYTES))
> > 		ccio_io_pdir_entry(pdir_start, KERNEL_SPACE,
> > (unsigned long)addr, hint);
> > 
> > And ccio_io_pdir_entry():
> > 	pa = lpa(vba);
> > 
> > Is a special instruction that uses virt but AI tells me that
> > special LPA instruction is returning phys. Not sure if that is a
> > different value than virt_to_phys()..
> 
> ccio_io_pdir_entry currently only supports KERNEL_SPACE.

Actually there's a bit more nuance to it than that.  Obviously DMA has
to support user pages otherwise I/O wouldn't work.  The way it does  is
that all physical pages are mapped in the kernel and we try to make
sure all user mappings are on cache stride (4MB) boundaries so the
coherence index of the kernel virtual address and the user virtual
address are the same, so we can solely use the kernel virtual address
to calculate the coherence index for the IOMMU.  If that's not true, we
flush the user virtual address range in gup and the kernel virtual
address range before sending the I/O completion.

Regards,

James




More information about the Linuxppc-dev mailing list