The following APIs are provided for translating user pfn to host pfn in a VFIO
 driver::
 
-       int vfio_pin_pages(struct vfio_device *device, unsigned long *user_pfn,
+       int vfio_pin_pages(struct vfio_device *device, dma_addr_t iova,
                                  int npage, int prot, unsigned long *phys_pfn);
 
-       void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
+       void vfio_unpin_pages(struct vfio_device *device, dma_addr_t iova,
                                    int npage);
 
 These functions call back into the back-end IOMMU module by using the pin_pages
 
 static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
                unsigned long size)
 {
-       int total_pages = DIV_ROUND_UP(size, PAGE_SIZE);
-       int npage;
-
-       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,
+                        DIV_ROUND_UP(size, PAGE_SIZE));
 }
 
 /* Pin a normal or compound guest page for dma. */
         * on stack to hold pfns.
         */
        for (npage = 0; npage < total_pages; npage++) {
-               unsigned long cur_gfn = gfn + npage;
+               dma_addr_t cur_iova = (gfn + npage) << PAGE_SHIFT;
                unsigned long pfn;
 
-               ret = vfio_pin_pages(&vgpu->vfio_device, &cur_gfn, 1,
+               ret = vfio_pin_pages(&vgpu->vfio_device, cur_iova, 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);
+                       gvt_vgpu_err("vfio_pin_pages failed for iova %pad, ret %d\n",
+                                    &cur_iova, ret);
                        goto err;
                }
 
 
                        continue;
                }
 
-               vfio_unpin_pages(vdev, first, npage);
+               vfio_unpin_pages(vdev, *first << PAGE_SHIFT, npage);
                unpinned += npage;
                npage = 1;
        }
                        continue;
                }
 
-               ret = vfio_pin_pages(vdev, first, npage,
+               ret = vfio_pin_pages(vdev, *first << PAGE_SHIFT, npage,
                                     IOMMU_READ | IOMMU_WRITE,
                                     &pa->pa_pfn[pinned]);
                if (ret < 0) {
 
                q->saved_isc = VFIO_AP_ISC_INVALID;
        }
        if (q->saved_pfn && !WARN_ON(!q->matrix_mdev)) {
-               vfio_unpin_pages(&q->matrix_mdev->vdev, &q->saved_pfn, 1);
+               vfio_unpin_pages(&q->matrix_mdev->vdev, q->saved_pfn << PAGE_SHIFT, 1);
                q->saved_pfn = 0;
        }
 }
                return status;
        }
 
