On Tue, 8 Nov 2022 14:37:21 +0100 Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > [ Upstream commit f423fa1bc9fe1978e6b9f54927411b62cb43eb04 ] > > When converting to directly create the vfio_device the mdev driver has to > put a vfio_register_emulated_iommu_dev() in the probe() and a pairing > vfio_unregister_group_dev() in the remove. > > This was missed for gvt, add it. > > Cc: stable@xxxxxxxxxxxxxxx > Fixes: 978cf586ac35 ("drm/i915/gvt: convert to use vfio_register_emulated_iommu_dev") > Reported-by: Alex Williamson <alex.williamson@xxxxxxxxxx> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Link: https://lore.kernel.org/r/0-v1-013609965fe8+9d-vfio_gvt_unregister_jgg@xxxxxxxxxx > Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx> > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> > --- > drivers/gpu/drm/i915/gvt/kvmgt.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c > index e3cd58946477..dacd57732dbe 100644 > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c > @@ -1595,6 +1595,7 @@ static void intel_vgpu_remove(struct mdev_device *mdev) > > if (WARN_ON_ONCE(vgpu->attached)) > return; > + vfio_unregister_group_dev(&vgpu->vfio_device); > intel_gvt_destroy_vgpu(vgpu); > } > Nak, the v6.0 backport for this also needs to call vfio_uninit_group_dev(). kvmgt had missed both calls, but at the time of f423fa1bc9fe this latter missing call had already been replaced by vfio_put_device() in a5ddd2a99a7a, where cb9ff3f3b84c had implemented a device release function with this call. The correct backport should be: diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index e3cd58946477..2404d856f764 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -1595,6 +1595,8 @@ static void intel_vgpu_remove(struct mdev_device *mdev) if (WARN_ON_ONCE(vgpu->attached)) return; + vfio_unregister_group_dev(&vgpu->vfio_device); + vfio_uninit_group_dev(&vgpu->vfio_device); intel_gvt_destroy_vgpu(vgpu); } Kevin, Yi, please confirm. Thanks, Alex