arm64: dma-mapping: conditional skip map_sg by attrs
authorShawn Lin <shawn.lin@rock-chips.com>
Wed, 8 Jul 2015 09:32:06 +0000 (17:32 +0800)
committerShawn Lin <shawn.lin@rock-chips.com>
Fri, 10 Jul 2015 04:53:16 +0000 (12:53 +0800)
Add if statement(DMA_ATTR_SKIP_CPU_SYNC) for __swiotlb_map_sg_attrs
to skip invalidating each sg element

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
arch/arm64/mm/dma-mapping.c

index aff368c35d62eb6b7181fe75e04d8ebe48d2319b..dc573621e41db6535c6acf09f01d053a74f99a82 100644 (file)
@@ -224,10 +224,11 @@ static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
        int i, ret;
 
        ret = swiotlb_map_sg_attrs(dev, sgl, nelems, dir, attrs);
-       for_each_sg(sgl, sg, ret, i)
-               __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
-                              sg->length, dir);
-
+       if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) {
+               for_each_sg(sgl, sg, ret, i)
+                       __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
+                                       sg->length, dir);
+       }
        return ret;
 }