linux/arch
Vladimir Murzin 1c51c429f3 ARM: NOMMU: Introduce dma operations for noMMU
R/M classes of cpus can have memory covered by MPU which in turn might
configure RAM as Normal i.e. bufferable and cacheable. It breaks
dma_alloc_coherent() and friends, since data can stuck in caches now
or be buffered.

This patch factors out DMA support for NOMMU configuration into
separate entity which provides dedicated dma_ops. We have to handle
there several cases:
- configurations with MMU/MPU setup
- configurations without MMU/MPU setup
- special case for M-class, since caches and MPU there are optional

In general we rely on default DMA area for coherent allocations or/and
per-device memory reserves suitable for coherent DMA, so if such
regions are set coherent allocations go from there.

In case MMU/MPU was not setup we fallback to normal page allocator for
DMA memory allocation.

In case we run M-class cpus, for configuration without cache support
(like Cortex-M3/M4) dma operations are forced to be coherent and wired
with dma-noop (such decision is made based on cacheid global
variable); however, if caches are detected there and no DMA coherent
region is given (either default or per-device), dma is disallowed even
MPU is not set - it is because M-class implement system memory map
which defines part of address space as Normal memory.

Reported-by: Alexandre Torgue <alexandre.torgue@st.com>
Reported-by: Andras Szemzo <sza@esh.hu>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Tested-by: Andras Szemzo <sza@esh.hu>
Tested-by: Alexandre TORGUE <alexandre.torgue@st.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
[hch: removed the dma_supported() implementation that isn't required anymore]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2017-06-30 10:03:09 -07:00
..
alpha osf_wait4(): fix infoleak 2017-05-21 13:10:07 -04:00
arc mm: larger stack guard gap, between vmas 2017-06-19 21:50:20 +08:00
arm ARM: NOMMU: Introduce dma operations for noMMU 2017-06-30 10:03:09 -07:00
arm64 arm64: remove DMA_ERROR_CODE 2017-06-20 11:13:08 +02:00
blackfin drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
c6x c6x: remove DMA_ERROR_CODE 2017-06-20 11:13:01 +02:00
cris devicetree: Move include prefixes from arch to separate directory 2017-05-18 23:55:48 -07:00
frv mm: larger stack guard gap, between vmas 2017-06-19 21:50:20 +08:00
h8300 uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
hexagon hexagon: remove the unused dma_is_consistent prototype 2017-06-28 06:54:43 -07:00
ia64 ia64: remove DMA_ERROR_CODE 2017-06-20 11:13:02 +02:00
m32r drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
m68k drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
metag devicetree: Move include prefixes from arch to separate directory 2017-05-18 23:55:48 -07:00
microblaze drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
mips mips/loongson64: implement ->dma_supported instead of ->set_dma_mask 2017-06-28 06:54:48 -07:00
mn10300 uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
nios2 nios2 update for v4.12-rc1 2017-05-12 09:53:16 -07:00
openrisc openrisc: remove arch-specific dma_supported implementation 2017-06-28 06:54:44 -07:00
parisc mm: larger stack guard gap, between vmas 2017-06-19 21:50:20 +08:00
powerpc powerpc: merge __dma_set_mask into dma_set_mask 2017-06-28 06:54:55 -07:00
s390 s390: implement ->mapping_error 2017-06-28 06:54:31 -07:00
score uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
sh drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
sparc sparc: remove arch specific dma_supported implementations 2017-06-28 06:54:39 -07:00
tile tile: remove dma_supported and mapping_error methods 2017-06-28 06:54:51 -07:00
um Merge branch 'for-linus-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2017-05-13 10:20:02 -07:00
unicore32 Kbuild UAPI header export updates for v4.12 2017-05-10 20:45:36 -07:00
x86 x86: remove arch specific dma_supported implementation 2017-06-28 06:54:46 -07:00
xtensa drivers: dma-mapping: allow dma_common_mmap() for NOMMU 2017-06-30 10:03:07 -07:00
.gitignore
Kconfig Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-10 10:30:46 -07:00