> From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Sent: Monday, December 19, 2022 4:47 PM > > +static bool vfio_device_enforced_coherent(struct vfio_device *device) > +{ > + bool ret; > + > + if (!vfio_device_try_get_registration(device)) > + return true; > + > + ret = device_iommu_capable(device->dev, > + > IOMMU_CAP_ENFORCE_CACHE_COHERENCY); > + > + vfio_device_put_registration(device); > + return ret; > +} This probably needs an explanation that recounting is required because this might be called before vfio_device_open() is called to hold the count. > +static void vfio_device_file_set_kvm(struct file *file, struct kvm *kvm) > +{ > + struct vfio_device_file *df = file->private_data; > + struct vfio_device *device = df->device; > + > + /* > + * The kvm is first recorded in the df, and will be propagated > + * to vfio_device::kvm when the file binds iommufd successfully in > + * the vfio device cdev path. > + */ /* * The kvm is first recorded in vfio_device_file and later propagated * to vfio_device::kvm when the file is successfully bound to iommufd * in the cdev path */