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@xxxxxxxxxxxxx> > >> > >>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@xxxxxxxxxxxxxxxxxxx> > >>cc: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > >>cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> > >>cc: Paul Mackerras <paulus@xxxxxxxxxx> > >>cc: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx> > >>cc: Alexey Kardashevskiy <aik@xxxxxxxxxxxxx> > >>cc: Paul Burton <paul.burton@xxxxxxxx> > >>cc: Robin Murphy <robin.murphy@xxxxxxx> > >>cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> > >>cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> > >>cc: Christoph Hellwig <hch@xxxxxx> > >>Suggested-by: Michael S. Tsirkin <mst@xxxxxxxxxx> > >>Signed-off-by: Ram Pai <linuxram@xxxxxxxxxx> > >>Signed-off-by: Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxx> > > > >The change itself looks ok, so > > > >Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > > > >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 _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization