vfio-pci: Fault mmaps to enable vma tracking
authorAlex Williamson <alex.williamson@redhat.com>
Tue, 28 Apr 2020 19:12:20 +0000 (13:12 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 18 May 2020 15:53:29 +0000 (09:53 -0600)
commit11c4cd07ba111a09f49625f9e4c851d83daf0a22
tree868e577bfeb69468dc98507c19110f2ee3f3ee7d
parent41311242221e3482b20bfed10fa4d9db98d87016
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>
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_private.h