Skip to content

Commit 6ff4ccc

Browse files
Steve Sistarelegoater
authored andcommitted
iommufd: preserve DMA mappings
During cpr-transfer load in new QEMU, the vfio_memory_listener causes spurious calls to map and unmap DMA regions, as devices are created and the address space is built. This memory was already already mapped by the device in old QEMU, so suppress the map and unmap callbacks during incoming CPR. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/1751493538-202042-20-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
1 parent 5c066c4 commit 6ff4ccc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

backends/iommufd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ int iommufd_backend_map_file_dma(IOMMUFDBackend *be, uint32_t ioas_id,
245245
.length = size,
246246
};
247247

248+
if (cpr_is_incoming()) {
249+
return 0;
250+
}
251+
248252
if (!readonly) {
249253
map.flags |= IOMMU_IOAS_MAP_WRITEABLE;
250254
}
@@ -274,6 +278,10 @@ int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
274278
.length = size,
275279
};
276280

281+
if (cpr_is_incoming()) {
282+
return 0;
283+
}
284+
277285
ret = ioctl(fd, IOMMU_IOAS_UNMAP, &unmap);
278286
/*
279287
* IOMMUFD takes mapping as some kind of object, unmapping

0 commit comments

Comments
 (0)