MIPS: improve checks for noncoherent DMA
PATCH v2 1/2 MIPS: improve checks for noncoherent DMA
Only one MIPS development board actually supports enabling/disabling DMA coherency at runtime, so it's not a good idea to push the overhead of checking that configuration setting onto every other supported target as well.
--- arch/mips/Kconfig | 6 +++++- arch/mips/include/asm/dma-coherence.h | 9 +++++++++ arch/mips/include/asm/mach-generic/dma-coherence.h | 4 ---- arch/mips/mm/dma-default.c | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-)
arch/mips/Kconfig +5 -1
@@ -302,7 +302,7 @@ config MIPS_MALTA select CEVT_R4K select CSRC_R4K select CSRC_GIC - select DMA_NONCOHERENT + select DMA_MAYBE_COHERENT select GENERIC_ISA_DMA select HAVE_PCSPKR_PLATFORM select IRQ_CPU
@@ -894,6 +894,10 @@ config FW_CFE config ARCH_DMA_ADDR_T_64BIT def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT +config DMA_MAYBE_COHERENT + select DMA_NONCOHERENT + bool + config DMA_COHERENT bool
arch/mips/include/asm/dma-coherence.h +9 -0
@@ -9,7 +9,16 @@#ifndef __ASM_DMA_COHERENCE_H#define __ASM_DMA_COHERENCE_H +#ifdef CONFIG_DMA_MAYBE_COHERENT extern int coherentio;extern int hw_coherentio; +#else +#ifdef CONFIG_DMA_COHERENT +#define coherentio 1 +#else +#define coherentio 0 +#endif +#define hw_coherentio 0 +#endif /* CONFIG_DMA_MAYBE_COHERENT */ #endif
arch/mips/include/asm/mach-generic/dma-coherence.h +0 -4
@@ -49,11 +49,7 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)static inline int plat_device_is_coherent (struct device *dev) { -#ifdef CONFIG_DMA_COHERENT -return 1 ; -#else return coherentio; -#endif }#ifdef CONFIG_SWIOTLB
arch/mips/mm/dma-default.c +2 -0
@@ -23,6 +23,7 @@#include <dma-coherence.h> +#ifdef CONFIG_DMA_MAYBE_COHERENT int coherentio =0 ;/* User defined DMA coherency from command line. */ EXPORT_SYMBOL_GPL (coherentio);int hw_coherentio =0 ;/* Actual hardware supported DMA coherency setting. */
@@ -42,6 +43,7 @@ static int __init setnocoherentio(char *str) return 0; }early_param ("nocoherentio" , setnocoherentio); +#endif static inline struct page *dma_addr_to_page (struct device *dev,dma_addr_t dma_addr)
Signature · 1 line
1.8.0.2
PATCH v2 2/2 MIPS: partially inline dma ops
Several DMA ops are no-op on many platforms, and the indirection through the mips_dma_map_ops function table is causing the compiler to emit unnecessary code.
Inlining visibly improves network performance in my tests (on a 24Kc based system), and also slightly reduces code size of a few drivers.
coherentio is changed from EXPORT_SYMBOL_GPL to EXPORT_SYMBOL, because it is now potentially being accessed by any driver using the DMA mapping API.
--- arch/mips/Kconfig | 4 + arch/mips/include/asm/dma-mapping.h | 362 +++++++++++++++++++++++++++++++++++- arch/mips/mm/dma-default.c | 163 ++-------------- 3 files changed, 375 insertions(+), 154 deletions(-)
arch/mips/Kconfig +4 -0
@@ -1376,6 +1376,7 @@ config CPU_CAVIUM_OCTEON select LIBFDT select USE_OF select USB_EHCI_BIG_ENDIAN_MMIO + select SYS_HAS_DMA_OPS help The Cavium Octeon processor is a highly integrated chip containing many ethernet hardware widgets for networking tasks. The processor
@@ -1598,6 +1599,9 @@ config SYS_HAS_CPU_XLR config SYS_HAS_CPU_XLP bool +config SYS_HAS_DMA_OPS + bool + # # CPU may reorder R->R, R->W, W->R, W->W # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC
arch/mips/include/asm/dma-mapping.h +357 -5
411 lines not on this page · raw message
arch/mips/mm/dma-default.c +14 -149
218 lines not on this page · raw message
Signature · 1 line
1.8.0.2