MIPS: remove unnecessary platform dma helper functions
PATCH v2 1/3 MIPS: remove unnecessary platform dma helper functions
The semantics stay the same - on Cavium Octeon the functions were dead code (it overrides the MIPS DMA ops) - on other platforms they contained no code at all.
--- arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h | 12 ------------ arch/mips/include/asm/mach-generic/dma-coherence.h | 10 ---------- arch/mips/include/asm/mach-ip27/dma-coherence.h | 10 ---------- arch/mips/include/asm/mach-ip32/dma-coherence.h | 11 ----------- arch/mips/include/asm/mach-jazz/dma-coherence.h | 10 ---------- arch/mips/include/asm/mach-loongson/dma-coherence.h | 10 ---------- arch/mips/include/asm/mach-powertv/dma-coherence.h | 10 ---------- arch/mips/mm/dma-default.c | 4 +--- 8 files changed, 1 insertion(+), 76 deletions(-)
arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h +0 -12
@@ -52,23 +52,11 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 0 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -BUG (); -} -static inline int plat_device_is_coherent (struct device *dev) {return 1 ; } -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -BUG (); -return 0 ; -} -dma_addr_t phys_to_dma (struct device *dev,phys_addr_t paddr);phys_addr_t dma_to_phys (struct device *dev,dma_addr_t daddr);
arch/mips/include/asm/mach-generic/dma-coherence.h +0 -10
@@ -47,16 +47,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {#ifdef CONFIG_DMA_COHERENT
arch/mips/include/asm/mach-ip27/dma-coherence.h +0 -10
@@ -58,16 +58,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {return 1 ;/* IP27 non-cohernet mode is unsupported */
arch/mips/include/asm/mach-ip32/dma-coherence.h +0 -11
@@ -80,17 +80,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -return ; -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {return 0 ;/* IP32 is non-cohernet */
arch/mips/include/asm/mach-jazz/dma-coherence.h +0 -10
@@ -48,16 +48,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {return 0 ;
arch/mips/include/asm/mach-loongson/dma-coherence.h +0 -10
@@ -53,16 +53,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {return 0 ;
arch/mips/include/asm/mach-powertv/dma-coherence.h +0 -10
@@ -99,16 +99,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)return 1 ; } -static inline void plat_extra_sync_for_device (struct device *dev) -{ -} - -static inline int plat_dma_mapping_error (struct device *dev, -dma_addr_t dma_addr) -{ -return 0 ; -} -static inline int plat_device_is_coherent (struct device *dev) {return 0 ;
arch/mips/mm/dma-default.c +1 -3
@@ -292,7 +292,6 @@ static void mips_dma_sync_single_for_cpu(struct device *dev,static void mips_dma_sync_single_for_device (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction) { -plat_extra_sync_for_device (dev);if (!plat_device_is_coherent (dev))__dma_sync (dma_addr_to_page (dev, dma_handle), dma_handle & ~PAGE_MASK , size, direction);
@@ -326,7 +325,7 @@ static void mips_dma_sync_sg_for_device(struct device *dev,int mips_dma_mapping_error (struct device *dev,dma_addr_t dma_addr) { -return plat_dma_mapping_error (dev, dma_addr); +return 0 ; }int mips_dma_supported (struct device *dev,u64 mask)
@@ -339,7 +338,6 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, {BUG_ON (direction ==DMA_NONE ); -plat_extra_sync_for_device (dev);if (!plat_device_is_coherent (dev))__dma_sync_virtual (vaddr, size, direction); }
Signature · 1 line
1.8.0.2
PATCH v2 2/3 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 | 7 +++++++ arch/mips/include/asm/mach-generic/dma-coherence.h | 4 ---- arch/mips/mm/dma-default.c | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-)
arch/mips/Kconfig +5 -1
@@ -300,7 +300,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
@@ -915,6 +915,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 +7 -0
@@ -9,7 +9,14 @@#ifndef __ASM_DMA_COHERENCE_H#define __ASM_DMA_COHERENCE_H +#ifdef CONFIG_DMA_MAYBE_COHERENT extern int coherentio;extern int hw_coherentio; +#elif defined(CONFIG_DMA_COHERENT ) +#define coherentio 1 +#else +#define coherentio 0 +#endif +#define hw_coherentio 0#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
@@ -22,6 +22,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. */
@@ -41,6 +42,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 3/3 MIPS: partially inline dma ops
In reply to Felix FietkauSeveral 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 | 360 +++++++++++++++++++++++++++++++++++- arch/mips/mm/dma-default.c | 163 ++-------------- 3 files changed, 373 insertions(+), 154 deletions(-)
arch/mips/Kconfig +4 -0
@@ -1397,6 +1397,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
@@ -1617,6 +1618,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 +355 -5
406 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