vfio iommu type1: Add task structure to vfio_dma
authorKirti Wankhede <kwankhede@nvidia.com>
Wed, 16 Nov 2016 20:46:21 +0000 (02:16 +0530)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 17 Nov 2016 15:25:09 +0000 (08:25 -0700)
commit8f0d5bb95f763cacad7654304050ec1b636bb04a
treebec8ce0bfe39b99177adb540b0084bfd83c887fd
parent7896c998f0e7160df97bd7aaae9807120535bf14
vfio iommu type1: Add task structure to vfio_dma

Add task structure to vfio_dma structure. Task structure is used for:
- During DMA_UNMAP, same task who mapped it or other task who shares same
address space is allowed to unmap, otherwise unmap fails.
QEMU maps few iova ranges initially, then fork threads and from the child
thread calls DMA_UNMAP on previously mapped iova. Since child shares same
address space, DMA_UNMAP is successful.
- Avoid accessing struct mm while process is exiting by acquiring
reference of task's mm during page accounting.
- It is also used to get task mlock capability and rlimit for mlock.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Neo Jia <cjia@nvidia.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c