Message ID | 20201020061859.18385-6-kirill.shutemov@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM protected memory extension | expand |
NAK. Any virtio implementation that needs special DMA OPS treatment needs to set the VIRTIO_F_ACCESS_PLATFORM bit. The only reason the Xen hack existst is because it slipped in a long time ago and we can't fix that any more.
On Tue, Oct 20, 2020 at 09:06:58AM +0100, Christoph Hellwig wrote: > NAK. Any virtio implementation that needs special DMA OPS treatment > needs to set the VIRTIO_F_ACCESS_PLATFORM bit. The only reason the > Xen hack existst is because it slipped in a long time ago and we can't > fix that any more. Thanks. Will fix.
On Tue, 20 Oct 2020 09:18:48 +0300 "Kirill A. Shutemov" <kirill@shutemov.name> wrote: > VirtIO for KVM is a primary way to provide IO. All memory that used for > communication with the host has to be marked as shared. > > The easiest way to archive that is to use DMA API that already knows how > to deal with shared memory. > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > --- > drivers/virtio/virtio_ring.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index becc77697960..ace733845d5d 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -12,6 +12,7 @@ > #include <linux/hrtimer.h> > #include <linux/dma-mapping.h> > #include <xen/xen.h> > +#include <asm/kvm_para.h> > > #ifdef DEBUG > /* For development, we want to crash whenever the ring is screwed. */ > @@ -255,6 +256,9 @@ static bool vring_use_dma_api(struct virtio_device *vdev) > if (xen_domain()) > return true; > > + if (kvm_mem_protected()) > + return true; > + I guess it does not matter because Christophs comment, but this breaks the build for s390, because there is no kvm_mem_protected() for s390. Regards, Halil > return false; > } >
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index becc77697960..ace733845d5d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include <linux/hrtimer.h> #include <linux/dma-mapping.h> #include <xen/xen.h> +#include <asm/kvm_para.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -255,6 +256,9 @@ static bool vring_use_dma_api(struct virtio_device *vdev) if (xen_domain()) return true; + if (kvm_mem_protected()) + return true; + return false; }
VirtIO for KVM is a primary way to provide IO. All memory that used for communication with the host has to be marked as shared. The easiest way to archive that is to use DMA API that already knows how to deal with shared memory. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> --- drivers/virtio/virtio_ring.c | 4 ++++ 1 file changed, 4 insertions(+)