From: Andy Lutomirski Date: Wed, 3 Feb 2016 05:46:40 +0000 (-0800) Subject: vring: Use the DMA API on Xen X-Git-Tag: next-20160307~14^2~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=78fe39872378b0bef00a91181f1947acb8a08500;p=karo-tx-linux.git vring: Use the DMA API on Xen Signed-off-by: Andy Lutomirski Signed-off-by: Michael S. Tsirkin Reviewed-by: David Vrabel Reviewed-by: Wei Liu --- diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index e46d08107a50..5c802d47892c 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -136,6 +137,17 @@ struct vring_virtqueue { static bool vring_use_dma_api(struct virtio_device *vdev) { + /* + * In theory, it's possible to have a buggy QEMU-supposed + * emulated Q35 IOMMU and Xen enabled at the same time. On + * such a configuration, virtio has never worked and will + * not work without an even larger kludge. Instead, enable + * the DMA API if we're a Xen guest, which at least allows + * all of the sensible Xen configurations to work correctly. + */ + if (xen_domain()) + return true; + return false; }