Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

Benjamin Herrenschmidt
2014-09-21T05:03:08Z

On Fri, 2014-09-19 at 22:59 -0700, Andy Lutomirski wrote:
> Sure.
>
> The question is: should the patches go in to 3.18 as is our should
> they wait? It would be straightforward to remove the use_dma_api
> switch PPC, s390, and virtio_mmio are ready.

I don't mind the patches going in now in their current form with one
exception (see below), but I'm keen on moving all the way to an
unconditional use of the DMA API with a simple tweaking of the dma ops
of the device based on need/iommu/etc...

What I might do is first experiment with powerpc to try to set
use_dma_api to true and do the dma_ops manipulation.

The exception I mentioned is that I would really like the virtio device
to expose via whatever transport we chose to use (though capability
exchange sounds like a reasonable one) whether the "server"
implementation is bypassing IOMMUs or not instead on relying on client
side heuristics.

IE. Basically, we are trying to "guess" with an ifdef CONFIG_PPC, what
is essentially an attribute of the server-side, ie, whether is bypasses
the iommu for the PCI bus it resides on.

I believe all the arguments about whether this should be a bus property
or whether the x86 case can be worked around via ACPI tables etc... are
all moot. Today, qemu implementation can put virtio devices on busses
with an iommu and bypass it, so at the very least for backward
compatibility, we should expose that appropriately from the "server"
side.

Cheers,
Ben.