]> git.baikalelectronics.ru Git - kernel.git/commit
vfio iommu: Implementation of ioctl for dirty pages tracking
authorKirti Wankhede <kwankhede@nvidia.com>
Thu, 28 May 2020 20:30:51 +0000 (02:00 +0530)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 28 May 2020 21:53:25 +0000 (15:53 -0600)
commit38db707cbb63161252f281b9f3fe344a2803915c
tree6b36cb7c2a2122173916266051206370600b44ab
parenta4cf711139a702dfa49edf33fc1a72696cea4cbb
vfio iommu: Implementation of ioctl for dirty pages tracking

VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations:
- Start dirty pages tracking while migration is active
- Stop dirty pages tracking.
- Get dirty pages bitmap. Its user space application's responsibility to
  copy content of dirty pages from source to destination during migration.

To prevent DoS attack, memory for bitmap is allocated per vfio_dma
structure. Bitmap size is calculated considering smallest supported page
size. Bitmap is allocated for all vfio_dmas when dirty logging is enabled

Bitmap is populated for already pinned pages when bitmap is allocated for
a vfio_dma with the smallest supported page size. Update bitmap from
pinning functions when tracking is enabled. When user application queries
bitmap, check if requested page size is same as page size used to
populated bitmap. If it is equal, copy bitmap, but if not equal, return
error.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Neo Jia <cjia@nvidia.com>
Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
Fixed error reported by build bot by changing pgsize type from uint64_t
to size_t.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c