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

Commit 153234f9 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu/dma: Fix cache maintenance in iommu_dma_map_sg()"

parents d6613611 5d5e0ccd
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -959,6 +959,7 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
	struct iommu_dma_cookie *cookie;
	struct iova_domain *iovad;
	int prot = dma_info_to_prot(dir, is_dma_coherent(dev, attrs), attrs);
	int ret;
	dma_addr_t iova;
	size_t iova_len;

@@ -968,9 +969,6 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
	cookie = domain->iova_cookie;
	iovad = &cookie->iovad;

	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
		iommu_dma_sync_sg_for_device(dev, sg, nents, dir);

	iova_len = iommu_dma_prepare_map_sg(dev, iovad, sg, nents);

	iova = iommu_dma_alloc_iova(domain, iova_len, dma_get_mask(dev), dev);
@@ -984,7 +982,12 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
	if (iommu_map_sg(domain, iova, sg, nents, prot) < iova_len)
		goto out_free_iova;

	return iommu_dma_finalise_sg(dev, sg, nents, iova);
	ret = iommu_dma_finalise_sg(dev, sg, nents, iova);

	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
		iommu_dma_sync_sg_for_device(dev, sg, nents, dir);

	return ret;

out_free_iova:
	iommu_dma_free_iova(cookie, iova, iova_len);