On 11/23/2015 05:36 PM, Cornelia Huck wrote: > On Mon, 23 Nov 2015 15:41:11 +0800 > Jason Wang <jasow...@redhat.com> wrote: > >> Currently, all virtio devices bypass IOMMU completely. This is because >> address_space_memory is assumed and used during DMA emulation. This >> patch converts the virtio core API to use DMA API. This idea is >> >> - introducing a new transport specific helper to query the dma address >> space. (only pci version is implemented). >> - query and use this address space during virtio device guest memory >> accessing >> >> With this virtiodevices will not bypass IOMMU anymore. Little tested with >> intel_iommu=on with virtio guest DMA series posted in >> https://lkml.org/lkml/2015/10/28/64. >> >> TODO: >> - Feature bit for this > I'm still not convinced about that feature bit stuff. It just feels > wrong to use a mechanism that conveys negotiable device features to > configure what is basically a platform/hypervisor feature. I'd rather > see this out of the virtio layer and into the pci layer. > >> - Implement this for all transports > Is it OK to just keep a fallback to today's implementation for > transports for which the iommu concept doesn't make sense and that will > always have an identity mapping?
Yes it is. This patch keeps this fallback (e.g using address_space_memory) for the transport without an iommu implementation. > >> Signed-off-by: Jason Wang <jasow...@redhat.com> >> --- >> hw/block/virtio-blk.c | 2 +- >> hw/char/virtio-serial-bus.c | 2 +- >> hw/scsi/virtio-scsi.c | 2 +- >> hw/virtio/virtio-pci.c | 9 +++++++++ >> hw/virtio/virtio.c | 36 +++++++++++++++++++-------------- >> include/hw/virtio/virtio-access.h | 42 >> +++++++++++++++++++++++++++++---------- >> include/hw/virtio/virtio-bus.h | 1 + >> include/hw/virtio/virtio.h | 2 +- >> 8 files changed, 67 insertions(+), 29 deletions(-) > FWIW, this doesn't seem to break for the s390-ccw-virtio machine (only > snifftested). > Good to know this. Thanks for the testing.