Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Lutomirski and committed by
Michael S. Tsirkin
78fe3987 7a5589b2

+12
+12
drivers/virtio/virtio_ring.c
··· 25 25 #include <linux/hrtimer.h> 26 26 #include <linux/kmemleak.h> 27 27 #include <linux/dma-mapping.h> 28 + #include <xen/xen.h> 28 29 29 30 #ifdef DEBUG 30 31 /* For development, we want to crash whenever the ring is screwed. */ ··· 137 136 138 137 static bool vring_use_dma_api(struct virtio_device *vdev) 139 138 { 139 + /* 140 + * In theory, it's possible to have a buggy QEMU-supposed 141 + * emulated Q35 IOMMU and Xen enabled at the same time. On 142 + * such a configuration, virtio has never worked and will 143 + * not work without an even larger kludge. Instead, enable 144 + * the DMA API if we're a Xen guest, which at least allows 145 + * all of the sensible Xen configurations to work correctly. 146 + */ 147 + if (xen_domain()) 148 + return true; 149 + 140 150 return false; 141 151 } 142 152