From ea8c64ace86647260ec4255f483e5844d62af2df Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 10 Jan 2018 16:21:13 +0100 Subject: dma-mapping: move swiotlb arch helpers to a new header phys_to_dma, dma_to_phys and dma_capable are helpers published by architecture code for use of swiotlb and xen-swiotlb only. Drivers are not supposed to use these directly, but use the DMA API instead. Move these to a new asm/dma-direct.h helper, included by a linux/dma-direct.h wrapper that provides the default linear mapping unless the architecture wants to override it. In the MIPS case the existing dma-coherent.h is reused for now as untangling it will take a bit of work. Signed-off-by: Christoph Hellwig Acked-by: Robin Murphy --- arch/unicore32/include/asm/dma-mapping.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'arch/unicore32/include') diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index ac608c2..5cb250b 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h @@ -25,24 +25,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return &swiotlb_dma_map_ops; } -static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) -{ - if (dev && dev->dma_mask) - return addr + size - 1 <= *dev->dma_mask; - - return 1; -} - -static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) -{ - return paddr; -} - -static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) -{ - return daddr; -} - static inline void dma_mark_clean(void *addr, size_t size) {} #endif /* __KERNEL__ */ -- cgit v1.1 From b49efd76248242169f28ffd20ada05064d01ed9f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 9 Jan 2018 22:11:31 +0100 Subject: dma-mapping: move dma_mark_clean to dma-direct.h And unlike the other helpers we don't require a as this helper is a special case for ia64 only, and this keeps it as simple as possible. Signed-off-by: Christoph Hellwig --- arch/unicore32/include/asm/dma-mapping.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/unicore32/include') diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index 5cb250b..f2bfec2 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h @@ -25,7 +25,5 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return &swiotlb_dma_map_ops; } -static inline void dma_mark_clean(void *addr, size_t size) {} - #endif /* __KERNEL__ */ #endif -- cgit v1.1 From 90f7816206a3cace98a19021bb867855f5753feb Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 24 Dec 2017 13:27:26 +0100 Subject: unicore32: use generic swiotlb_ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are identical to the unicore32 ops, and would also support CMA if enabled on unicore32. Signed-off-by: Christoph Hellwig Acked-by: Christian König --- arch/unicore32/include/asm/dma-mapping.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'arch/unicore32/include') diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index f2bfec2..790bc2e 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h @@ -12,18 +12,11 @@ #ifndef __UNICORE_DMA_MAPPING_H__ #define __UNICORE_DMA_MAPPING_H__ -#ifdef __KERNEL__ - -#include -#include #include -extern const struct dma_map_ops swiotlb_dma_map_ops; - static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) { - return &swiotlb_dma_map_ops; + return &swiotlb_dma_ops; } -#endif /* __KERNEL__ */ #endif -- cgit v1.1