On Thu, Jul 15, 2021 at 06:49:05AM +0300, Leon Romanovsky wrote: > On Wed, Jul 14, 2021 at 09:20:31PM -0300, Jason Gunthorpe wrote: > > From: Max Gurtovoy <mgurtovoy@xxxxxxxxxx> > > > > This pairs with vfio_init_group_dev() and allows undoing any state that is > > stored in the vfio_device unrelated to registration. Add appropriately > > placed calls to all the drivers. > > > > The following patch will use this to add pre-registration state for the > > device set. > > > > Signed-off-by: Max Gurtovoy <mgurtovoy@xxxxxxxxxx> > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Documentation/driver-api/vfio.rst | 4 ++- > > drivers/vfio/fsl-mc/vfio_fsl_mc.c | 6 +++-- > > drivers/vfio/mdev/vfio_mdev.c | 13 +++++++--- > > drivers/vfio/pci/vfio_pci.c | 6 +++-- > > drivers/vfio/platform/vfio_platform_common.c | 7 +++-- > > drivers/vfio/vfio.c | 5 ++++ > > include/linux/vfio.h | 1 + > > samples/vfio-mdev/mbochs.c | 2 ++ > > samples/vfio-mdev/mdpy.c | 25 ++++++++++-------- > > samples/vfio-mdev/mtty.c | 27 ++++++++++++-------- > > 10 files changed, 64 insertions(+), 32 deletions(-) > > <...> > > > @@ -674,6 +675,7 @@ static int vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev) > > > > dprc_remove_devices(mc_dev, NULL, 0); > > vfio_fsl_uninit_device(vdev); > > + vfio_uninit_group_dev(&vdev->vdev); > > This is wrong place, the _uninit_ should be after vfio_fsl_mc_reflck_put(). Well, maybe, but it doesn't matter, the uninit doesn't effect the reflck and the next fsl patch deletes the line below. I can switch it if there is a v2 > > vfio_fsl_mc_reflck_put(vdev->reflck); Jason