]> 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)
commitb7f095dc58ffee645b7113924b4ad6c79a2ba968
tree6b36cb7c2a2122173916266051206370600b44ab
parentbe3fc8bf76117ac8bf00cda01689fae859e4fcd7
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