Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE
From: Robin Murphy
Date: Wed May 22 2019 - 08:53:31 EST
On 22/05/2019 13:32, Christoph Hellwig wrote:
I'm a little worried about this. While it looks functionally correct
we have surived without it, and doing another copy for every swiotlb
dma mapping from the device looks extremely painful for the typical use
cases where we expect the device to transfer the whole mapping.
I'd be tempted to instead properl document the current behavior and
introduce a new DMA_ATTR_PARTIAL flag to allow for partial mappings.
Would that work out any different from the existing
DMA_ATTR_SKIP_CPU_SYNC? If drivers are prepared to handle this issue
from their end, they can already do so for single mappings by using that
attr along with explicit partial syncs via dma_sync_single(). For
page/sg mappings we'd still have the problem of identifying what part of
"partial" actually matters, and probably having to add some additional
new sync operations to cope.
Robin.