Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted
From: David Gibson
Date: Mon Aug 12 2019 - 09:54:25 EST
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.
There still seems to be a failure to understand each other here. The
limitation here simply *is not* a property of the device. In fact,
it's effectively a property of the memory the virtio device would be
trying to access (because it's in secure mode it can't be directly
accessed via the hypervisor). There absolutely are cases where this
is a device property (a physical virtio device being the obvious one),
but this isn't one of them.
Unfortunately, we're kind of stymied by the feature negotiation model
of virtio. AIUI the hypervisor / device presents a bunch of feature
bits of which the guest / driver selects a subset.
AFAICT we already kind of abuse this for the VIRTIO_F_IOMMU_PLATFORM,
because to handle for cases where it *is* a device limitation, we
assume that if the hypervisor presents VIRTIO_F_IOMMU_PLATFORM then
the guest *must* select it.
What we actually need here is for the hypervisor to present
VIRTIO_F_IOMMU_PLATFORM as available, but not required. Then we need
a way for the platform core code to communicate to the virtio driver
that *it* requires the IOMMU to be used, so that the driver can select
or not the feature bit on that basis.
> 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?
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
Description: PGP signature