On Thu, Mar 04, 2021 at 02:37:57PM -0700, Alex Williamson wrote: > Therefore unless a bus driver opts-out by replacing vm_private_data, we > can identify participating vmas by the vm_ops and have flags indicating > if the vma maps device memory such that vfio_get_device_from_vma() > should produce a device reference. The vfio IOMMU backends would also > consume this, ie. if they get a valid vfio_device from the vma, use the > pfn_base field directly. vfio_vm_ops would wrap the bus driver > callbacks and provide reference counting on open/close to release this > object. > I'm not thrilled with a vfio_device_ops callback plumbed through > vfio-core to do vma-to-pfn translation, so I thought this might be a > better alternative. Thanks, Maybe you could explain why, because I'm looking at this idea and thinking it looks very complicated compared to a simple driver op callback? The implementation of such an op for vfio_pci is one line trivial, why do we need allocated memory and a entire shim layer instead? Shim layers are bad. We still need a driver op of some kind because only the driver can convert a pg_off into a PFN. Remember the big point here is to remove the sketchy follow_pte()... Jason