diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2020-04-28 22:12:20 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2020-05-18 18:53:29 +0300 |
commit | 11c4cd07ba111a09f49625f9e4c851d83daf0a22 (patch) | |
tree | 868e577bfeb69468dc98507c19110f2ee3f3ee7d /drivers/vfio/pci/vfio_pci_private.h | |
parent | 41311242221e3482b20bfed10fa4d9db98d87016 (diff) | |
download | linux-11c4cd07ba111a09f49625f9e4c851d83daf0a22.tar.xz |
vfio-pci: Fault mmaps to enable vma tracking
Rather than calling remap_pfn_range() when a region is mmap'd, setup
a vm_ops handler to support dynamic faulting of the range on access.
This allows us to manage a list of vmas actively mapping the area that
we can later use to invalidate those mappings. The open callback
invalidates the vma range so that all tracking is inserted in the
fault handler and removed in the close handler.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci/vfio_pci_private.h')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_private.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h index 36ec69081ecd..9b25f9f6ce1d 100644 --- a/drivers/vfio/pci/vfio_pci_private.h +++ b/drivers/vfio/pci/vfio_pci_private.h @@ -92,6 +92,11 @@ struct vfio_pci_vf_token { int users; }; +struct vfio_pci_mmap_vma { + struct vm_area_struct *vma; + struct list_head vma_next; +}; + struct vfio_pci_device { struct pci_dev *pdev; void __iomem *barmap[PCI_STD_NUM_BARS]; @@ -132,6 +137,8 @@ struct vfio_pci_device { struct list_head ioeventfds_list; struct vfio_pci_vf_token *vf_token; struct notifier_block nb; + struct mutex vma_lock; + struct list_head vma_list; }; #define is_intx(vdev) (vdev->irq_type == VFIO_PCI_INTX_IRQ_INDEX) |