Skip to content

VIRTIO-IOMMU/VFIO: Revert IOMMUDevice clear and fix hotunplug

Eric Auger qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6Revert "virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged"hw/virtio/virtio-iommu.c+0 -211 reply
2/6virtio-iommu: Remove probe_donehw/virtio/virtio-iommu.c include/hw/virtio/virtio-iommu.h+0 -41 reply
3/6virtio-iommu: Free [host_]resv_ranges on unset_iommu_deviceshw/virtio/virtio-iommu.c+28 -344 replies
4/6virtio-iommu: Remove the end point on detachhw/virtio/virtio-iommu.c+1 -01 reply
5/6hw/vfio/common: Add vfio_listener_region_del_iommu trace eventhw/vfio/common.c hw/vfio/trace-events+4 -21 reply
6/6virtio-iommu: Add trace point on virtio_iommu_detach_endpoint_from_domainhw/virtio/trace-events hw/virtio/virtio-iommu.c+2 -01 reply

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchCédric Le GoaterZhenzhong Duan
SeriesT-b
1/6R-b
2/6R-b
3/6R-b R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] VIRTIO-IOMMU/VFIO: Revert IOMMUDevice clear and fix hotunplug

1b889d6e39c3 ("virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged" fixes the VFIO hotplug/hotunplug/hotplug sequence by clearing the IOMMUDevice which backs the VFIO device. However this brings other troubles such as a memory corruption.

Even when fixing some cleanups that were missed on the first attempt the memory corruption still exists if the IOMMUDevice is freed. Until we understand the exact cause let's make things simpler:
let the backing IOMMUDevice survive the unplug as what is done on intel iommu for instance. Clean up/reset resources that would prevent the device from being hotplugged again (probe_done is removed, [host_]resv_regions are reset). By doing this we also rule out the use case of aliased BDFs which is known to be not functional with virtio-iommu (missing guest kernel support) and the virtio-iommu device implementation is not ready either.

This series can be found at:
https://github.com/eauger/qemu/tree/virtio_iommu_device_clear_fixes_v1

Eric Auger (6):
Revert "virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged"
virtio-iommu: Remove probe_done
virtio-iommu: Free [host_]resv_ranges on unset_iommu_devices
virtio-iommu: Remove the end point on detach hw/vfio/common: Add vfio_listener_region_del_iommu trace event
virtio-iommu: Add trace point on
virtio_iommu_detach_endpoint_from_domain

 include/hw/virtio/virtio-iommu.h |  1 -
 hw/vfio/common.c                 |  3 +-
 hw/virtio/virtio-iommu.c         | 88 +++++++++++---------------------
 hw/vfio/trace-events             |  3 +-
 hw/virtio/trace-events           |  1 +
 5 files changed, 35 insertions(+), 61 deletions(-)
Signature · 1 line
2.41.0