summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2016-02-02 21:46:40 -0800
committerAlistair Strachan <astrachan@google.com>2019-01-16 12:43:27 -0800
commit7389e826abae820e1149cfb8a39f2a877bb2a478 (patch)
treec7bcbe936bb74d6c15693adf48827e6e837a79ae
parent6bb68f96a00a13a71c3fa8c77aa0609a6b31dc2e (diff)
UPSTREAM: vring: Use the DMA API on Xen
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) Bug: 121166534 Test: Ran cuttlefish with android-4.4 + VSOCKETS, VMWARE_VMCI_VSOCKETS Signed-off-by: Alistair Strachan <astrachan@google.com> Change-Id: Ibf85aad139f319354cd2ee8833ca9434c15640d8
-rw-r--r--drivers/virtio/virtio_ring.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 7e74a5386ef3..9a31cb74b4cd 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -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. */
@@ -131,6 +132,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;
}