Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

From: Michael S. Tsirkin
Date: Sun Aug 11 2019 - 04:44:28 EST


On Sat, Aug 10, 2019 at 11:46:21PM -0700, Ram Pai wrote:
> On Sun, Aug 11, 2019 at 07:56:07AM +0200, Christoph Hellwig wrote:
> > sev_active() is gone now in linux-next, at least as a global API.
> >
> > And once again this is entirely going in the wrong direction. The only
> > way using the DMA API is going to work at all is if the device is ready
> > for it. So we need a flag on the virtio device, exposed by the
> > hypervisor (or hardware for hw virtio devices) that says: hey, I'm real,
> > don't take a shortcut.
> >
> > And that means on power and s390 qemu will always have to set thos if
> > you want to be ready for the ultravisor and co games. It's not like we
> > haven't been through this a few times before, have we?
>
>
> We have been through this so many times, but I dont think, we ever
> understood each other. I have a fundamental question, the answer to
> which was never clear. Here it is...
>
> If the hypervisor (hardware for hw virtio devices) does not mandate a
> DMA API, why is it illegal for the driver to request, special handling
> of its i/o buffers? Why are we associating this special handling to
> always mean, some DMA address translation? Can't there be
> any other kind of special handling needs, that has nothing to do with
> DMA address translation?

I think the answer to that is, extend the DMA API to cover that special
need then. And that's exactly what dma_addr_is_phys_addr is trying to
do.

>
> --
> Ram Pai