> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c > index 6328c3a05bcd..bee3cf3226e9 100644 > --- a/drivers/vfio/pci/vfio_pci_core.c > +++ b/drivers/vfio/pci/vfio_pci_core.c > @@ -1753,8 +1753,15 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma > * we need to request the region and the barmap tracks that. > */ > if (!vdev->barmap[index]) { > - ret = pci_request_selected_regions(pdev, > + > + if (core_vdev->iommufd_device && > + iommufd_device_need_exclusive_range(core_vdev->iommufd_device)) > + ret = pci_request_selected_regions_exclusive(pdev, > + 1 << index, "vfio-pci"); > + else > + ret = pci_request_selected_regions(pdev, > 1 << index, "vfio-pci"); > + > if (ret) > return ret; I did't get the idea. The purpose of my original patch [1] is not to make VFIO choose between pci_request_regions_exclusive() or pci_request_regions(). It is mainly to prevent userspace mmap/read/write against a vfio_cdev FD. For example: If pci_request_selected_regions() is succesfully executed on mmap(), later TSM Bind would fail on its pci_request_regions_exclusive(). It means userspace should not mmap otherwise you can't do private assignment. Vice versa, if you've done TSM Bind, you cannot mmap anymore. The _exclusive is just a bonus that further prevents "/dev/mem and the sysfs MMIO access" [1]: https://lore.kernel.org/all/20250529053513.1592088-20-yilun.xu@xxxxxxxxxxxxxxx/ Thanks, Yilun