-       ret = vfio_pin_pages(&q->matrix_mdev->vdev, &g_pfn, 1,
+       ret = vfio_pin_pages(&q->matrix_mdev->vdev, g_pfn << PAGE_SHIFT, 1,
                             IOMMU_READ | IOMMU_WRITE, &h_pfn);
        switch (ret) {
        case 1:
                break;
        case AP_RESPONSE_OTHERWISE_CHANGED:
                /* We could not modify IRQ setings: clear new configuration */
-               vfio_unpin_pages(&q->matrix_mdev->vdev, &g_pfn, 1);
+               vfio_unpin_pages(&q->matrix_mdev->vdev, g_pfn << PAGE_SHIFT, 1);
                kvm_s390_gisc_unregister(kvm, isc);
                break;
        default:
 {
        struct ap_matrix_mdev *matrix_mdev =
                container_of(vdev, struct ap_matrix_mdev, vdev);
-       unsigned long g_pfn = iova >> PAGE_SHIFT;
 
-       vfio_unpin_pages(&matrix_mdev->vdev, &g_pfn, 1);
+       vfio_unpin_pages(&matrix_mdev->vdev, iova, 1);
 }
 
 /**
 
 EXPORT_SYMBOL(vfio_set_irqs_validate_and_prepare);
 
 /*
- * Pin a set of guest PFNs and return their associated host PFNs for local
+ * Pin contiguous user pages and return their associated host pages for local
  * domain only.
  * @device [in]  : device
- * @user_pfn [in]: array of user/guest PFNs to be pinned.
- * @npage [in]   : count of elements in user_pfn array.  This count should not
- *                be greater VFIO_PIN_PAGES_MAX_ENTRIES.
+ * @iova [in]    : starting IOVA of user pages to be pinned.
+ * @npage [in]   : count of pages to be pinned.  This count should not
+ *                be greater than VFIO_PIN_PAGES_MAX_ENTRIES.
  * @prot [in]    : protection flags
  * @phys_pfn[out]: array of host PFNs
  * Return error or number of pages pinned.
  */
-int vfio_pin_pages(struct vfio_device *device, unsigned long *user_pfn,
+int vfio_pin_pages(struct vfio_device *device, dma_addr_t iova,
                   int npage, int prot, unsigned long *phys_pfn)
 {
        struct vfio_container *container;
        struct vfio_iommu_driver *driver;
        int ret;
 
-       if (!user_pfn || !phys_pfn || !npage ||
-           !vfio_assert_device_open(device))
+       if (!phys_pfn || !npage || !vfio_assert_device_open(device))
                return -EINVAL;
 
        if (npage > VFIO_PIN_PAGES_MAX_ENTRIES)
        driver = container->iommu_driver;
        if (likely(driver && driver->ops->pin_pages))
                ret = driver->ops->pin_pages(container->iommu_data,
-                                            group->iommu_group, user_pfn,
+                                            group->iommu_group, iova,
                                             npage, prot, phys_pfn);
        else
                ret = -ENOTTY;
 EXPORT_SYMBOL(vfio_pin_pages);
 
 /*
- * Unpin set of host PFNs for local domain only.
+ * Unpin contiguous host pages for local domain only.
  * @device [in]  : device
- * @user_pfn [in]: array of user/guest PFNs to be unpinned. Number of user/guest
- *                PFNs should not be greater than VFIO_PIN_PAGES_MAX_ENTRIES.
- * @npage [in]   : count of elements in user_pfn array.  This count should not
+ * @iova [in]    : starting address of user pages to be unpinned.
+ * @npage [in]   : count of pages to be unpinned.  This count should not
  *                 be greater than VFIO_PIN_PAGES_MAX_ENTRIES.
  */
-void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
-                     int npage)
+void vfio_unpin_pages(struct vfio_device *device, dma_addr_t iova, int npage)
 {
        struct vfio_container *container;
        struct vfio_iommu_driver *driver;
        container = device->group->container;
        driver = container->iommu_driver;
 
-       driver->ops->unpin_pages(container->iommu_data, user_pfn, npage);
+       driver->ops->unpin_pages(container->iommu_data, iova, npage);
 }
 EXPORT_SYMBOL(vfio_unpin_pages);
 
 
                                        struct iommu_group *group);
        int             (*pin_pages)(void *iommu_data,
                                     struct iommu_group *group,
-                                    unsigned long *user_pfn,
+                                    dma_addr_t user_iova,
                                     int npage, int prot,
                                     unsigned long *phys_pfn);
        void            (*unpin_pages)(void *iommu_data,
-                                      unsigned long *user_pfn, int npage);
+                                      dma_addr_t user_iova, int npage);
        void            (*register_device)(void *iommu_data,
                                           struct vfio_device *vdev);
        void            (*unregister_device)(void *iommu_data,
 
 
 static int vfio_iommu_type1_pin_pages(void *iommu_data,
                                      struct iommu_group *iommu_group,
-                                     unsigned long *user_pfn,
+                                     dma_addr_t user_iova,
                                      int npage, int prot,
                                      unsigned long *phys_pfn)
 {
        bool do_accounting;
        dma_addr_t iova;
 
-       if (!iommu || !user_pfn || !phys_pfn)
+       if (!iommu || !phys_pfn)
                return -EINVAL;
 
        /* Supported for v2 version only */
 again:
        if (iommu->vaddr_invalid_count) {
                for (i = 0; i < npage; i++) {
-                       iova = user_pfn[i] << PAGE_SHIFT;
+                       iova = user_iova + PAGE_SIZE * i;
                        ret = vfio_find_dma_valid(iommu, iova, PAGE_SIZE, &dma);
                        if (ret < 0)
                                goto pin_done;
        for (i = 0; i < npage; i++) {
                struct vfio_pfn *vpfn;
 
-               iova = user_pfn[i] << PAGE_SHIFT;
+               iova = user_iova + PAGE_SIZE * i;
                dma = vfio_find_dma(iommu, iova, PAGE_SIZE);
                if (!dma) {
                        ret = -EINVAL;
        for (j = 0; j < i; j++) {
                dma_addr_t iova;
 
-               iova = user_pfn[j] << PAGE_SHIFT;
+               iova = user_iova + PAGE_SIZE * j;
                dma = vfio_find_dma(iommu, iova, PAGE_SIZE);
                vfio_unpin_page_external(dma, iova, do_accounting);
                phys_pfn[j] = 0;
 }
 
 static void vfio_iommu_type1_unpin_pages(void *iommu_data,
-                                        unsigned long *user_pfn, int npage)
+                                        dma_addr_t user_iova, int npage)
 {
        struct vfio_iommu *iommu = iommu_data;
        bool do_accounting;
 
        do_accounting = list_empty(&iommu->domain_list);
        for (i = 0; i < npage; i++) {
+               dma_addr_t iova = user_iova + PAGE_SIZE * i;
                struct vfio_dma *dma;
-               dma_addr_t iova;
 
-               iova = user_pfn[i] << PAGE_SHIFT;
                dma = vfio_find_dma(iommu, iova, PAGE_SIZE);
                if (!dma)
                        break;
 
 
 #define VFIO_PIN_PAGES_MAX_ENTRIES     (PAGE_SIZE/sizeof(unsigned long))
 
-int vfio_pin_pages(struct vfio_device *device, unsigned long *user_pfn,
+int vfio_pin_pages(struct vfio_device *device, dma_addr_t iova,
                   int npage, int prot, unsigned long *phys_pfn);
-void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
-                     int npage);
+void vfio_unpin_pages(struct vfio_device *device, dma_addr_t iova, int npage);
 int vfio_dma_rw(struct vfio_device *device, dma_addr_t user_iova,
                void *data, size_t len, bool write);