[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190522133400.GA27229@lst.de>
Date: Wed, 22 May 2019 15:34:00 +0200
From: Christoph Hellwig <hch@....de>
To: Robin Murphy <robin.murphy@....com>
Cc: Christoph Hellwig <hch@....de>,
Horia Geantă <horia.geanta@....com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-imx@....com
Subject: Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE
On Wed, May 22, 2019 at 02:25:38PM +0100, Robin Murphy wrote:
> Sure, but that should be irrelevant since the effective problem here is in
> the sync_*_for_cpu direction, and it's the unmap which nobbles the buffer.
> If the driver does this:
>
> dma_map_single(whole buffer);
> <device writes to part of buffer>
> dma_unmap_single(whole buffer);
> <contents of rest of buffer now undefined>
>
> then it could instead do this and be happy:
>
> dma_map_single(whole buffer, SKIP_CPU_SYNC);
> <device writes to part of buffer>
> dma_sync_single_for_cpu(updated part of buffer);
> dma_unmap_single(whole buffer, SKIP_CPU_SYNC);
> <contents of rest of buffer still valid>
Assuming the driver knows how much was actually DMAed this would
solve the issue. Horia, does this work for you?
Powered by blists - more mailing lists