Hi Kirti, On 2020/11/2 5:01, Alex Williamson wrote: > From: Kirti Wankhede <kwankh...@nvidia.com> > > With vIOMMU, IO virtual address range can get unmapped while in pre-copy > phase of migration. In that case, unmap ioctl should return pages pinned > in that range and QEMU should find its correcponding guest physical > addresses and report those dirty. > > Suggested-by: Alex Williamson <alex.william...@redhat.com> > Signed-off-by: Kirti Wankhede <kwankh...@nvidia.com> > Reviewed-by: Neo Jia <c...@nvidia.com> > [aw: fix error_report types, fix cpu_physical_memory_set_dirty_lebitmap() > cast] > Signed-off-by: Alex Williamson <alex.william...@redhat.com> > --- > hw/vfio/common.c | 97 > ++++++++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 93 insertions(+), 4 deletions(-) > [...]
> + > + unmap->argsz = sizeof(*unmap) + sizeof(*bitmap); > + unmap->iova = iova; > + unmap->size = size; > + unmap->flags |= VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP; > + bitmap = (struct vfio_bitmap *)&unmap->data; > + > + /* > + * cpu_physical_memory_set_dirty_lebitmap() expects pages in bitmap of > + * TARGET_PAGE_SIZE to mark those dirty. Hence set bitmap_pgsize to > + * TARGET_PAGE_SIZE. > + */ Here maybe not OK. cpu_physical_memory_set_dirty_lebitmap expects the granule of bitmap is qemu_real_host_page_size. It uses hpratio to covert this bitmap to QEMU dirty bitmap. Thanks, Keqian