]> git.karo-electronics.de Git - linux-beck.git/commit
MIPS: Support per-device DMA coherence
authorPaul Burton <paul.burton@imgtec.com>
Wed, 5 Oct 2016 17:18:16 +0000 (18:18 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 6 Oct 2016 16:02:01 +0000 (18:02 +0200)
commit20d330645cfb8cfecfb82b369e4d3084e429e68a
treec2e0661dbbb76ad83b2645db4291954bbd19c69d
parentcfa93fb9c2eae805f2c16d72bad04ca49b6e16d2
MIPS: Support per-device DMA coherence

On some MIPS systems, a subset of devices may have DMA coherent with CPU
caches. For example in systems including a MIPS I/O Coherence Unit
(IOCU), some devices may be connected to that IOCU whilst others are
not.

Prior to this patch, we have a plat_device_is_coherent() function but no
implementation which does anything besides return a global true or
false, optionally chosen at runtime. For devices such as those described
above this is insufficient.

Fix this by tracking DMA coherence on a per-device basis with a
dma_coherent field in struct dev_archdata. Setting this from
arch_setup_dma_ops() takes care of devices which set the dma-coherent
property via device tree, and any PCI devices beneath a bridge described
in DT, automatically.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14349/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/include/asm/device.h
arch/mips/include/asm/dma-coherence.h
arch/mips/include/asm/dma-mapping.h
arch/mips/include/asm/mach-generic/dma-coherence.h
arch/mips/mm/c-r4k.c
arch/mips/mm/dma-default.c