> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Friday, April 15, 2022 2:46 AM > > kvm and VFIO need to be coupled together however neither is willing to > tolerate a direct module dependency. Instead when kvm is given a VFIO FD > it uses many symbol_get()'s to access VFIO. > > Provide a single VFIO function vfio_file_get_ops() which validates the > given struct file * is a VFIO file and then returns a struct of ops. VFIO has multiple files (container, group, and device). Here and other places seems to assume a VFIO file is just a group file. While it is correct in this external facing context, probably calling it 'VFIO group file' is clearer in various code comments and patch descriptions. > > Following patches will redo each of the symbol_get() calls into an > indirection through this ops struct. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> Out of curiosity, how do you envision when iommufd is introduced? Will we need a generic ops abstraction so both vfio and iommufd register their own ops to keep kvm side generic or a new protocol will be introduced between iommufd and kvm?