Use the existing vfio_device versions of vfio_(un)pin_pages(). There is no reason to use a group interface here, kvmgt has easy access to a vfio_device. Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index bb59d21cf898ab..df7d87409e3a9c 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -268,6 +268,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, { struct drm_i915_private *i915 = vgpu->gvt->gt->i915; struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); + struct vfio_device *vfio_dev = mdev_legacy_get_vfio_device(vdev->mdev); int total_pages; int npage; int ret; @@ -277,7 +278,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, for (npage = 0; npage < total_pages; npage++) { unsigned long cur_gfn = gfn + npage; - ret = vfio_group_unpin_pages(vdev->vfio_group, &cur_gfn, 1); + ret = vfio_unpin_pages(vfio_dev, &cur_gfn, 1); drm_WARN_ON(&i915->drm, ret != 1); } } @@ -287,6 +288,7 @@ static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, unsigned long size, struct page **page) { struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); + struct vfio_device *vfio_dev = mdev_legacy_get_vfio_device(vdev->mdev); unsigned long base_pfn = 0; int total_pages; int npage; @@ -301,8 +303,8 @@ static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, unsigned long cur_gfn = gfn + npage; unsigned long pfn; - ret = vfio_group_pin_pages(vdev->vfio_group, &cur_gfn, 1, - IOMMU_READ | IOMMU_WRITE, &pfn); + ret = vfio_pin_pages(vfio_dev, &cur_gfn, 1, + IOMMU_READ | IOMMU_WRITE, &pfn); if (ret != 1) { gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx, ret %d\n", cur_gfn, ret); -- 2.35.1