Commit 9ae1f262 authored by Paul Burton's avatar Paul Burton

MIPS: Don't select ARCH_HAS_SYNC_DMA_FOR_CPU when DMA is coherent

Commit f263f2a2 ("MIPS: Compile post DMA flush only when needed")
pushed the selection of ARCH_HAS_SYNC_DMA_FOR_CPU down to various
SYS_HAS_CPU_* Kconfig entries corresponding to CPUs for which
cpu_needs_post_dma_flush() might return true, but unfortunately missed
the fact that some of these CPUs can be used in configurations with
DMA_NONCOHERENT=n. When this is the case the kernel build does not
include our definition of arch_sync_dma_for_cpu() from
arch/mips/mm/dma-noncoherent.c and the build fails with a link error.

One example of this problem is ip27_defconfig:

  kernel/dma/direct.o: In function `dma_direct_sync_single_for_cpu':
  direct.c:(.text+0x6c): undefined reference to `arch_sync_dma_for_cpu'
  kernel/dma/direct.o: In function `dma_direct_sync_sg_for_cpu':
  direct.c:(.text+0x1f0): undefined reference to `arch_sync_dma_for_cpu'
  kernel/dma/direct.o: In function `dma_direct_alloc':
  direct.c:(.text+0xc20): undefined reference to `arch_dma_alloc'
  kernel/dma/direct.o: In function `dma_direct_free':
  direct.c:(.text+0xc3c): undefined reference to `arch_dma_free'
  make[1]: *** [Makefile:1021: vmlinux] Error 1
  make: *** [Makefile:152: sub-make] Error 2

Fix this by selecting ARCH_HAS_SYNC_DMA_FOR_CPU only when
DMA_NONCOHERENT is also selected. The SYS_HAS_CPU_BMIPS5000 case is left
as-is because systems with that CPU always select DMA_NONCOHERENT
anyway.
Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
Fixes: f263f2a2 ("MIPS: Compile post DMA flush only when needed")
parent afd375dc
......@@ -1931,11 +1931,11 @@ config SYS_HAS_CPU_MIPS32_R3_5
config SYS_HAS_CPU_MIPS32_R5
bool
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_MIPS32_R6
bool
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_MIPS64_R1
bool
......@@ -1945,7 +1945,7 @@ config SYS_HAS_CPU_MIPS64_R2
config SYS_HAS_CPU_MIPS64_R6
bool
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_R3000
bool
......@@ -1982,7 +1982,7 @@ config SYS_HAS_CPU_R8000
config SYS_HAS_CPU_R10000
bool
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_RM7000
bool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment