Re: [PATCH 4/4] csky: Add dma_inv_range for DMA_FROM_DEVICE

From: Christoph Hellwig
Date: Tue Aug 06 2019 - 02:51:17 EST


On Tue, Jul 30, 2019 at 03:43:20PM +0200, Arnd Bergmann wrote:
> When syncing 'for_cpu', you should not need to write back, because
> there won't be any dirty cache lines.
>
> If you have a CPU core that does not do speculative loads, you also don't
> need to invalidate here, because you have already done that in the
> _for_device() case, the only reason to invalidate the CPU cache
> again is if a speculative load created a stale cache line that now
> shadows the data received from the device.

Yes. And that is one reason why I want to lift a set of common helpers
for both the speculating and non-speculating case to the common code
that just calls arch specific writeback/invalidate/writeback+invalidate
helpers. It hasn't been a priotity so far, but maybe it becomes one
now. Especially if I could draft someone else to help with it :)