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

dma-mapping: make support for dma ops optional

Avoid the overhead of the dma ops support for tiny builds that only
use the direct mapping.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>

+43 -6
+1
arch/alpha/Kconfig
··· 7 7 select ARCH_NO_PREEMPT 8 8 select ARCH_NO_SG_CHAIN 9 9 select ARCH_USE_CMPXCHG_LOCKREF 10 + select DMA_OPS if PCI 10 11 select FORCE_PCI if !ALPHA_JENSEN 11 12 select PCI_DOMAINS if PCI 12 13 select PCI_SYSCALL if PCI
+1
arch/arm/Kconfig
··· 41 41 select CPU_PM if SUSPEND || CPU_IDLE 42 42 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS 43 43 select DMA_DECLARE_COHERENT 44 + select DMA_OPS 44 45 select DMA_REMAP if MMU 45 46 select EDAC_SUPPORT 46 47 select EDAC_ATOMIC_SCRUB
+1
arch/ia64/Kconfig
··· 192 192 193 193 config IA64_HP_SBA_IOMMU 194 194 bool "HP SBA IOMMU support" 195 + select DMA_OPS 195 196 default y 196 197 help 197 198 Say Y here to add support for the SBA IOMMU found on HP zx1 and
+1
arch/mips/Kconfig
··· 367 367 select ARC_PROMLIB 368 368 select ARCH_MIGHT_HAVE_PC_PARPORT 369 369 select ARCH_MIGHT_HAVE_PC_SERIO 370 + select DMA_OPS 370 371 select FW_ARC 371 372 select FW_ARC32 372 373 select ARCH_MAY_HAVE_PC_FDC
+1
arch/parisc/Kconfig
··· 14 14 select ARCH_HAS_UBSAN_SANITIZE_ALL 15 15 select ARCH_NO_SG_CHAIN 16 16 select ARCH_SUPPORTS_MEMORY_FAILURE 17 + select DMA_OPS 17 18 select RTC_CLASS 18 19 select RTC_DRV_GENERIC 19 20 select INIT_ALL_POSSIBLE
+1
arch/powerpc/Kconfig
··· 151 151 select BUILDTIME_TABLE_SORT 152 152 select CLONE_BACKWARDS 153 153 select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN 154 + select DMA_OPS if PPC64 154 155 select DYNAMIC_FTRACE if FUNCTION_TRACER 155 156 select EDAC_ATOMIC_SCRUB 156 157 select EDAC_SUPPORT
+1
arch/s390/Kconfig
··· 113 113 select ARCH_WANT_IPC_PARSE_VERSION 114 114 select BUILDTIME_TABLE_SORT 115 115 select CLONE_BACKWARDS2 116 + select DMA_OPS if PCI 116 117 select DYNAMIC_FTRACE if FUNCTION_TRACER 117 118 select GENERIC_CLOCKEVENTS 118 119 select GENERIC_CPU_AUTOPROBE
+1
arch/sparc/Kconfig
··· 15 15 default y 16 16 select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI 17 17 select ARCH_MIGHT_HAVE_PC_SERIO 18 + select DMA_OPS 18 19 select OF 19 20 select OF_PROMTREE 20 21 select HAVE_ASM_MODVERSIONS
+1
arch/x86/Kconfig
··· 909 909 910 910 config GART_IOMMU 911 911 bool "Old AMD GART IOMMU support" 912 + select DMA_OPS 912 913 select IOMMU_HELPER 913 914 select SWIOTLB 914 915 depends on X86_64 && PCI && AMD_NB
+5 -1
drivers/infiniband/core/device.c
··· 1183 1183 struct device *parent = device->dev.parent; 1184 1184 1185 1185 WARN_ON_ONCE(device->dma_device); 1186 + 1187 + #ifdef CONFIG_DMA_OPS 1186 1188 if (device->dev.dma_ops) { 1187 1189 /* 1188 1190 * The caller provided custom DMA operations. Copy the ··· 1205 1203 else 1206 1204 WARN_ON_ONCE(true); 1207 1205 } 1208 - } else { 1206 + } else 1207 + #endif /* CONFIG_DMA_OPS */ 1208 + { 1209 1209 /* 1210 1210 * The caller did not provide custom DMA operations. Use the 1211 1211 * DMA mapping operations of the parent device.
+2
drivers/iommu/Kconfig
··· 97 97 # IOMMU-agnostic DMA-mapping layer 98 98 config IOMMU_DMA 99 99 bool 100 + select DMA_OPS 100 101 select IOMMU_API 101 102 select IOMMU_IOVA 102 103 select IRQ_MSI_IOMMU ··· 184 183 config INTEL_IOMMU 185 184 bool "Support for Intel IOMMU using DMA Remapping Devices" 186 185 depends on PCI_MSI && ACPI && (X86 || IA64) 186 + select DMA_OPS 187 187 select IOMMU_API 188 188 select IOMMU_IOVA 189 189 select NEED_DMA_MAP_STATE
+2 -2
drivers/macintosh/macio_asic.c
··· 382 382 dma_set_max_seg_size(&dev->ofdev.dev, 65536); 383 383 dma_set_seg_boundary(&dev->ofdev.dev, 0xffffffff); 384 384 385 - #ifdef CONFIG_PCI 385 + #if defined(CONFIG_PCI) && defined(CONFIG_DMA_OPS) 386 386 /* Set the DMA ops to the ones from the PCI device, this could be 387 387 * fishy if we didn't know that on PowerMac it's always direct ops 388 388 * or iommu ops that will work fine ··· 391 391 */ 392 392 dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata; 393 393 dev->ofdev.dev.dma_ops = chip->lbus.pdev->dev.dma_ops; 394 - #endif /* CONFIG_PCI */ 394 + #endif /* CONFIG_PCI && CONFIG_DMA_OPS */ 395 395 396 396 #ifdef DEBUG 397 397 printk("preparing mdev @%p, ofdev @%p, dev @%p, kobj @%p\n",
+4
drivers/misc/mic/Kconfig
··· 4 4 config INTEL_MIC_BUS 5 5 tristate "Intel MIC Bus Driver" 6 6 depends on 64BIT && PCI && X86 7 + select DMA_OPS 7 8 help 8 9 This option is selected by any driver which registers a 9 10 device or driver on the MIC Bus, such as CONFIG_INTEL_MIC_HOST, ··· 20 19 config SCIF_BUS 21 20 tristate "SCIF Bus Driver" 22 21 depends on 64BIT && PCI && X86 22 + select DMA_OPS 23 23 help 24 24 This option is selected by any driver which registers a 25 25 device or driver on the SCIF Bus, such as CONFIG_INTEL_MIC_HOST ··· 35 33 36 34 config VOP_BUS 37 35 tristate "VOP Bus Driver" 36 + select DMA_OPS 38 37 help 39 38 This option is selected by any driver which registers a 40 39 device or driver on the VOP Bus, such as CONFIG_INTEL_MIC_HOST ··· 52 49 tristate "Intel MIC Host Driver" 53 50 depends on 64BIT && PCI && X86 54 51 depends on INTEL_MIC_BUS && SCIF_BUS && MIC_COSM && VOP_BUS 52 + select DMA_OPS 55 53 help 56 54 This enables Host Driver support for the Intel Many Integrated 57 55 Core (MIC) family of PCIe form factor coprocessor devices that
+1
drivers/vdpa/Kconfig
··· 11 11 config VDPA_SIM 12 12 tristate "vDPA device simulator" 13 13 depends on RUNTIME_TESTING_MENU && HAS_DMA 14 + select DMA_OPS 14 15 select VHOST_RING 15 16 default n 16 17 help
+1
drivers/xen/Kconfig
··· 179 179 180 180 config SWIOTLB_XEN 181 181 def_bool y 182 + select DMA_OPS 182 183 select SWIOTLB 183 184 184 185 config XEN_PCIDEV_BACKEND
+2 -1
include/linux/device.h
··· 568 568 #ifdef CONFIG_GENERIC_MSI_IRQ 569 569 struct list_head msi_list; 570 570 #endif 571 - 571 + #ifdef CONFIG_DMA_OPS 572 572 const struct dma_map_ops *dma_ops; 573 + #endif 573 574 u64 *dma_mask; /* dma mask (if dma'able device) */ 574 575 u64 coherent_dma_mask;/* Like dma_mask, but for 575 576 alloc_coherent mappings as
+11 -1
include/linux/dma-mapping.h
··· 191 191 #ifdef CONFIG_HAS_DMA 192 192 #include <asm/dma-mapping.h> 193 193 194 + #ifdef CONFIG_DMA_OPS 194 195 static inline const struct dma_map_ops *get_dma_ops(struct device *dev) 195 196 { 196 197 if (dev->dma_ops) ··· 204 203 { 205 204 dev->dma_ops = dma_ops; 206 205 } 207 - 206 + #else /* CONFIG_DMA_OPS */ 207 + static inline const struct dma_map_ops *get_dma_ops(struct device *dev) 208 + { 209 + return NULL; 210 + } 211 + static inline void set_dma_ops(struct device *dev, 212 + const struct dma_map_ops *dma_ops) 213 + { 214 + } 215 + #endif /* CONFIG_DMA_OPS */ 208 216 209 217 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 210 218 {
+4
kernel/dma/Kconfig
··· 5 5 depends on !NO_DMA 6 6 default y 7 7 8 + config DMA_OPS 9 + bool 10 + 8 11 config NEED_SG_DMA_LENGTH 9 12 bool 10 13 ··· 63 60 config DMA_VIRT_OPS 64 61 bool 65 62 depends on HAS_DMA 63 + select DMA_OPS 66 64 67 65 config SWIOTLB 68 66 bool
+2 -1
kernel/dma/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - obj-$(CONFIG_HAS_DMA) += mapping.o direct.o dummy.o 3 + obj-$(CONFIG_HAS_DMA) += mapping.o direct.o 4 + obj-$(CONFIG_DMA_OPS) += dummy.o 4 5 obj-$(CONFIG_DMA_CMA) += contiguous.o 5 6 obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o 6 7 obj-$(CONFIG_DMA_VIRT_OPS) += virt.o