Skip to content

Commit f263f2a

Browse files
haukepaulburton
authored andcommitted
MIPS: Compile post DMA flush only when needed
dma_sync_phys() is only called for some CPUs when a mapping is removed. Add ARCH_HAS_SYNC_DMA_FOR_CPU only for the CPUs listed in cpu_needs_post_dma_flush() which need this extra call and do not compile this code in for other CPUs. We need this for R10000, R12000, BMIPS5000 CPUs and CPUs supporting MAAR which was introduced in MIPS32r5. This will hopefully improve the performance of the not affected devices. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: ralf@linux-mips.org Cc: jhogan@kernel.org Cc: linux-mips@vger.kernel.org Cc: nbd@nbd.name
1 parent 1c7fc5c commit f263f2a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/mips/Kconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,6 @@ config DMA_NONCOHERENT
11241124
bool
11251125
select ARCH_HAS_DMA_MMAP_PGPROT
11261126
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
1127-
select ARCH_HAS_SYNC_DMA_FOR_CPU
11281127
select NEED_DMA_MAP_STATE
11291128
select ARCH_HAS_DMA_COHERENT_TO_PFN
11301129
select DMA_NONCOHERENT_CACHE_SYNC
@@ -1928,9 +1927,11 @@ config SYS_HAS_CPU_MIPS32_R3_5
19281927

19291928
config SYS_HAS_CPU_MIPS32_R5
19301929
bool
1930+
select ARCH_HAS_SYNC_DMA_FOR_CPU
19311931

19321932
config SYS_HAS_CPU_MIPS32_R6
19331933
bool
1934+
select ARCH_HAS_SYNC_DMA_FOR_CPU
19341935

19351936
config SYS_HAS_CPU_MIPS64_R1
19361937
bool
@@ -1940,6 +1941,7 @@ config SYS_HAS_CPU_MIPS64_R2
19401941

19411942
config SYS_HAS_CPU_MIPS64_R6
19421943
bool
1944+
select ARCH_HAS_SYNC_DMA_FOR_CPU
19431945

19441946
config SYS_HAS_CPU_R3000
19451947
bool
@@ -1976,6 +1978,7 @@ config SYS_HAS_CPU_R8000
19761978

19771979
config SYS_HAS_CPU_R10000
19781980
bool
1981+
select ARCH_HAS_SYNC_DMA_FOR_CPU
19791982

19801983
config SYS_HAS_CPU_RM7000
19811984
bool
@@ -2004,6 +2007,7 @@ config SYS_HAS_CPU_BMIPS4380
20042007
config SYS_HAS_CPU_BMIPS5000
20052008
bool
20062009
select SYS_HAS_CPU_BMIPS
2010+
select ARCH_HAS_SYNC_DMA_FOR_CPU
20072011

20082012
config SYS_HAS_CPU_XLR
20092013
bool

arch/mips/mm/dma-noncoherent.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,14 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
145145
dma_sync_phys(paddr, size, dir);
146146
}
147147

148+
#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
148149
void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
149150
size_t size, enum dma_data_direction dir)
150151
{
151152
if (cpu_needs_post_dma_flush(dev))
152153
dma_sync_phys(paddr, size, dir);
153154
}
155+
#endif
154156

155157
void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
156158
enum dma_data_direction direction)

0 commit comments

Comments
 (0)