Re: [PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops
From: Christoph Hellwig <hch@lst.de>
Date: 2018-01-26 07:56:20
From: Christoph Hellwig <hch@lst.de>
Date: 2018-01-26 07:56:20
On Thu, Jan 25, 2018 at 04:44:36PM +0800, Huacai Chen wrote:
Yes, kmalloc()'d memory with the appropriate GFP_DMA flags can be
You should never use GFP_DMA in kmalloc calls in new code.
synced using the dma_map_*() and dma_unmap_*() functions. So, loongson_dma_map_page()/loongson_dma_unmap_page() (which is the backend of dma_map_*() and dma_unmap_*()) should call dma_cache_sync() for non-coherent devices, right?
No, it should call the internal dma sync for device/cpu calls, as already explained by James. Note that for 4.17 or 4.18 I plan to extent the dma-direct work to not dma coherent systems, so we'll get an explicit and document ABI for those across platforms. That is if I can pull it off as it doesn't seem entirely trivial.