[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200609053949.GA26473@infradead.org>
Date: Mon, 8 Jun 2020 22:39:49 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Stefano Stabellini <sstabellini@...nel.org>
Cc: Christoph Hellwig <hch@...radead.org>, jgross@...e.com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org,
tamas@...engyel.com, roman@...eda.com,
Stefano Stabellini <stefano.stabellini@...inx.com>
Subject: Re: [PATCH v2 10/11] xen/arm: introduce phys/dma translations in
xen_dma_sync_for_*
On Mon, Jun 08, 2020 at 10:38:02PM -0700, Christoph Hellwig wrote:
> On Mon, Jun 08, 2020 at 05:38:28PM -0700, Stefano Stabellini wrote:
> > Yeah, the pfn_valid check is a bit weird by definition because we are
> > using it to understand whether the address belong to us or to another
> > VM. To do the pfn_valid check we need to translate the dma address into
> > something the CPU understands, hence, the dma_to_phys call.
> >
> > Why can't we use the already-provided paddr? Because paddr has been
> > translated twice:
> > 1) from dma to maybe-foreign phys address (could be ours, or another VM)
> > 2) from maybe-foreign address to local (using our local mapping of the foreign page)
> >
> > In fact, it would be clearer if we had all three addresses as parameters
> > of xen_dma_sync_for_cpu: the dma address, the maybe-foreign physical
> > address (we tend to call it xenbus address, baddr), the local physical
> > address. Something like:
>
> I think instead we should move the arch_sync_dma_for_{device,cpu}
> calls from xen_dma_sync_for_{device,cpu} into the callers, as they
> are provided by the generic dma-noncoherent.h and optimized out for
> coherent architectures like x86. Then the swiotlb-xen.c code only
> need to call dma_cache_maint as the interface (which would have to
> grow a better name), which should then only need a single kind of
> address.
... actually I'd keep the xen_dma_sync_for_{device,cpu} names for the
low-level interface, just move the arch_sync_dma_for_{device,cpu}
calls up.
Powered by blists - more mailing lists