[PATCH 4/4] gfp3

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 13 01:52:11 UTC 2021


---
 drivers/iommu/dma-iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 95617bc2fe34..947264c76a0a 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -975,6 +975,7 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 	dma_addr_t iova;
 	size_t iova_len = 0;
 	unsigned long mask = dma_get_seg_boundary(dev);
+	gfp_t gfp;
 	int i;
 
 	if (unlikely(iommu_dma_deferred_attach(dev, domain)))
@@ -1031,11 +1032,15 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 		goto out_restore_sg;
 	}
 
+	gfp = GFP_ATOMIC;
+	if (attrs & DMA_ATTR_NO_WARN)
+		gfp = GFP_KERNEL | __GFP_NOWARN;
+
 	/*
 	 * We'll leave any physical concatenation to the IOMMU driver's
 	 * implementation - it knows better than we do.
 	 */
-	if (iommu_map_sg(domain, iova, sg, nents, prot, GFP_ATOMIC) < iova_len) {
+	if (iommu_map_sg(domain, iova, sg, nents, prot, gfp) < iova_len) {
 		pr_err("map_sg_atomic failed\n");
 		goto out_free_iova;
 	}
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list