lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API
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@nvidia.com>

Thanks!

\
 
 \ /
  Last update: 2022-07-06 20:00    [W:3.170 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site