On 1/5/2021 10:36 AM, Steve Sistare wrote: > Add interfaces that allow the underlying memory object of an iova range > to be mapped to a new virtual address in the host process: > > - VFIO_DMA_UNMAP_FLAG_SUSPEND for VFIO_IOMMU_UNMAP_DMA > - VFIO_DMA_MAP_FLAG_RESUME flag for VFIO_IOMMU_MAP_DMA > - VFIO_SUSPEND extension for VFIO_CHECK_EXTENSION > > The suspend interface blocks vfio translation of host virtual addresses in > a range, but DMA to already-mapped pages continues. The resume interface > records the new base VA and resumes translation. The implementation > supports iommu type1 and mediated devices. > > This functionality is necessary for live update, in which a host process > such as qemu exec's an updated version of itself, while preserving its > guest and vfio devices. The process suspends vfio VA translation, exec's > its new self, mmap's the memory object(s) underlying vfio object, and > resumes VA translation. For a working example that uses these new > interfaces, see the QEMU patch series "[PATCH V2] Live Update". > > Patch 1 modifies the iova rbtree to allow iteration over ranges with gaps, > without deleting each entry. This is required by patch 4. > Patch 2 adds an option to unmap all ranges, which simplifies userland code. > Patch 3 adds an interface to detect if an iommu_group has a valid container, > which patch 5 uses to release a blocked thread if a container is closed. > Patch 4 implements the new ioctl's. > Patch 5 adds blocking to complete the implementation . > > Steve Sistare (5): > vfio: maintain dma_list order > vfio: option to unmap all > vfio: detect closed container > vfio: VA suspend interface > vfio: block during VA suspend > > drivers/vfio/vfio.c | 12 ++++ > drivers/vfio/vfio_iommu_type1.c | 122 ++++++++++++++++++++++++++++++++++------ > include/linux/vfio.h | 1 + > include/uapi/linux/vfio.h | 19 ++++++- > 4 files changed, 135 insertions(+), 19 deletions(-) > Hi Alex, I can send a patch V2 for review if you weigh in on the following: * preferred interface for unmap-all (patch 2) * name of the suspend and resume flags (patch 4) * is vfio_iommu_contained() acceptable, or is a new backend interface needed? (patch 5) - Steve