Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1381629
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH RFC] fixup! virtio: convert to use DMA api |
| Date | 2016-04-18 13:50 +0200 |
| Message-ID | <rpfQK-4Ut-23@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
This adds a flag to enable/disable bypassing the IOMMU by
virtio devices.
This is on top of patch
http://article.gmane.org/gmane.comp.emulators.qemu/403467
virtio: convert to use DMA api
Tested with patchset
http://article.gmane.org/gmane.linux.kernel.virtualization/27545
virtio-pci: iommu support
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio-access.h | 3 ++-
include/hw/virtio/virtio.h | 6 +++++-
include/standard-headers/linux/virtio_config.h | 8 ++++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
index 967cc75..bb6f34e 100644
--- a/include/hw/virtio/virtio-access.h
+++ b/include/hw/virtio/virtio-access.h
@@ -23,7 +23,8 @@ static inline AddressSpace *virtio_get_dma_as(VirtIODevice *vdev)
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
- if (k->get_dma_as) {
+ if ((vdev->host_features & (0x1ULL << VIRTIO_F_IOMMU_PLATFORM)) &&
+ k->get_dma_as) {
return k->get_dma_as(qbus->parent);
}
return &address_space_memory;
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index b12faa9..34d3041 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -228,7 +228,11 @@ typedef struct VirtIORNGConf VirtIORNGConf;
DEFINE_PROP_BIT64("notify_on_empty", _state, _field, \
VIRTIO_F_NOTIFY_ON_EMPTY, true), \
DEFINE_PROP_BIT64("any_layout", _state, _field, \
- VIRTIO_F_ANY_LAYOUT, true)
+ VIRTIO_F_ANY_LAYOUT, true), \
+ DEFINE_PROP_BIT64("iommu_passthrough", _state, _field, \
+ VIRTIO_F_IOMMU_PASSTHROUGH, false), \
+ DEFINE_PROP_BIT64("iommu_platform", _state, _field, \
+ VIRTIO_F_IOMMU_PLATFORM, false)
hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n);
hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n);
diff --git a/include/standard-headers/linux/virtio_config.h b/include/standard-headers/linux/virtio_config.h
index bcc445b..5564dab 100644
--- a/include/standard-headers/linux/virtio_config.h
+++ b/include/standard-headers/linux/virtio_config.h
@@ -61,4 +61,12 @@
/* v1.0 compliant. */
#define VIRTIO_F_VERSION_1 32
+/* Request IOMMU passthrough (if available)
+ * Without VIRTIO_F_IOMMU_PLATFORM: bypass the IOMMU even if enabled.
+ * With VIRTIO_F_IOMMU_PLATFORM: suggest disabling IOMMU.
+ */
+#define VIRTIO_F_IOMMU_PASSTHROUGH 33
+
+/* Do not bypass the IOMMU (if configured) */
+#define VIRTIO_F_IOMMU_PLATFORM 34
#endif /* _LINUX_VIRTIO_CONFIG_H */
--
MST
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-18 13:50 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-18 14:00 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-18 15:20 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-18 16:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-18 16:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-18 17:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-18 17:40 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-18 18:00 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-18 18:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-18 20:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-18 21:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 12:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 18:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 18:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 18:20 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 18:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api David Woodhouse <dwmw2@infradead.org> - 2016-04-19 19:40 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 20:00 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 20:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 22:20 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 22:30 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 23:00 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 23:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-20 15:20 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-20 17:50 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 11:20 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Alex Williamson <alex.williamson@redhat.com> - 2016-04-19 16:50 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api Andy Lutomirski <luto@amacapital.net> - 2016-04-19 18:10 +0200
Re: [PATCH RFC] fixup! virtio: convert to use DMA api "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-19 18:10 +0200
csiph-web