[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce05d6629571eba0a2f0a104fb5584021806addc.camel@HansenPartnership.com>
Date: Sun, 05 Oct 2025 10:29:19 -0400
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: John David Anglin <dave.anglin@...l.net>, Jason Gunthorpe
<jgg@...dia.com>, Leon Romanovsky <leon@...nel.org>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>, Leon Romanovsky
<leonro@...dia.com>, Andreas Larsson <andreas@...sler.com>, Borislav Petkov
<bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, "David S.
Miller" <davem@...emloft.net>, Geoff Levand <geoff@...radead.org>, Helge
Deller <deller@....de>, Ingo Molnar <mingo@...hat.com>,
iommu@...ts.linux.dev, Jason Wang <jasowang@...hat.com>, Juergen Gross
<jgross@...e.com>, linux-alpha@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
linux-parisc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, Madhavan
Srinivasan <maddy@...ux.ibm.com>, Matt Turner <mattst88@...il.com>, Michael
Ellerman <mpe@...erman.id.au>, "Michael S. Tsirkin" <mst@...hat.com>,
Richard Henderson <richard.henderson@...aro.org>,
sparclinux@...r.kernel.org, Stefano Stabellini <sstabellini@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>, Thomas Gleixner
<tglx@...utronix.de>, virtualization@...ts.linux.dev, x86@...nel.org,
xen-devel@...ts.xenproject.org, Magnus Lindholm <linmag7@...il.com>
Subject: Re: [PATCH v1 3/9] parisc: Convert DMA map_page to map_phys
interface
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
Powered by blists - more mailing lists