diff options
| author | Alex Williamson <alex.williamson@redhat.com> | 2024-05-30 07:52:30 +0300 |
|---|---|---|
| committer | Alex Williamson <alex.williamson@redhat.com> | 2024-06-01 00:15:51 +0300 |
| commit | b7c5e64fecfa88764791679cca4786ac65de739e (patch) | |
| tree | 8332954eb89cadc14d233624988b33ef34c987ae /drivers/vfio/device_cdev.c | |
| parent | 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 (diff) | |
| download | linux-b7c5e64fecfa88764791679cca4786ac65de739e.tar.xz | |
vfio: Create vfio_fs_type with inode per device
By linking all the device fds we provide to userspace to an
address space through a new pseudo fs, we can use tools like
unmap_mapping_range() to zap all vmas associated with a device.
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240530045236.1005864-2-alex.williamson@redhat.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/device_cdev.c')
| -rw-r--r-- | drivers/vfio/device_cdev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c index e75da0a70d1f..bb1817bd4ff3 100644 --- a/drivers/vfio/device_cdev.c +++ b/drivers/vfio/device_cdev.c @@ -39,6 +39,13 @@ int vfio_device_fops_cdev_open(struct inode *inode, struct file *filep) filep->private_data = df; + /* + * Use the pseudo fs inode on the device to link all mmaps + * to the same address space, allowing us to unmap all vmas + * associated to this device using unmap_mapping_range(). + */ + filep->f_mapping = device->inode->i_mapping; + return 0; err_put_registration: |
