]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability
authorChristoph Hellwig <hch@lst.de>
Mon, 7 Jan 2019 18:36:20 +0000 (13:36 -0500)
committerChristoph Hellwig <hch@lst.de>
Wed, 13 Feb 2019 18:12:33 +0000 (19:12 +0100)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Burton <paul.burton@mips.com> # MIPS
Acked-by: Catalin Marinas <catalin.marinas@arm.com> # arm64
12 files changed:
arch/arc/Kconfig
arch/arc/include/asm/Kbuild
arch/arc/include/asm/dma-mapping.h [deleted file]
arch/arm/Kconfig
arch/arm/include/asm/dma-mapping.h
arch/arm64/Kconfig
arch/arm64/include/asm/dma-mapping.h
arch/mips/Kconfig
arch/mips/include/asm/dma-mapping.h
arch/mips/mm/dma-noncoherent.c
include/linux/dma-mapping.h
kernel/dma/Kconfig

index 376366a7db81c8c979628d22c37a1028fcc12fed..2ab27d88eb1c2d4862413bbbf628ec0ba3494408 100644 (file)
@@ -11,6 +11,7 @@ config ARC
        select ARC_TIMERS
        select ARCH_HAS_DMA_COHERENT_TO_PFN
        select ARCH_HAS_PTE_SPECIAL
+       select ARCH_HAS_SETUP_DMA_OPS
        select ARCH_HAS_SYNC_DMA_FOR_CPU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE
        select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
index caa270261521d45e46759592e9a3007c15fdd80f..b41f8881ecc811f2005b763958e779a42da15c36 100644 (file)
@@ -3,6 +3,7 @@ generic-y += bugs.h
 generic-y += compat.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += ftrace.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644 (file)
index c946c0a..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier:  GPL-2.0
-// (C) 2018 Synopsys, Inc. (www.synopsys.com)
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-#include <asm-generic/dma-mapping.h>
-
-void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
-                       const struct iommu_ops *iommu, bool coherent);
-#define arch_setup_dma_ops arch_setup_dma_ops
-
-#endif
index 664e918e26249a6dd0a43fa1c80eaf187a040821..c1cf44f008709eabe7a45874aa8278b945e95bf5 100644 (file)
@@ -12,6 +12,7 @@ config ARM
        select ARCH_HAS_MEMBARRIER_SYNC_CORE
        select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
        select ARCH_HAS_PHYS_TO_DMA
+       select ARCH_HAS_SETUP_DMA_OPS
        select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
        select ARCH_HAS_STRICT_MODULE_RWX if MMU
index 31d3b96f0f4b1f6bd73bd7fc675b44f1d7736e5c..a224b6e39e5805fa62bdc6c8264666e02edbde0e 100644 (file)
@@ -96,10 +96,6 @@ static inline unsigned long dma_max_pfn(struct device *dev)
 }
 #define dma_max_pfn(dev) dma_max_pfn(dev)
 
-#define arch_setup_dma_ops arch_setup_dma_ops
-extern void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
-                              const struct iommu_ops *iommu, bool coherent);
-
 #ifdef CONFIG_MMU
 #define arch_teardown_dma_ops arch_teardown_dma_ops
 extern void arch_teardown_dma_ops(struct device *dev);
index a4168d36612772a7668ee0a7d9e83afef40a729d..63909f318d56d35ed7ea6ed3dbca8d6ee06176e9 100644 (file)
@@ -22,6 +22,7 @@ config ARM64
        select ARCH_HAS_KCOV
        select ARCH_HAS_MEMBARRIER_SYNC_CORE
        select ARCH_HAS_PTE_SPECIAL
+       select ARCH_HAS_SETUP_DMA_OPS
        select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_STRICT_KERNEL_RWX
        select ARCH_HAS_STRICT_MODULE_RWX
index 95dbf3ef735af28ca67e95d45368de16d5297e0c..de96507ee2c13e6890d743a3a13a4697e5938f19 100644 (file)
@@ -29,10 +29,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
        return NULL;
 }
 
-void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
-                       const struct iommu_ops *iommu, bool coherent);
-#define arch_setup_dma_ops     arch_setup_dma_ops
-
 #ifdef CONFIG_IOMMU_DMA
 void arch_teardown_dma_ops(struct device *dev);
 #define arch_teardown_dma_ops  arch_teardown_dma_ops
index 0d14f51d0002bf5fdeafd47df2d7641441ceb30a..dc5d70f674e0fae0b93b4400318ba4cd67764d67 100644 (file)
@@ -1118,6 +1118,7 @@ config DMA_MAYBE_COHERENT
 
 config DMA_PERDEV_COHERENT
        bool
+       select ARCH_HAS_SETUP_DMA_OPS
        select DMA_NONCOHERENT
 
 config DMA_NONCOHERENT
index 20dfaad3a55d2cdea6ad9dc5d2bb8f97b21e860d..34de7b17b41b7215622930cfe06532921fa181f1 100644 (file)
@@ -15,14 +15,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 #endif
 }
 
-#define arch_setup_dma_ops arch_setup_dma_ops
-static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
-                                     u64 size, const struct iommu_ops *iommu,
-                                     bool coherent)
-{
-#ifdef CONFIG_DMA_PERDEV_COHERENT
-       dev->dma_coherent = coherent;
-#endif
-}
-
 #endif /* _ASM_DMA_MAPPING_H */
index cb38461391cb78c714535d2536b5cb4eed1bddad..0606fc87b2941eba9e75515225d53eb926ce964a 100644 (file)
@@ -159,3 +159,11 @@ void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 
        dma_sync_virt(vaddr, size, direction);
 }
+
+#ifdef CONFIG_DMA_PERDEV_COHERENT
+void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
+               const struct iommu_ops *iommu, bool coherent)
+{
+       dev->dma_coherent = coherent;
+}
+#endif
index b904d55247abc9c609457d5b7825d33912a3b8e3..2b20d60e615896833f6341b70ec81361217fd33f 100644 (file)
@@ -671,11 +671,15 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
        return dma_set_mask_and_coherent(dev, mask);
 }
 
-#ifndef arch_setup_dma_ops
+#ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
+void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
+               const struct iommu_ops *iommu, bool coherent);
+#else
 static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
-                                     u64 size, const struct iommu_ops *iommu,
-                                     bool coherent) { }
-#endif
+               u64 size, const struct iommu_ops *iommu, bool coherent)
+{
+}
+#endif /* CONFIG_ARCH_HAS_SETUP_DMA_OPS */
 
 #ifndef arch_teardown_dma_ops
 static inline void arch_teardown_dma_ops(struct device *dev) { }
index 61cebea36d897759fe2b74cc76425f8dd4ad7090..6014cad35e58214127789d1481cf5e2fd0f62038 100644 (file)
@@ -19,6 +19,9 @@ config ARCH_HAS_DMA_COHERENCE_H
 config HAVE_GENERIC_DMA_COHERENT
        bool
 
+config ARCH_HAS_SETUP_DMA_OPS
+       bool
+
 config ARCH_HAS_SYNC_DMA_FOR_DEVICE
        bool