On Wed, Jul 06, 2022 at 02:49:23PM -0300, Jason Gunthorpe wrote: > On Tue, Jul 05, 2022 at 11:27:54PM -0700, Nicolin Chen wrote: > > > These functions call back into the back-end IOMMU module by using the pin_pages > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c > > index 8c67c9aba82d..ea6041fa48ac 100644 > > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c > > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c > > @@ -231,16 +231,8 @@ static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt) > > static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, > > unsigned long size) > > { > > - int total_pages; > > - int npage; > > - > > - total_pages = roundup(size, PAGE_SIZE) / PAGE_SIZE; > > - > > - for (npage = 0; npage < total_pages; npage++) { > > - unsigned long cur_gfn = gfn + npage; > > - > > - vfio_unpin_pages(&vgpu->vfio_device, &cur_gfn, 1); > > - } > > + vfio_unpin_pages(&vgpu->vfio_device, gfn << PAGE_SHIFT, > > + roundup(size, PAGE_SIZE) / PAGE_SIZE); > > These maths are DIV_ROUND_UP() Will change in v3. > Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Thanks!