Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4940f9a4 authored by Patrick Daly's avatar Patrick Daly
Browse files

arm64: dma-mapping: Fix cache maintenance issue



Ensure that sg_dma_address() is called after iommu_dma_map_sg() so that it
gets a valid dma address. __iommu_sync_sg_for_device uses this to determine
whether cache maintenance is required for a buffer.

Change-Id: I2f770d2560e35bc53470ccca7f0cd78c7a2ee0a1
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 952512e3
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -979,12 +979,17 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
				unsigned long attrs)
{
	bool coherent = is_dma_coherent(dev, attrs);
	int ret;

	ret =  iommu_dma_map_sg(dev, sgl, nelems,
				dma_info_to_prot(dir, coherent, attrs));
	if (!ret)
		return ret;

	if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
		__iommu_sync_sg_for_device(dev, sgl, nelems, dir);

	return iommu_dma_map_sg(dev, sgl, nelems,
				dma_info_to_prot(dir, coherent, attrs));
	return ret;
}

static void __iommu_unmap_sg_attrs(struct device *dev,