ARC: dma [IOC] Enable per device io coherency
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Mon, 30 Jul 2018 16:26:34 +0000 (19:26 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Tue, 4 Sep 2018 20:21:37 +0000 (13:21 -0700)
commit2820a708d5a321342bef34e459fdc8679c30e20f
treed5118dc16437fa15bf7361eebd70a65ceda92722
parent678c8110d23c0ac7d69fda558992c31be64e7507
ARC: dma [IOC] Enable per device io coherency

So far the IOC treatment was global on ARC, being turned on (or off)
for all devices in the system. With this patch, this can now be done
per device using the "dma-coherent" DT property; IOW with this patch
we can use both HW-coherent and regular DMA peripherals simultaneously.

The changes involved are too many so enlisting the summary below:

1. common code calls ARC arch_setup_dma_ops() per device.

2. For coherent dma (IOC) it plugs in generic @dma_direct_ops which
   doesn't need any arch specific backend: No need for any explicit
   cache flushes or MMU mappings to provide for uncached access

   - dma_(map|sync)_single* return early as corresponding dma ops callbacks
     are NULL in generic code.
     So arch_sync_dma_*() -> dma_cache_*() need not handle the coherent
     dma case, hence drop ARC __dma_cache_*_ioc() which were no-op anyways

3. For noncoherent dma (non IOC) generic @dma_noncoherent_ops is used
   which in turns calls ARC specific routines

   - arch_dma_alloc() no longer checks for @ioc_enable since this is
     called only for !IOC case.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
[vgupta: rewrote changelog]
arch/arc/include/asm/dma-mapping.h [new file with mode: 0644]
arch/arc/mm/cache.c
arch/arc/mm/dma.c