diff options
| -rw-r--r-- | arch/arc/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arc/include/asm/Kbuild | 1 | ||||
| -rw-r--r-- | arch/arc/include/asm/dma-mapping.h | 13 | ||||
| -rw-r--r-- | arch/arm/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 4 | ||||
| -rw-r--r-- | arch/arm64/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm64/include/asm/dma-mapping.h | 4 | ||||
| -rw-r--r-- | arch/mips/Kconfig | 1 | ||||
| -rw-r--r-- | arch/mips/include/asm/dma-mapping.h | 10 | ||||
| -rw-r--r-- | arch/mips/mm/dma-noncoherent.c | 8 | ||||
| -rw-r--r-- | include/linux/dma-mapping.h | 12 | ||||
| -rw-r--r-- | kernel/dma/Kconfig | 3 |
12 files changed, 24 insertions, 35 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 376366a7db81..2ab27d88eb1c 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
| @@ -11,6 +11,7 @@ config ARC | |||
| 11 | select ARC_TIMERS | 11 | select ARC_TIMERS |
| 12 | select ARCH_HAS_DMA_COHERENT_TO_PFN | 12 | select ARCH_HAS_DMA_COHERENT_TO_PFN |
| 13 | select ARCH_HAS_PTE_SPECIAL | 13 | select ARCH_HAS_PTE_SPECIAL |
| 14 | select ARCH_HAS_SETUP_DMA_OPS | ||
| 14 | select ARCH_HAS_SYNC_DMA_FOR_CPU | 15 | select ARCH_HAS_SYNC_DMA_FOR_CPU |
| 15 | select ARCH_HAS_SYNC_DMA_FOR_DEVICE | 16 | select ARCH_HAS_SYNC_DMA_FOR_DEVICE |
| 16 | select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC | 17 | select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC |
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index caa270261521..b41f8881ecc8 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
| @@ -3,6 +3,7 @@ generic-y += bugs.h | |||
| 3 | generic-y += compat.h | 3 | generic-y += compat.h |
| 4 | generic-y += device.h | 4 | generic-y += device.h |
| 5 | generic-y += div64.h | 5 | generic-y += div64.h |
| 6 | generic-y += dma-mapping.h | ||
| 6 | generic-y += emergency-restart.h | 7 | generic-y += emergency-restart.h |
| 7 | generic-y += extable.h | 8 | generic-y += extable.h |
| 8 | generic-y += ftrace.h | 9 | 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 index c946c0a83e76..000000000000 --- a/arch/arc/include/asm/dma-mapping.h +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | // (C) 2018 Synopsys, Inc. (www.synopsys.com) | ||
| 3 | |||
| 4 | #ifndef ASM_ARC_DMA_MAPPING_H | ||
| 5 | #define ASM_ARC_DMA_MAPPING_H | ||
| 6 | |||
| 7 | #include <asm-generic/dma-mapping.h> | ||
| 8 | |||
| 9 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
| 10 | const struct iommu_ops *iommu, bool coherent); | ||
| 11 | #define arch_setup_dma_ops arch_setup_dma_ops | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918e2624..c1cf44f00870 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -12,6 +12,7 @@ config ARM | |||
| 12 | select ARCH_HAS_MEMBARRIER_SYNC_CORE | 12 | select ARCH_HAS_MEMBARRIER_SYNC_CORE |
| 13 | select ARCH_HAS_PTE_SPECIAL if ARM_LPAE | 13 | select ARCH_HAS_PTE_SPECIAL if ARM_LPAE |
| 14 | select ARCH_HAS_PHYS_TO_DMA | 14 | select ARCH_HAS_PHYS_TO_DMA |
| 15 | select ARCH_HAS_SETUP_DMA_OPS | ||
| 15 | select ARCH_HAS_SET_MEMORY | 16 | select ARCH_HAS_SET_MEMORY |
| 16 | select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL | 17 | select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL |
| 17 | select ARCH_HAS_STRICT_MODULE_RWX if MMU | 18 | select ARCH_HAS_STRICT_MODULE_RWX if MMU |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 31d3b96f0f4b..a224b6e39e58 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
| @@ -96,10 +96,6 @@ static inline unsigned long dma_max_pfn(struct device *dev) | |||
| 96 | } | 96 | } |
| 97 | #define dma_max_pfn(dev) dma_max_pfn(dev) | 97 | #define dma_max_pfn(dev) dma_max_pfn(dev) |
| 98 | 98 | ||
| 99 | #define arch_setup_dma_ops arch_setup_dma_ops | ||
| 100 | extern void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
| 101 | const struct iommu_ops *iommu, bool coherent); | ||
| 102 | |||
| 103 | #ifdef CONFIG_MMU | 99 | #ifdef CONFIG_MMU |
| 104 | #define arch_teardown_dma_ops arch_teardown_dma_ops | 100 | #define arch_teardown_dma_ops arch_teardown_dma_ops |
| 105 | extern void arch_teardown_dma_ops(struct device *dev); | 101 | extern void arch_teardown_dma_ops(struct device *dev); |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a4168d366127..63909f318d56 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
| @@ -22,6 +22,7 @@ config ARM64 | |||
| 22 | select ARCH_HAS_KCOV | 22 | select ARCH_HAS_KCOV |
| 23 | select ARCH_HAS_MEMBARRIER_SYNC_CORE | 23 | select ARCH_HAS_MEMBARRIER_SYNC_CORE |
| 24 | select ARCH_HAS_PTE_SPECIAL | 24 | select ARCH_HAS_PTE_SPECIAL |
| 25 | select ARCH_HAS_SETUP_DMA_OPS | ||
| 25 | select ARCH_HAS_SET_MEMORY | 26 | select ARCH_HAS_SET_MEMORY |
| 26 | select ARCH_HAS_STRICT_KERNEL_RWX | 27 | select ARCH_HAS_STRICT_KERNEL_RWX |
| 27 | select ARCH_HAS_STRICT_MODULE_RWX | 28 | select ARCH_HAS_STRICT_MODULE_RWX |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 95dbf3ef735a..de96507ee2c1 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
| @@ -29,10 +29,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) | |||
| 29 | return NULL; | 29 | return NULL; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
| 33 | const struct iommu_ops *iommu, bool coherent); | ||
| 34 | #define arch_setup_dma_ops arch_setup_dma_ops | ||
| 35 | |||
| 36 | #ifdef CONFIG_IOMMU_DMA | 32 | #ifdef CONFIG_IOMMU_DMA |
| 37 | void arch_teardown_dma_ops(struct device *dev); | 33 | void arch_teardown_dma_ops(struct device *dev); |
| 38 | #define arch_teardown_dma_ops arch_teardown_dma_ops | 34 | #define arch_teardown_dma_ops arch_teardown_dma_ops |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0d14f51d0002..dc5d70f674e0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -1118,6 +1118,7 @@ config DMA_MAYBE_COHERENT | |||
| 1118 | 1118 | ||
| 1119 | config DMA_PERDEV_COHERENT | 1119 | config DMA_PERDEV_COHERENT |
| 1120 | bool | 1120 | bool |
| 1121 | select ARCH_HAS_SETUP_DMA_OPS | ||
| 1121 | select DMA_NONCOHERENT | 1122 | select DMA_NONCOHERENT |
| 1122 | 1123 | ||
| 1123 | config DMA_NONCOHERENT | 1124 | config DMA_NONCOHERENT |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 20dfaad3a55d..34de7b17b41b 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
| @@ -15,14 +15,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) | |||
| 15 | #endif | 15 | #endif |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #define arch_setup_dma_ops arch_setup_dma_ops | ||
| 19 | static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, | ||
| 20 | u64 size, const struct iommu_ops *iommu, | ||
| 21 | bool coherent) | ||
| 22 | { | ||
| 23 | #ifdef CONFIG_DMA_PERDEV_COHERENT | ||
| 24 | dev->dma_coherent = coherent; | ||
| 25 | #endif | ||
| 26 | } | ||
| 27 | |||
| 28 | #endif /* _ASM_DMA_MAPPING_H */ | 18 | #endif /* _ASM_DMA_MAPPING_H */ |
diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c index cb38461391cb..0606fc87b294 100644 --- a/arch/mips/mm/dma-noncoherent.c +++ b/arch/mips/mm/dma-noncoherent.c | |||
| @@ -159,3 +159,11 @@ void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
| 159 | 159 | ||
| 160 | dma_sync_virt(vaddr, size, direction); | 160 | dma_sync_virt(vaddr, size, direction); |
| 161 | } | 161 | } |
| 162 | |||
| 163 | #ifdef CONFIG_DMA_PERDEV_COHERENT | ||
| 164 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
| 165 | const struct iommu_ops *iommu, bool coherent) | ||
| 166 | { | ||
| 167 | dev->dma_coherent = coherent; | ||
| 168 | } | ||
| 169 | #endif | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index b904d55247ab..2b20d60e6158 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -671,11 +671,15 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) | |||
| 671 | return dma_set_mask_and_coherent(dev, mask); | 671 | return dma_set_mask_and_coherent(dev, mask); |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | #ifndef arch_setup_dma_ops | 674 | #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS |
| 675 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
| 676 | const struct iommu_ops *iommu, bool coherent); | ||
| 677 | #else | ||
| 675 | static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, | 678 | static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, |
| 676 | u64 size, const struct iommu_ops *iommu, | 679 | u64 size, const struct iommu_ops *iommu, bool coherent) |
| 677 | bool coherent) { } | 680 | { |
| 678 | #endif | 681 | } |
| 682 | #endif /* CONFIG_ARCH_HAS_SETUP_DMA_OPS */ | ||
| 679 | 683 | ||
| 680 | #ifndef arch_teardown_dma_ops | 684 | #ifndef arch_teardown_dma_ops |
| 681 | static inline void arch_teardown_dma_ops(struct device *dev) { } | 685 | static inline void arch_teardown_dma_ops(struct device *dev) { } |
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 61cebea36d89..6014cad35e58 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig | |||
| @@ -19,6 +19,9 @@ config ARCH_HAS_DMA_COHERENCE_H | |||
| 19 | config HAVE_GENERIC_DMA_COHERENT | 19 | config HAVE_GENERIC_DMA_COHERENT |
| 20 | bool | 20 | bool |
| 21 | 21 | ||
| 22 | config ARCH_HAS_SETUP_DMA_OPS | ||
| 23 | bool | ||
| 24 | |||
| 22 | config ARCH_HAS_SYNC_DMA_FOR_DEVICE | 25 | config ARCH_HAS_SYNC_DMA_FOR_DEVICE |
| 23 | bool | 26 | bool |
| 24 | 27 | ||
