goto unpin;
                        }
 
-                       err = dma_map_sg(dev, sgt->sgl, sgt->nents, dir);
-                       if (!err) {
-                               err = -ENOMEM;
+                       err = dma_map_sgtable(dev, sgt, dir, 0);
+                       if (err)
                                goto unpin;
-                       }
 
                        job->unpins[job->num_unpins].dev = dev;
                        job->unpins[job->num_unpins].dir = dir;
                }
 
                if (host->domain) {
-                       for_each_sg(sgt->sgl, sg, sgt->nents, j)
+                       for_each_sgtable_sg(sgt, sg, j)
                                gather_size += sg->length;
                        gather_size = iova_align(&host->iova, gather_size);
 
                                goto put;
                        }
 
-                       err = iommu_map_sg(host->domain,
+                       err = iommu_map_sgtable(host->domain,
                                        iova_dma_addr(&host->iova, alloc),
-                                       sgt->sgl, sgt->nents, IOMMU_READ);
+                                       sgt, IOMMU_READ);
                        if (err == 0) {
                                __free_iova(&host->iova, alloc);
                                err = -EINVAL;
                        job->unpins[job->num_unpins].size = gather_size;
                        phys_addr = iova_dma_addr(&host->iova, alloc);
                } else if (sgt) {
-                       err = dma_map_sg(host->dev, sgt->sgl, sgt->nents,
-                                        DMA_TO_DEVICE);
-                       if (!err) {
-                               err = -ENOMEM;
+                       err = dma_map_sgtable(host->dev, sgt, DMA_TO_DEVICE, 0);
+                       if (err)
                                goto put;
-                       }
 
                        job->unpins[job->num_unpins].dir = DMA_TO_DEVICE;
                        job->unpins[job->num_unpins].dev = host->dev;
                }
 
                if (unpin->dev && sgt)
-                       dma_unmap_sg(unpin->dev, sgt->sgl, sgt->nents,
-                                    unpin->dir);
+                       dma_unmap_sgtable(unpin->dev, sgt, unpin->dir, 0);
 
                host1x_bo_unpin(dev, unpin->bo, sgt);
                host1x_bo_put(unpin->bo);