1. 01 7月, 2017 2 次提交
    • V
      ARM: NOMMU: Introduce dma operations for noMMU · 1c51c429
      Vladimir Murzin 提交于
      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: NAlexandre Torgue <alexandre.torgue@st.com>
      Reported-by: NAndras Szemzo <sza@esh.hu>
      Tested-by: NBenjamin Gaignard <benjamin.gaignard@linaro.org>
      Tested-by: NAndras Szemzo <sza@esh.hu>
      Tested-by: NAlexandre TORGUE <alexandre.torgue@st.com>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NVladimir Murzin <vladimir.murzin@arm.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NRussell King <rmk+kernel@armlinux.org.uk>
      [hch: removed the dma_supported() implementation that isn't required anymore]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      1c51c429
    • V
      drivers: dma-mapping: allow dma_common_mmap() for NOMMU · 07c75d7a
      Vladimir Murzin 提交于
      Currently, internals of dma_common_mmap() is compiled out if build is
      done for either NOMMU or target which explicitly says it does not
      have/want coherent DMA mmap. It turned out that dma_common_mmap() can
      be handy in NOMMU setup (at least for ARM).
      
      This patch converts exitent NOMMU targets to use ARCH_NO_COHERENT_DMA_MMAP,
      thus when CONFIG_MMU is gone from dma_common_mmap() their behaviour stays
      unchanged.
      
      ARM is not converted to ARCH_NO_COHERENT_DMA_MMAP because it 1)
      already has mmap callback which can handle (at some extent) NOMMU 2)
      already defines dummy pgprot_noncached() for NOMMU build.
      
      c6x and frv stay untouched since they already have ARCH_NO_COHERENT_DMA_MMAP.
      
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NVladimir Murzin <vladimir.murzin@arm.com>
      Tested-by: NBenjamin Gaignard <benjamin.gaignard@linaro.org>
      07c75d7a
  2. 28 6月, 2017 36 次提交
  3. 20 6月, 2017 2 次提交