[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 24/27] vhost: iommu changes
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 24/27] vhost: iommu changes |
Date: |
Fri, 20 Nov 2020 19:51:02 +0100 |
Since vhost is now asking for qemu's VA, iommu needs to be bypassed.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index eebfac4455..cb44b9997f 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1109,6 +1109,10 @@ static int vhost_sw_live_migration_start(struct
vhost_dev *dev)
assert(dev->vhost_ops->vhost_set_vring_enable);
dev->vhost_ops->vhost_set_vring_enable(dev, false);
+ if (vhost_dev_has_iommu(dev)) {
+ r = vhost_backend_invalidate_device_iotlb(dev, 0, -1ULL);
+ assert(r == 0);
+ }
for (idx = 0; idx < dev->nvqs; ++idx) {
struct vhost_virtqueue *vq = &dev->vqs[idx];
@@ -1269,6 +1273,19 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev,
uint64_t iova, int write)
trace_vhost_iotlb_miss(dev, 1);
+ if (dev->sw_lm_enabled) {
+ uaddr = iova;
+ len = 4096;
+ ret = vhost_backend_update_device_iotlb(dev, iova, uaddr, len,
+ IOMMU_RW);
+ if (ret) {
+ trace_vhost_iotlb_miss(dev, 2);
+ error_report("Fail to update device iotlb");
+ }
+
+ return ret;
+ }
+
iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
iova, write,
MEMTXATTRS_UNSPECIFIED);
--
2.18.4
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, (continued)
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, Eugenio Pérez, 2020/11/20
- [RFC PATCH 17/27] vhost: add vhost_vring_set_notification_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 19/27] vhost: add vhost_vring_get_buf_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 20/27] vhost: Return used buffers, Eugenio Pérez, 2020/11/20
- [RFC PATCH 21/27] vhost: Add vhost_virtqueue_memory_unmap, Eugenio Pérez, 2020/11/20
- [RFC PATCH 22/27] vhost: Add vhost_virtqueue_memory_map, Eugenio Pérez, 2020/11/20
- [RFC PATCH 23/27] vhost: unmap qemu's shadow virtqueues on sw live migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 24/27] vhost: iommu changes,
Eugenio Pérez <=
- [RFC PATCH 25/27] vhost: Do not commit vhost used idx on vhost_virtqueue_stop, Eugenio Pérez, 2020/11/20
- [RFC PATCH 26/27] vhost: Add vhost_hdev_can_sw_lm, Eugenio Pérez, 2020/11/20
- [RFC PATCH 27/27] vhost: forbid vhost devices logging, Eugenio Pérez, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Eugenio Perez Martin, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, no-reply, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Jason Wang, 2020/11/25