提交 07c75d7a 编写于 作者: V Vladimir Murzin 提交者: Christoph Hellwig

drivers: dma-mapping: allow dma_common_mmap() for NOMMU

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>
上级 93228b44
...@@ -41,6 +41,7 @@ config BLACKFIN ...@@ -41,6 +41,7 @@ config BLACKFIN
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select HAVE_DEBUG_STACKOVERFLOW select HAVE_DEBUG_STACKOVERFLOW
select HAVE_NMI select HAVE_NMI
select ARCH_NO_COHERENT_DMA_MMAP
config GENERIC_CSUM config GENERIC_CSUM
def_bool y def_bool y
......
...@@ -19,6 +19,7 @@ config M32R ...@@ -19,6 +19,7 @@ config M32R
select HAVE_DEBUG_STACKOVERFLOW select HAVE_DEBUG_STACKOVERFLOW
select CPU_NO_EFFICIENT_FFS select CPU_NO_EFFICIENT_FFS
select DMA_NOOP_OPS select DMA_NOOP_OPS
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
config SBUS config SBUS
bool bool
......
...@@ -2,6 +2,7 @@ config M68K ...@@ -2,6 +2,7 @@ config M68K
bool bool
default y default y
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
select HAVE_IDE select HAVE_IDE
select HAVE_AOUT if MMU select HAVE_AOUT if MMU
select HAVE_DEBUG_BUGVERBOSE select HAVE_DEBUG_BUGVERBOSE
......
...@@ -2,6 +2,7 @@ config MICROBLAZE ...@@ -2,6 +2,7 @@ config MICROBLAZE
def_bool y def_bool y
select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT select BUILDTIME_EXTABLE_SORT
select CLKSRC_OF select CLKSRC_OF
......
...@@ -2,6 +2,7 @@ config SUPERH ...@@ -2,6 +2,7 @@ config SUPERH
def_bool y def_bool y
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
select HAVE_PATA_PLATFORM select HAVE_PATA_PLATFORM
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select HAVE_IDE if HAS_IOPORT_MAP select HAVE_IDE if HAS_IOPORT_MAP
......
...@@ -3,6 +3,7 @@ config ZONE_DMA ...@@ -3,6 +3,7 @@ config ZONE_DMA
config XTENSA config XTENSA
def_bool y def_bool y
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT select BUILDTIME_EXTABLE_SORT
......
...@@ -227,7 +227,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, ...@@ -227,7 +227,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size) void *cpu_addr, dma_addr_t dma_addr, size_t size)
{ {
int ret = -ENXIO; int ret = -ENXIO;
#if defined(CONFIG_MMU) && !defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP) #ifndef CONFIG_ARCH_NO_COHERENT_DMA_MMAP
unsigned long user_count = vma_pages(vma); unsigned long user_count = vma_pages(vma);
unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr)); unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));
...@@ -244,7 +244,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, ...@@ -244,7 +244,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
user_count << PAGE_SHIFT, user_count << PAGE_SHIFT,
vma->vm_page_prot); vma->vm_page_prot);
} }
#endif /* CONFIG_MMU && !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */ #endif /* !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册