aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 14:32:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 14:32:27 -0500
commit2382dc9a3eca644147be83dd2cd0dd64dc9e3e8c (patch)
tree71a152721a9b9b11875bf5ea053edb72c9b3a94e /arch/mips/include
parent28bc6fb9596fe1e577d09fc17ee6e1bb051c6ba3 (diff)
parent04f56534786c885f578c24461bcd782fe9a787cf (diff)
Merge tag 'dma-mapping-4.16' of git://git.infradead.org/users/hch/dma-mapping
Pull dma mapping updates from Christoph Hellwig: "Except for a runtime warning fix from Christian this is all about consolidation of the generic no-IOMMU code, a well as the glue code for swiotlb. All the code is based on the x86 implementation with hooks to allow all architectures that aren't cache coherent to use it. The x86 conversion itself has been deferred because the x86 maintainers were a little busy in the last months" * tag 'dma-mapping-4.16' of git://git.infradead.org/users/hch/dma-mapping: (57 commits) MAINTAINERS: add the iommu list for swiotlb and xen-swiotlb arm64: use swiotlb_alloc and swiotlb_free arm64: replace ZONE_DMA with ZONE_DMA32 mips: use swiotlb_{alloc,free} mips/netlogic: remove swiotlb support tile: use generic swiotlb_ops tile: replace ZONE_DMA with ZONE_DMA32 unicore32: use generic swiotlb_ops ia64: remove an ifdef around the content of pci-dma.c ia64: clean up swiotlb support ia64: use generic swiotlb_ops ia64: replace ZONE_DMA with ZONE_DMA32 swiotlb: remove various exports swiotlb: refactor coherent buffer allocation swiotlb: refactor coherent buffer freeing swiotlb: wire up ->dma_supported in swiotlb_dma_ops swiotlb: add common swiotlb_map_ops swiotlb: rename swiotlb_free to swiotlb_exit x86: rename swiotlb_dma_ops powerpc: rename swiotlb_dma_ops ...
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/dma-direct.h1
-rw-r--r--arch/mips/include/asm/dma-mapping.h10
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h8
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h12
-rw-r--r--arch/mips/include/asm/mach-loongson64/dma-coherence.h8
-rw-r--r--arch/mips/include/asm/netlogic/common.h3
6 files changed, 17 insertions, 25 deletions
diff --git a/arch/mips/include/asm/dma-direct.h b/arch/mips/include/asm/dma-direct.h
new file mode 100644
index 000000000000..f32f15530aba
--- /dev/null
+++ b/arch/mips/include/asm/dma-direct.h
@@ -0,0 +1 @@
#include <asm/dma-coherence.h>
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index 0d9418d264f9..886e75a383f2 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -17,16 +17,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
17 return mips_dma_map_ops; 17 return mips_dma_map_ops;
18} 18}
19 19
20static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
21{
22 if (!dev->dma_mask)
23 return false;
24
25 return addr + size <= *dev->dma_mask;
26}
27
28static inline void dma_mark_clean(void *addr, size_t size) {}
29
30#define arch_setup_dma_ops arch_setup_dma_ops 20#define arch_setup_dma_ops arch_setup_dma_ops
31static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, 21static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
32 u64 size, const struct iommu_ops *iommu, 22 u64 size, const struct iommu_ops *iommu,
diff --git a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
index 9110988b92a1..138edf6b5b48 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
@@ -61,6 +61,14 @@ static inline void plat_post_dma_flush(struct device *dev)
61{ 61{
62} 62}
63 63
64static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
65{
66 if (!dev->dma_mask)
67 return false;
68
69 return addr + size - 1 <= *dev->dma_mask;
70}
71
64dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 72dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
65phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 73phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
66 74
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 61addb1677e9..8ad7a40ca786 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -70,16 +70,4 @@ static inline void plat_post_dma_flush(struct device *dev)
70} 70}
71#endif 71#endif
72 72
73#ifdef CONFIG_SWIOTLB
74static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
75{
76 return paddr;
77}
78
79static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
80{
81 return daddr;
82}
83#endif
84
85#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */ 73#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-loongson64/dma-coherence.h b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
index 1602a9e9e8c2..b1b575f5c6c1 100644
--- a/arch/mips/include/asm/mach-loongson64/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
@@ -17,6 +17,14 @@
17 17
18struct device; 18struct device;
19 19
20static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
21{
22 if (!dev->dma_mask)
23 return false;
24
25 return addr + size - 1 <= *dev->dma_mask;
26}
27
20extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 28extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
21extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 29extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
22static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, 30static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
index a6e6cbebe046..57616649b4f3 100644
--- a/arch/mips/include/asm/netlogic/common.h
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -87,9 +87,6 @@ unsigned int nlm_get_cpu_frequency(void);
87extern const struct plat_smp_ops nlm_smp_ops; 87extern const struct plat_smp_ops nlm_smp_ops;
88extern char nlm_reset_entry[], nlm_reset_entry_end[]; 88extern char nlm_reset_entry[], nlm_reset_entry_end[];
89 89
90/* SWIOTLB */
91extern const struct dma_map_ops nlm_swiotlb_dma_ops;
92
93extern unsigned int nlm_threads_per_core; 90extern unsigned int nlm_threads_per_core;
94extern cpumask_t nlm_cpumask; 91extern cpumask_t nlm_cpumask;
95 92