On Mon, Jan 14, 2019 at 11:53:08AM -0700, Jason Gunthorpe wrote: > 'coherent DMA' memory is a property of the cache and when it gets > remapped to userspace the special cache properties get lost. That is not the case. There are a few ways to implement coherent memory, with the most common ones being: a) do nothing (the x86 way) - this will just work from userspace b) remap the memory with an uncached bit in the PTE. dma_mmap_coherent will ensure this bit is also set for the userspace mapping. Everything will just work c) allocate from a special pool that is set uncached by the firmware/ hardware at the physical address level. This will just work again. > > Also, if the streaming DMA mapping is used, how can the userspace > > call dma_sync_*? As far as I can tell, the userspace > > udma_*_device_barrier doesn't seem to replace it. > > It can't. platforms that require privileged functionality to do > dma_sync are not supported by RDMA. Other platforms are required to > implement their functionality via barriers. While there might be a few architectures were cache invalidation / writeback is privileged this is not the common case as far as I can tell. In general those are available to userspace code as well.