2018-11-01 17:01:44 +00:00
|
|
|
From 203f17906ff45705fbdaa0430dbbc71142c2640f Mon Sep 17 00:00:00 2001
|
|
|
|
From: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
Date: Sat, 8 Dec 2018 21:45:53 +0100
|
|
|
|
Subject: [PATCH 1/3] MIPS: Compile post DMA flush only when needed
|
2018-11-01 16:57:55 +00:00
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
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.
|
2018-11-01 16:57:55 +00:00
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
This will hopefully improve the performance of the not affected devices.
|
2018-11-01 16:57:55 +00:00
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
2018-11-01 16:57:55 +00:00
|
|
|
---
|
2018-11-01 17:01:44 +00:00
|
|
|
arch/mips/Kconfig | 6 +++++-
|
|
|
|
arch/mips/mm/dma-noncoherent.c | 2 ++
|
|
|
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
--- a/arch/mips/Kconfig
|
|
|
|
+++ b/arch/mips/Kconfig
|
2019-12-18 15:38:57 +00:00
|
|
|
@@ -1117,7 +1117,6 @@ config DMA_PERDEV_COHERENT
|
2018-11-01 17:01:44 +00:00
|
|
|
config DMA_NONCOHERENT
|
2018-11-01 16:57:55 +00:00
|
|
|
bool
|
2018-11-01 17:01:44 +00:00
|
|
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
|
|
|
- select ARCH_HAS_SYNC_DMA_FOR_CPU
|
2018-11-01 16:57:55 +00:00
|
|
|
select NEED_DMA_MAP_STATE
|
2018-11-01 17:01:44 +00:00
|
|
|
select DMA_NONCOHERENT_MMAP
|
|
|
|
select DMA_NONCOHERENT_CACHE_SYNC
|
2019-12-18 15:38:57 +00:00
|
|
|
@@ -1898,9 +1897,11 @@ config SYS_HAS_CPU_MIPS32_R3_5
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
config SYS_HAS_CPU_MIPS32_R5
|
|
|
|
bool
|
2018-11-01 17:01:44 +00:00
|
|
|
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
config SYS_HAS_CPU_MIPS32_R6
|
|
|
|
bool
|
2018-11-01 17:01:44 +00:00
|
|
|
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
config SYS_HAS_CPU_MIPS64_R1
|
|
|
|
bool
|
2019-12-18 15:38:57 +00:00
|
|
|
@@ -1910,6 +1911,7 @@ config SYS_HAS_CPU_MIPS64_R2
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
config SYS_HAS_CPU_MIPS64_R6
|
|
|
|
bool
|
2018-11-01 17:01:44 +00:00
|
|
|
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
|
2018-11-01 16:57:55 +00:00
|
|
|
|
|
|
|
config SYS_HAS_CPU_R3000
|
2018-11-01 17:01:44 +00:00
|
|
|
bool
|
2019-12-18 15:38:57 +00:00
|
|
|
@@ -1946,6 +1948,7 @@ config SYS_HAS_CPU_R8000
|
2018-11-01 16:57:55 +00:00
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
config SYS_HAS_CPU_R10000
|
|
|
|
bool
|
|
|
|
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
|
2018-11-01 16:57:55 +00:00
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
config SYS_HAS_CPU_RM7000
|
|
|
|
bool
|
2019-12-18 15:38:57 +00:00
|
|
|
@@ -1974,6 +1977,7 @@ config SYS_HAS_CPU_BMIPS4380
|
2018-11-01 17:01:44 +00:00
|
|
|
config SYS_HAS_CPU_BMIPS5000
|
|
|
|
bool
|
|
|
|
select SYS_HAS_CPU_BMIPS
|
|
|
|
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
|
|
|
|
|
|
|
|
config SYS_HAS_CPU_XLR
|
|
|
|
bool
|
|
|
|
--- a/arch/mips/mm/dma-noncoherent.c
|
|
|
|
+++ b/arch/mips/mm/dma-noncoherent.c
|
|
|
|
@@ -191,12 +191,14 @@ void arch_sync_dma_for_device(struct dev
|
|
|
|
dma_sync_phys(paddr, size, dir);
|
2018-11-01 16:57:55 +00:00
|
|
|
}
|
|
|
|
|
2018-11-01 17:01:44 +00:00
|
|
|
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
|
|
|
|
void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
|
|
|
|
size_t size, enum dma_data_direction dir)
|
2018-11-01 16:57:55 +00:00
|
|
|
{
|
|
|
|
if (cpu_needs_post_dma_flush(dev))
|
2018-11-01 17:01:44 +00:00
|
|
|
dma_sync_phys(paddr, size, dir);
|
2018-11-01 16:57:55 +00:00
|
|
|
}
|
|
|
|
+#endif
|
2018-11-01 17:01:44 +00:00
|
|
|
|
|
|
|
void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
|
|
|
enum dma_data_direction direction)
|