Re: [RFT][PATCH v1 3/6] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API
From: Nicolin Chen
Date: Fri Jun 17 2022 - 17:58:09 EST
On Fri, Jun 17, 2022 at 01:42:42AM -0700, Christoph Hellwig wrote:
> On Thu, Jun 16, 2022 at 04:52:09PM -0700, Nicolin Chen wrote:
> > + ret = vfio_unpin_pages(&vgpu->vfio_device, gfn << PAGE_SHIFT, npage);
> > + drm_WARN_ON(&i915->drm, ret != npage);
>
> The shifting of gfn seems to happen bother here and in the callers.
>
> Also this is the only caller that does anything withthe vfio_unpin_pages
> return value. Given that you touch the API here we might as well
> not return any value, and turn the debug checks that can return errors
> into WARN_ON_ONCE calls the vfio/iommu_type1 code.
Thanks for the suggestion. I will do that.
> > +extern int vfio_pin_pages(struct vfio_device *device, dma_addr_t iova,
> > int npage, int prot, unsigned long *phys_pfn);
> > -extern int vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
> > +extern int vfio_unpin_pages(struct vfio_device *device, dma_addr_t iova,
> > int npage);
>
> This will clash with the extern removal patch that Alex has sent.
And I will rebase on top of Alex's change.