[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRNpHcskc0Vv1ofa@infradead.org>
Date: Wed, 11 Aug 2021 07:07:25 +0100
From: Christoph Hellwig <hch@...radead.org>
To: David Stevens <stevensd@...omium.org>
Cc: Robin Murphy <robin.murphy@....com>, Will Deacon <will@...nel.org>,
linux-kernel@...r.kernel.org, Tom Murphy <murphyt7@....ie>,
iommu@...ts.linux-foundation.org
Subject: Re: [PATCH v3 3/5] dma-iommu: add SKIP_CPU_SYNC after syncing
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 4f0cc4a0a61f..be0214b1455c 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -859,8 +859,11 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
> static void iommu_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> size_t size, enum dma_data_direction dir, unsigned long attrs)
> {
> - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> + if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
> iommu_dma_sync_single_for_cpu(dev, dma_handle, size, dir);
> + attrs |= DMA_ATTR_SKIP_CPU_SYNC;
> + }
> +
> __iommu_dma_unmap_swiotlb(dev, dma_handle, size, dir, attrs);
I don't think this is the correct way to go. Instead just call the
raw cache sync helper instead of iommu_dma_sync_single_for_cpu, similar
to what dma-direct does. Same for the map side.
Powered by blists - more mailing lists