Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

Benjamin Herrenschmidt
2014-09-01T22:16:54Z

On Mon, 2014-09-01 at 10:39 -0700, Andy Lutomirski wrote:
> Changes from v1:
> - Using the DMA API is optional now. It would be nice to improve the
> DMA API to the point that it could be used unconditionally, but s390
> proves that we're not there yet.
> - Includes patch 4, which fixes DMA debugging warnings from virtio_net.

I'm not sure if you saw my reply on the other thread but I have a few
comments based on the above "it would be nice if ..."

So here we have both a yes and a no :-)

It would be nice to avoid those if () games all over and indeed just
use the DMA API, *however* we most certainly don't want to actually
create IOMMU mappings for the KVM virio case. This would be a massive
loss in performances on several platforms and generally doesn't make
much sense.

However, we can still use the API without that on any architecture
where the dma mapping API ends up calling the generic dma_map_ops,
it becomes just a matter of virtio setting up some special "nop" ops
when needed.

The difficulty here resides in the fact that we have never completely
made the dma_map_ops generic. The ops themselves are defined generically
as are the dma_map_* interfaces based on them, but the location of the
ops pointer is still more/less arch specific and some architectures
still chose not to use that indirection at all I believe.

Cheers,
Ben.