[PATCH 0/5] vfio: relax the vIOMMU check

Zhenzhong Duan posted 5 patches 2 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250910023701.244356-1-zhenzhong.duan@intel.com
Maintainers: Yi Liu <yi.l.liu@intel.com>, Eric Auger <eric.auger@redhat.com>, Zhenzhong Duan <zhenzhong.duan@intel.com>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, "Clément Mathieu--Drif" <clement.mathieu--drif@eviden.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>
hw/vfio/vfio-iommufd.h        |  1 +
include/hw/vfio/vfio-device.h | 10 ++++++
include/system/iommufd.h      |  2 +-
backends/iommufd.c            |  5 +--
hw/i386/intel_iommu.c         | 42 ++++++++++++++++++++++
hw/vfio/container-base.c      |  5 +--
hw/vfio/device.c              |  6 ++++
hw/vfio/iommufd.c             | 66 +++++++++++++++++++++++++++++------
hw/vfio/migration.c           |  6 ++--
backends/trace-events         |  2 +-
10 files changed, 123 insertions(+), 22 deletions(-)
[PATCH 0/5] vfio: relax the vIOMMU check
Posted by Zhenzhong Duan 2 weeks, 4 days ago
Hi,

This series relax the vIOMMU check and allows live migration with vIOMMU
without VFs using device dirty tracking. It's rewritten based on first 4
patches of [1] from Joao.

Currently what block us is the lack of dirty bitmap query with iommufd
before unmap. By adding that query in patch2 plus an extra optimization
in patch3 that let us simply read the dirty bit (without clearing it),
then an optimization in patch4 to handle a corner case of domain switch
in guest, finally we relax the check in patch5.

We tested VM live migration (running QAT workload in VM) with QAT
device passthrough, below matrix configs:
1.Scalable mode vIOMMU + IOMMUFD cdev mode
2.Scalable mode vIOMMU + legacy VFIO mode
3.legacy mode vIOMMU + IOMMUFD cdev mode
4.legacy mode vIOMMU + legacy VFIO mode

[1] https://github.com/jpemartins/qemu/commits/vfio-migration-viommu/

Thanks
Zhenzhong

Zhenzhong Duan (5):
  vfio/iommufd: Add framework code to support getting dirty bitmap
    before unmap
  vfio/iommufd: Query dirty bitmap before DMA unmap
  vfio/iommufd: Add IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR flag support
  intel_iommu: Optimize unmap_bitmap during migration
  vfio/migration: Allow live migration with vIOMMU without VFs using
    device dirty tracking

 hw/vfio/vfio-iommufd.h        |  1 +
 include/hw/vfio/vfio-device.h | 10 ++++++
 include/system/iommufd.h      |  2 +-
 backends/iommufd.c            |  5 +--
 hw/i386/intel_iommu.c         | 42 ++++++++++++++++++++++
 hw/vfio/container-base.c      |  5 +--
 hw/vfio/device.c              |  6 ++++
 hw/vfio/iommufd.c             | 66 +++++++++++++++++++++++++++++------
 hw/vfio/migration.c           |  6 ++--
 backends/trace-events         |  2 +-
 10 files changed, 123 insertions(+), 22 deletions(-)

-- 
2.47.1