[PATCH 1/4] iova

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 13 13:26:15 UTC 2021


---
 drivers/iommu/dma-iommu.c | 8 ++++++--
 drivers/iommu/iommu.c     | 5 ++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 4078358ed66e..31cd260bc581 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1025,15 +1025,19 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 	}
 
 	iova = iommu_dma_alloc_iova(domain, iova_len, dma_get_mask(dev), dev);
-	if (!iova)
+	if (!iova) {
+		pr_err("alloc_iova failed\n");
 		goto out_restore_sg;
+	}
 
 	/*
 	 * We'll leave any physical concatenation to the IOMMU driver's
 	 * implementation - it knows better than we do.
 	 */
-	if (iommu_map_sg_atomic(domain, iova, sg, nents, prot) < iova_len)
+	if (iommu_map_sg_atomic(domain, iova, sg, nents, prot) < iova_len) {
+		pr_err("map_sg_atomic failed\n");
 		goto out_free_iova;
+	}
 
 	return __finalise_sg(dev, sg, nents, iova);
 
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ffeebda8d6de..8fb030cf35c9 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2418,8 +2418,11 @@ static int __iommu_map(struct iommu_domain *domain, unsigned long iova,
 			 iova, &paddr, pgsize);
 		ret = ops->map(domain, iova, paddr, pgsize, prot, gfp);
 
-		if (ret)
+		if (ret) {
+			pr_err("mapping: iova 0x%lx pa %pa pgsize 0x%zx, ret %d\n",
+			       iova, &paddr, pgsize, ret);
 			break;
+		}
 
 		iova += pgsize;
 		paddr += pgsize;
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list