aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2016-04-18 05:58:14 -0400
committerMichael S. Tsirkin <mst@redhat.com>2016-08-01 14:44:52 -0400
commit1a937693993ff10d7e80cca6ddd55f3000aa6376 (patch)
tree77df81f5acf23d1c21240a625b5a8066b350e27a /include/uapi/linux
parent37cf99e08c6fb4dcea0f9ad2b13b6daa8c76a711 (diff)
virtio: new feature to detect IOMMU device quirk
The interaction between virtio and IOMMUs is messy. On most systems with virtio, physical addresses match bus addresses, and it doesn't particularly matter which one we use to program the device. On some systems, including Xen and any system with a physical device that speaks virtio behind a physical IOMMU, we must program the IOMMU for virtio DMA to work at all. On other systems, including SPARC and PPC64, virtio-pci devices are enumerated as though they are behind an IOMMU, but the virtio host ignores the IOMMU, so we must either pretend that the IOMMU isn't there or somehow map everything as the identity. Add a feature bit to detect that quirk: VIRTIO_F_IOMMU_PLATFORM. Any device with this feature bit set to 0 needs a quirk and has to be passed physical addresses (as opposed to bus addresses) even though the device is behind an IOMMU. Note: it has to be a per-device quirk because for example, there could be a mix of passed-through and virtual virtio devices. As another example, some devices could be implemented by an out of process hypervisor backend (in case of qemu vhost, or vhost-user) and so support for an IOMMU needs to be coded up separately. It would be cleanest to handle this in IOMMU core code, but that needs per-device DMA ops. While we are waiting for that to be implemented, use a work-around in virtio core. Note: a "noiommu" feature is a quirk - add a wrapper to make that clear. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/virtio_config.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 4cb65bbfa654..308e2096291f 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -49,7 +49,7 @@
49 * transport being used (eg. virtio_ring), the rest are per-device feature 49 * transport being used (eg. virtio_ring), the rest are per-device feature
50 * bits. */ 50 * bits. */
51#define VIRTIO_TRANSPORT_F_START 28 51#define VIRTIO_TRANSPORT_F_START 28
52#define VIRTIO_TRANSPORT_F_END 33 52#define VIRTIO_TRANSPORT_F_END 34
53 53
54#ifndef VIRTIO_CONFIG_NO_LEGACY 54#ifndef VIRTIO_CONFIG_NO_LEGACY
55/* Do we get callbacks when the ring is completely used, even if we've 55/* Do we get callbacks when the ring is completely used, even if we've
@@ -63,4 +63,12 @@
63/* v1.0 compliant. */ 63/* v1.0 compliant. */
64#define VIRTIO_F_VERSION_1 32 64#define VIRTIO_F_VERSION_1 32
65 65
66/*
67 * If clear - device has the IOMMU bypass quirk feature.
68 * If set - use platform tools to detect the IOMMU.
69 *
70 * Note the reverse polarity (compared to most other features),
71 * this is for compatibility with legacy systems.
72 */
73#define VIRTIO_F_IOMMU_PLATFORM 33
66#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ 74#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */