]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
vring: Use the DMA API on Xen
authorAndy Lutomirski <luto@kernel.org>
Wed, 3 Feb 2016 05:46:40 +0000 (21:46 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 23 Oct 2017 04:33:07 +0000 (21:33 -0700)
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
(cherry picked from commit 78fe39872378b0bef00a91181f1947acb8a08500)
Orabug: 26388044
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/virtio/virtio_ring.c

index bbe6cd98a50f63414b0c72fe57a117025c63550d..aed4f51f026bbe0951e11db0d31ac9440b2a0436 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/hrtimer.h>
 #include <linux/kmemleak.h>
 #include <linux/dma-mapping.h>
+#include <xen/xen.h>
 
 #ifdef DEBUG
 /* For development, we want to crash whenever the ring is screwed. */
@@ -130,6 +131,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;
 }