[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191015073003.GA5355@oc0525413822.ibm.com>
Date: Tue, 15 Oct 2019 00:30:03 -0700
From: Ram Pai <linuxram@...ibm.com>
To: Robin Murphy <robin.murphy@....com>
Cc: David Gibson <david@...son.dropbear.id.au>,
linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
linuxppc-dev@...ts.ozlabs.org,
virtualization@...ts.linux-foundation.org,
benh@...nel.crashing.org, mpe@...erman.id.au, paulus@...abs.org,
mdroth@...ux.vnet.ibm.com, aik@...ux.ibm.com, paul.burton@...s.com,
b.zolnierkie@...sung.com, m.szyprowski@...sung.com, hch@....de,
jasowang@...hat.com, andmike@...ibm.com,
sukadev@...ux.vnet.ibm.com, mst@...hat.com, bauerman@...ux.ibm.com
Subject: RE: [PATCH 1/2] dma-mapping: Add dma_addr_is_phys_addr()
On Mon, Oct 14, 2019 at 11:29:24AM +0100, Robin Murphy wrote:
> On 14/10/2019 05:51, David Gibson wrote:
> >On Fri, Oct 11, 2019 at 06:25:18PM -0700, Ram Pai wrote:
> >>From: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
> >>
> >>In order to safely use the DMA API, virtio needs to know whether DMA
> >>addresses are in fact physical addresses and for that purpose,
> >>dma_addr_is_phys_addr() is introduced.
> >>
> >>cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> >>cc: David Gibson <david@...son.dropbear.id.au>
> >>cc: Michael Ellerman <mpe@...erman.id.au>
> >>cc: Paul Mackerras <paulus@...abs.org>
> >>cc: Michael Roth <mdroth@...ux.vnet.ibm.com>
> >>cc: Alexey Kardashevskiy <aik@...ux.ibm.com>
> >>cc: Paul Burton <paul.burton@...s.com>
> >>cc: Robin Murphy <robin.murphy@....com>
> >>cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
> >>cc: Marek Szyprowski <m.szyprowski@...sung.com>
> >>cc: Christoph Hellwig <hch@....de>
> >>Suggested-by: Michael S. Tsirkin <mst@...hat.com>
> >>Signed-off-by: Ram Pai <linuxram@...ibm.com>
> >>Signed-off-by: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
> >
> >The change itself looks ok, so
> >
> >Reviewed-by: David Gibson <david@...son.dropbear.id.au>
> >
> >However, I would like to see the commit message (and maybe the inline
> >comments) expanded a bit on what the distinction here is about. Some
> >of the text from the next patch would be suitable, about DMA addresses
> >usually being in a different address space but not in the case of
> >bounce buffering.
>
> Right, this needs a much tighter definition. "DMA address happens to
> be a valid physical address" is true of various IOMMU setups too,
> but I can't believe it's meaningful in such cases.
The definition by itself is meaningful AFAICT. At its core its just
indicating whether DMA addresses are physical addresses or not.
However its up to the caller to use it meaningfully. For non-virtio caller,
dma_addr_is_phys_addr() by itself may or may not be meaningful.
But for a virtio caller, this information when paired with
mem_encrypt_active() is meaningful.
For IOMMU setups DMA API will get used regardless of "DMA address
happens to be a valid physical address"
>
> If what you actually want is "DMA is direct or SWIOTLB" - i.e. "DMA
> address is physical address of DMA data (not necessarily the
> original buffer)" - wouldn't dma_is_direct() suffice?
This may also work, I think. MST: thoughts?
RP
Powered by blists - more mailing lists