Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability

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

+24 -35
+1
arch/arc/Kconfig
··· 11 11 select ARC_TIMERS 12 12 select ARCH_HAS_DMA_COHERENT_TO_PFN 13 13 select ARCH_HAS_PTE_SPECIAL 14 + select ARCH_HAS_SETUP_DMA_OPS 14 15 select ARCH_HAS_SYNC_DMA_FOR_CPU 15 16 select ARCH_HAS_SYNC_DMA_FOR_DEVICE 16 17 select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
+1
arch/arc/include/asm/Kbuild
··· 3 3 generic-y += compat.h 4 4 generic-y += device.h 5 5 generic-y += div64.h 6 + generic-y += dma-mapping.h 6 7 generic-y += emergency-restart.h 7 8 generic-y += extable.h 8 9 generic-y += ftrace.h
-13
arch/arc/include/asm/dma-mapping.h
··· 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
+1
arch/arm/Kconfig
··· 12 12 select ARCH_HAS_MEMBARRIER_SYNC_CORE 13 13 select ARCH_HAS_PTE_SPECIAL if ARM_LPAE 14 14 select ARCH_HAS_PHYS_TO_DMA 15 + select ARCH_HAS_SETUP_DMA_OPS 15 16 select ARCH_HAS_SET_MEMORY 16 17 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL 17 18 select ARCH_HAS_STRICT_MODULE_RWX if MMU
-4
arch/arm/include/asm/dma-mapping.h
··· 96 96 } 97 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 99 #ifdef CONFIG_MMU 104 100 #define arch_teardown_dma_ops arch_teardown_dma_ops 105 101 extern void arch_teardown_dma_ops(struct device *dev);
+1
arch/arm64/Kconfig
··· 22 22 select ARCH_HAS_KCOV 23 23 select ARCH_HAS_MEMBARRIER_SYNC_CORE 24 24 select ARCH_HAS_PTE_SPECIAL 25 + select ARCH_HAS_SETUP_DMA_OPS 25 26 select ARCH_HAS_SET_MEMORY 26 27 select ARCH_HAS_STRICT_KERNEL_RWX 27 28 select ARCH_HAS_STRICT_MODULE_RWX
-4
arch/arm64/include/asm/dma-mapping.h
··· 29 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 32 #ifdef CONFIG_IOMMU_DMA 37 33 void arch_teardown_dma_ops(struct device *dev); 38 34 #define arch_teardown_dma_ops arch_teardown_dma_ops
+1
arch/mips/Kconfig
··· 1118 1118 1119 1119 config DMA_PERDEV_COHERENT 1120 1120 bool 1121 + select ARCH_HAS_SETUP_DMA_OPS 1121 1122 select DMA_NONCOHERENT 1122 1123 1123 1124 config DMA_NONCOHERENT
-10
arch/mips/include/asm/dma-mapping.h
··· 15 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 18 #endif /* _ASM_DMA_MAPPING_H */
+8
arch/mips/mm/dma-noncoherent.c
··· 159 159 160 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
+8 -4
include/linux/dma-mapping.h
··· 671 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 678 static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, 676 - u64 size, const struct iommu_ops *iommu, 677 - bool coherent) { } 678 - #endif 679 + u64 size, const struct iommu_ops *iommu, bool coherent) 680 + { 681 + } 682 + #endif /* CONFIG_ARCH_HAS_SETUP_DMA_OPS */ 679 683 680 684 #ifndef arch_teardown_dma_ops 681 685 static inline void arch_teardown_dma_ops(struct device *dev) { }
+3
kernel/dma/Kconfig
··· 19 19 config HAVE_GENERIC_DMA_COHERENT 20 20 bool 21 21 22 + config ARCH_HAS_SETUP_DMA_OPS 23 + bool 24 + 22 25 config ARCH_HAS_SYNC_DMA_FOR_DEVICE 23 26 bool 24 27