Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

From: Christoph Hellwig
Date: Fri Feb 21 2020 - 11:35:29 EST


On Fri, Feb 21, 2020 at 10:56:45AM -0500, Michael S. Tsirkin wrote:
> > > - DMA API is giving us addresses that are actually also physical
> > > addresses
> >
> > In case of s390 this is given.
> > I talked with the power people before
> > posting this, and they ensured me they can are willing to deal with
> > this. I was hoping to talk abut this with the AMD SEV people here (hence
> > the cc).
>
> We'd need a part of DMA API that promises this though. Platform
> maintainers aren't going to go out of their way to do the
> right thing just for virtio, and I can't track all arches
> to make sure they don't violate virtio requirements.

There is no way the DMA API is going to promise that you. All kinds
of platforms have offsets to DMA, and they are communicated through
interfaces like the device tree or ACPI. But the good thing is that
your hypervisors is in control of that, neither the DMA API nor
virtio have any business to interfer with that. In fact for harware
virtio device we might need such an offset for them to work on
lots of SOCs.