dma-mapping: split <linux/dma-mapping.h>
authorChristoph Hellwig <hch@lst.de>
Tue, 22 Sep 2020 13:31:03 +0000 (15:31 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Oct 2020 05:07:03 +0000 (07:07 +0200)
Split out all the bits that are purely for dma_map_ops implementations
and related code into a new <linux/dma-map-ops.h> header so that they
don't get pulled into all the drivers.  That also means the architecture
specific <asm/dma-mapping.h> is not pulled in by <linux/dma-mapping.h>
any more, which leads to a missing includes that were pulled in by the
x86 or arm versions in a few not overly portable drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
64 files changed:
MAINTAINERS
arch/alpha/kernel/pci_iommu.c
arch/arc/mm/dma.c
arch/arm/common/dmabounce.c
arch/arm/mach-highbank/highbank.c
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-mx31moboard.c
arch/arm/mach-mvebu/coherency.c
arch/arm/mm/dma-mapping-nommu.c
arch/arm/mm/dma-mapping.c
arch/arm64/mm/dma-mapping.c
arch/ia64/hp/common/sba_iommu.c
arch/ia64/kernel/dma-mapping.c
arch/mips/jazz/jazzdma.c
arch/mips/mm/dma-noncoherent.c
arch/parisc/kernel/drivers.c
arch/powerpc/include/asm/iommu.h
arch/powerpc/include/asm/pci.h
arch/powerpc/platforms/ps3/system-bus.c
arch/powerpc/platforms/pseries/ibmebus.c
arch/powerpc/platforms/pseries/vio.c
arch/s390/pci/pci_dma.c
arch/sh/boards/mach-ap325rxa/setup.c
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-kfr2r09/setup.c
arch/sh/boards/mach-migor/setup.c
arch/sh/boards/mach-se/7724/setup.c
arch/sh/drivers/pci/fixups-dreamcast.c
arch/sparc/kernel/iommu.c
arch/sparc/kernel/pci_sun4v.c
arch/sparc/mm/io-unit.c
arch/sparc/mm/iommu.c
arch/x86/kernel/amd_gart_64.c
arch/x86/kernel/pci-dma.c
arch/x86/kernel/setup.c
arch/x86/xen/pci-swiotlb-xen.c
drivers/acpi/arm64/iort.c
drivers/acpi/scan.c
drivers/base/dd.c
drivers/gpu/drm/exynos/exynos_drm_dma.c
drivers/gpu/drm/msm/msm_gem.c
drivers/iommu/dma-iommu.c
drivers/iommu/intel/iommu.c
drivers/misc/mic/bus/mic_bus.c
drivers/misc/mic/bus/scif_bus.c
drivers/misc/mic/bus/scif_bus.h
drivers/misc/mic/bus/vop_bus.c
drivers/misc/mic/host/mic_boot.c
drivers/of/device.c
drivers/parisc/ccio-dma.c
drivers/parisc/sba_iommu.c
drivers/pci/xen-pcifront.c
drivers/remoteproc/remoteproc_core.c
drivers/remoteproc/remoteproc_virtio.c
drivers/vdpa/vdpa_sim/vdpa_sim.c
drivers/xen/swiotlb-xen.c
include/linux/dma-map-ops.h [new file with mode: 0644]
include/linux/dma-mapping.h
kernel/dma/coherent.c
kernel/dma/direct.c
kernel/dma/dummy.c
kernel/dma/mapping.c
kernel/dma/ops_helpers.c
kernel/dma/virt.c

index 190c7fa2ea010aad5e48aba914f552e5dc5ddb77..b13fc17943079ae6510949ba0f7e161824caa33c 100644 (file)
@@ -5202,6 +5202,7 @@ T:        git git://git.infradead.org/users/hch/dma-mapping.git
 F:     include/asm-generic/dma-mapping.h
 F:     include/linux/dma-direct.h
 F:     include/linux/dma-mapping.h
+F:     include/linux/dma-map-ops.h
 F:     include/linux/dma-noncoherent.h
 F:     kernel/dma/
 
index 447e0fd0ed38955ef5ed729c6bee530e2d8ff13e..d84b19aa8e9da79c027d590020bf967344520e5f 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/export.h>
 #include <linux/scatterlist.h>
 #include <linux/log2.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/iommu-helper.h>
 
 #include <asm/io.h>
index e947572a521ec08557c1580992b67f1887f9db24..a8c453e98d753b8f8404248340fda047e562da53 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  */
 
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
index d3e00ea9208834afe5f602e1eb3d3caee68c397e..7996c04393d501a35085b5338971d3f5744a1528 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/page-flags.h>
 #include <linux/device.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dmapool.h>
 #include <linux/list.h>
 #include <linux/scatterlist.h>
index 56bf29523c657c73dbc136c951e275239f6523d8..db607955a7e4515a0d9229979bf2135e2b2671c1 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/clocksource.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/irqchip.h>
index 3da4c0920198b6c9e9c14354e3d562169207fca8..a329e50928b649ebd703de01465d7ef565b13c41 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/input.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/leds.h>
 #include <linux/platform_data/asoc-mx27vis.h>
 #include <sound/tlv320aic32x4.h>
index 96845a4eaf57eaa1cb155deb688dfbd747defe0c..7f780ad2d4592506e8e20b6dcf44c6df90747113 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/gfp.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
index 8f8748a0c84f44229fec0eb4f3fa225202c2666a..49e3c8d20c2fa1e723668efd5c715a332c14848d 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/of_address.h>
 #include <linux/io.h>
 #include <linux/smp.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/mbus.h>
index 43c6d66b6e733a334e15bdb6bf9d8f8ced4d075a..6bfd2b8845050bd775c26e00a9a94562b539354f 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
index 7738b4d23f692f8054f6fa2710b401ff1c79bbe7..8bf0bc6bc3117257c5ae1e41a29343609954d911 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/dma-direct.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 #include <linux/dma-contiguous.h>
 #include <linux/highmem.h>
index 6c45350e33aa5a47ce0ea74aaed61c945c1a101f..3afd3bd659d8dec2c9d03ab498e64d1cbd19442f 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/gfp.h>
 #include <linux/cache.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 #include <linux/dma-iommu.h>
 #include <xen/xen.h>
index cafbb848a34e4da376320ceb43faa62a0d794ba6..9148ddbf02e501a7a4a3cb7ef8917130a90e25f4 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/bitops.h>         /* hweight64() */
 #include <linux/crash_dump.h>
 #include <linux/iommu-helper.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/prefetch.h>
 #include <linux/swiotlb.h>
 
index f640ed6fe1d576046cc967e0f2220f7d6a032c97..cd0c166bfbc23ed0a47505be7e2757fa27eb774f 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/export.h>
 
 /* Set this to 1 if there is a HW IOMMU in the system */
index f53bc043334c0177fc897b96c2f18463b77d4dbd..b8fb42e56da0a8c7e71c0739c3c9217c21db6a31 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/memblock.h>
 #include <linux/spinlock.h>
 #include <linux/gfp.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 #include <asm/mipsregs.h>
 #include <asm/jazz.h>
index f34ad1f09799f19587f0aa11a2a826823dde580c..f4e8404ee0490ddd57e057111e8094a4b05897fa 100644 (file)
@@ -5,6 +5,7 @@
  * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
  */
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 #include <linux/dma-contiguous.h>
 #include <linux/highmem.h>
index a5f3e50fe97619eff506b92fceb75699bb530548..80fa0650736ba7f1363cd362b120a2afaba9fecb 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/spinlock.h>
 #include <linux/string.h>
 #include <linux/export.h>
+#include <linux/dma-map-ops.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
 #include <asm/pdc.h>
index 5032f1593299ef86111d04ba4d37083782f8292f..deef7c94d7b61d6d5e0be6a95239f0665119e69b 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/compiler.h>
 #include <linux/spinlock.h>
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/bitops.h>
 #include <asm/machdep.h>
 #include <asm/types.h>
index 63ed7e3b0ba3e41c428d1607683273b9f58d39e3..6436f0b41539e3f7440fcbdb6b168ad279731bd1 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/string.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 
 #include <asm/machdep.h>
index 7bc5f9be3e12d8053389b51fdbea8225140baf80..c62aaa29a9d5eef83605cc57e0cccf1617f19e2e 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/export.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 
index a6f101c958e84bc26724d9e1e4f9a437fcaaeed5..8c6e509f696756e5a877af8a4e9161263bcc1671 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/export.h>
 #include <linux/console.h>
 #include <linux/kobject.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
 #include <linux/slab.h>
index 98ed7b09b3fe50cab63239b89e16565b2e02c20e..b2797cfe4e2b087535a23c13b2132f4e08324419 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/console.h>
 #include <linux/export.h>
 #include <linux/mm.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/kobject.h>
 
 #include <asm/iommu.h>
index 9291023e9469c28eea0b2f27d00c2fc8f0a0eeab..ebc9a49523aa3182e0949c5e442ed24016427b6d 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/iommu-helper.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/vmalloc.h>
 #include <linux/pci.h>
 #include <asm/pci_dma.h>
index 665cad452798bb41c94d1a509a3c737393a999b0..bac8a058ebd7cd4cad1065700ed6a3fbb52862fc 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <cpu/sh7723.h>
 
+#include <linux/dma-map-ops.h>
 #include <linux/clkdev.h>
 #include <linux/delay.h>
 #include <linux/device.h>
index dd427bac5cdeb79f682cf72d12bae2c3ae2451b0..bab91a99124e1fb47b65c7695749f56436f45c20 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/usb/r8a66597.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/videodev2.h>
+#include <linux/dma-map-ops.h>
 
 #include <media/drv-intf/renesas-ceu.h>
 #include <media/i2c/mt9t112.h>
index 96538ba3aa323f5ac78e19ab4a8a100387ddc2af..eeb5ce341efdd705cb22cc6bdbec6956ac9364a8 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <linux/clkdev.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
 #include <linux/gpio.h>
 #include <linux/gpio/machine.h>
 #include <linux/i2c.h>
@@ -33,6 +32,7 @@
 #include <linux/sh_intc.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/videodev2.h>
+#include <linux/dma-map-ops.h>
 
 #include <mach/kfr2r09.h>
 
index 9ed369dad62df78b9e9d6e016a41ca2abeabb2d6..6703a2122c0d6bc3fabee59daa1347a57870ab9a 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2008 Magnus Damm
  */
 #include <linux/clkdev.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
index 32f5dd9448894a6477a9fe27eecba243c64f096c..8d6541ba01865b3e0c42de965c90910c97b0f590 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/smc91x.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/videodev2.h>
+#include <linux/dma-map-ops.h>
 
 #include <mach-se/mach/se7724.h>
 #include <media/drv-intf/renesas-ceu.h>
index 7be8694c0d131065c0f6841172c939ca665a28f3..41e4daee8f043fcebe8dbae8137b6867b1b7d315 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/pci.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
index c3e4e2df26a8b8234dce6c966efad06b85d77d42..a034f571d8695ec8db93f8b8a83b5865a7fe5235 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/errno.h>
 #include <linux/iommu-helper.h>
 #include <linux/bitmap.h>
index 6b92dd51c0026f2e684cc4b008a1df65b0ca5550..9de57e88f7a1776450f55e2315d2b634037cd63d 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/export.h>
 #include <linux/log2.h>
 #include <linux/of_device.h>
+#include <linux/dma-map-ops.h>
 #include <asm/iommu-common.h>
 
 #include <asm/iommu.h>
index 430a47a1b6aeff5a5a536522ff7636b960a2692e..bf3e6d2fe5d949549b8ab103482a58c0b84d7619 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/spinlock.h>
 #include <linux/mm.h>
 #include <linux/bitops.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 
index 3a388b1c5d4bc98366a3ac8eb3095b292332cb0f..0c0342e5b10d52115841477b9b5e443bc4b02d45 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 
index c96dcaa572ebd34fd581989a8fc97c61e69a1ee0..9ac696487b134bcc50c46ff60d518af59221eac7 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/gfp.h>
 #include <linux/atomic.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 #include <asm/mtrr.h>
 #include <asm/proto.h>
 #include <asm/iommu.h>
index 5dcedad21dffa2a0e5428c599354c37ff1fc84be..4892dd043d414c8adbfbbebe1fcd019dbc29a429 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <linux/dma-map-ops.h>
 #include <linux/dma-direct.h>
 #include <linux/dma-debug.h>
 #include <linux/iommu.h>
index 3511736fbc747e3b606daf8bee7ae896ea91980b..9286fa9d575e6de253766f45db9eaaf143b7005d 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <linux/console.h>
 #include <linux/crash_dump.h>
+#include <linux/dma-contiguous.h>
 #include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/init_ohci1394_dma.h>
@@ -19,6 +20,7 @@
 #include <linux/hugetlb.h>
 #include <linux/tboot.h>
 #include <linux/usb/xhci-dbgp.h>
+#include <linux/swiotlb.h>
 
 #include <uapi/linux/mount.h>
 
index 33293ce01d8db5d5eb42c8bbe0512add9bde7ada..19ae3e4fe4e98e5d0e2ffb40dffb6464b3741b0e 100644 (file)
@@ -2,7 +2,7 @@
 
 /* Glue code to lib/swiotlb-xen.c */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/pci.h>
 #include <xen/swiotlb-xen.h>
 
index de18c07ca02cc475bd45dee480e5ecdfe154b5b6..6446b2572f075f7015a6be7d252ce7721d512689 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/pci.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 #define IORT_TYPE_MASK(type)   (1 << (type))
 #define IORT_MSI_TYPE          (1 << ACPI_IORT_NODE_ITS_GROUP)
index 2142f155476176604526a027a576f1076d1583ac..e0b7d7a605b5a20d0364b9c5f236a051f9f68e91 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/kthread.h>
 #include <linux/dmi.h>
 #include <linux/nls.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/platform_data/x86/apple.h>
 #include <linux/pgtable.h>
 
index 857b0a928e8d0d9fb63aaabcfd2770e9652d72e3..b3d43ace5c2b94ed7bb8c5fa63d76050871f8c15 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/debugfs.h>
 #include <linux/device.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
index 58b89ec11b0eb36e08583c03be99a5c75e1f6d80..78b8f3403c3039ea2b8d471ce2e4ccb2400f5cb4 100644 (file)
@@ -5,7 +5,7 @@
 // Author: Andrzej Hajda <a.hajda@samsung.com>
 
 #include <linux/dma-iommu.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/iommu.h>
 #include <linux/platform_device.h>
 
index b2f49152b4d4c268ac47fc9634bb1c5d20dcf908..6787ab0d0e431dfe0f1743d3007119d5aa115664 100644 (file)
@@ -4,6 +4,7 @@
  * Author: Rob Clark <robdclark@gmail.com>
  */
 
+#include <linux/dma-map-ops.h>
 #include <linux/spinlock.h>
 #include <linux/shmem_fs.h>
 #include <linux/dma-buf.h>
index c12c1dc43d312eab006bfb46e7c0fffe5206470f..d2e3f26228151fb77e5c94129b785b9b3f39a567 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/acpi_iort.h>
 #include <linux/device.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-contiguous.h>
 #include <linux/dma-iommu.h>
 #include <linux/dma-noncoherent.h>
index 2c426dbdf17f3bccf0af703b00bcf928cea36bed..bd3470142b0678375b78fee57fd01f00c37732fd 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/spinlock.h>
 #include <linux/pci.h>
 #include <linux/dmar.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/mempool.h>
 #include <linux/memory.h>
 #include <linux/cpu.h>
index ed9a8351c3bfd16762f566ce46a590db7925c1c0..a08cb29692a8fed3f95e2f9a667747df6ca66daf 100644 (file)
@@ -9,6 +9,7 @@
  * This implementation is very similar to the the virtio bus driver
  * implementation @ drivers/virtio/virtio.c
  */
+#include <linux/dma-map-ops.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/idr.h>
index ae84109649d0f31ba5f18a0e49974a693bafa07f..ad7c3604f1510f56c14b0771bbd2208c9ba9c273 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/idr.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 #include "scif_bus.h"
 
index 642cd43bcabc6dfc1cd791cdbb5ed8d28771a7c9..4981eb56f8797955f25f60a597dde0069b17d6ac 100644 (file)
@@ -12,7 +12,7 @@
  * Everything a scif driver needs to work with any particular scif
  * hardware abstraction layer.
  */
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 #include <linux/mic_common.h>
 #include "../common/mic_dev.h"
index 3c865534868a0eb9fb8baa17d06e971c3a70a6dc..6935ddca1bd5b1b0acbb2ef33ba7d8b5530960da 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/idr.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 #include "vop_bus.h"
 
index fb5b3989753dafa3dcf51c73cd7652a1e1265da0..8cb85b8b3e199bafda211de07ce7f7bc12d8be6e 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/pci.h>
 #include <linux/kmod.h>
+#include <linux/dma-map-ops.h>
 #include <linux/mic_common.h>
 #include <linux/mic_bus.h>
 #include "../bus/scif_bus.h"
index 6e3ae7ebc33eeb7bc6edc75677563bdb6cb37445..655dee422563f05f14b946c32c3935d2e835e9e7 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/of_address.h>
 #include <linux/of_iommu.h>
 #include <linux/dma-direct.h> /* for bus_dma_region */
+#include <linux/dma-map-ops.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
index 8cf0b9c8bdf795359ee0f896a8de6e372cb69da0..b5f9ee81a46c1e2753d5f9150bf696279e882fff 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/reboot.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 #include <linux/iommu-helper.h>
 #include <linux/export.h>
index 6fcde7980358ae74fc0be0b10c3f1793791dcd69..dce4cdf786cdb19a607a79dc35a804067577d41d 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/pci.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 #include <linux/iommu-helper.h>
 
index c0e85be598c11272c1b2c3a0e508f8d876257450..c6fe0cfec0f681f19cabecc0826627e5d6018f2f 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/bitops.h>
 #include <linux/time.h>
 #include <linux/ktime.h>
+#include <linux/swiotlb.h>
 #include <xen/platform_pci.h>
 
 #include <asm/xen/swiotlb-xen.h>
index 8157dd491d28190b49f271d03f046f5590e5e677..dab2c0f5caf0ece8161797efaec0724d31ddeb50 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/device.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-direct.h> /* XXX: pokes into bus_dma_range */
 #include <linux/firmware.h>
index dfd3808c34fdbda5b2853dcfd53565c2cf85b4bf..0cc617f760682c5de9195c982643162487b0374c 100644 (file)
@@ -9,7 +9,7 @@
  * Brian Swetland <swetland@google.com>
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/export.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/remoteproc.h>
index 62d6403271450e0aff12173bb2a324a4089ddd14..2629911c29bbf4e341982434682a8e5975d8c4d0 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/wait.h>
 #include <linux/uuid.h>
 #include <linux/iommu.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/sysfs.h>
 #include <linux/file.h>
 #include <linux/etherdevice.h>
index 030a225624b060b2b9356163d182ffc162ad1d8d..71ff4bf380738c1c8b0fb3b732234c04a5cd0b77 100644 (file)
@@ -27,6 +27,7 @@
 #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
 
 #include <linux/memblock.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-direct.h>
 #include <linux/dma-noncoherent.h>
 #include <linux/export.h>
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
new file mode 100644 (file)
index 0000000..4b4ba5b
--- /dev/null
@@ -0,0 +1,158 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header is for implementations of dma_map_ops and related code.
+ * It should not be included in drivers just using the DMA API.
+ */
+#ifndef _LINUX_DMA_MAP_OPS_H
+#define _LINUX_DMA_MAP_OPS_H
+
+#include <linux/dma-mapping.h>
+
+struct dma_map_ops {
+       void *(*alloc)(struct device *dev, size_t size,
+                       dma_addr_t *dma_handle, gfp_t gfp,
+                       unsigned long attrs);
+       void (*free)(struct device *dev, size_t size, void *vaddr,
+                       dma_addr_t dma_handle, unsigned long attrs);
+       struct page *(*alloc_pages)(struct device *dev, size_t size,
+                       dma_addr_t *dma_handle, enum dma_data_direction dir,
+                       gfp_t gfp);
+       void (*free_pages)(struct device *dev, size_t size, struct page *vaddr,
+                       dma_addr_t dma_handle, enum dma_data_direction dir);
+       void *(*alloc_noncoherent)(struct device *dev, size_t size,
+                       dma_addr_t *dma_handle, enum dma_data_direction dir,
+                       gfp_t gfp);
+       void (*free_noncoherent)(struct device *dev, size_t size, void *vaddr,
+                       dma_addr_t dma_handle, enum dma_data_direction dir);
+       int (*mmap)(struct device *, struct vm_area_struct *,
+                       void *, dma_addr_t, size_t, unsigned long attrs);
+
+       int (*get_sgtable)(struct device *dev, struct sg_table *sgt,
+                       void *cpu_addr, dma_addr_t dma_addr, size_t size,
+                       unsigned long attrs);
+
+       dma_addr_t (*map_page)(struct device *dev, struct page *page,
+                       unsigned long offset, size_t size,
+                       enum dma_data_direction dir, unsigned long attrs);
+       void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
+                       size_t size, enum dma_data_direction dir,
+                       unsigned long attrs);
+       /*
+        * map_sg returns 0 on error and a value > 0 on success.
+        * It should never return a value < 0.
+        */
+       int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
+                       enum dma_data_direction dir, unsigned long attrs);
+       void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nents,
+                       enum dma_data_direction dir, unsigned long attrs);
+       dma_addr_t (*map_resource)(struct device *dev, phys_addr_t phys_addr,
+                       size_t size, enum dma_data_direction dir,
+                       unsigned long attrs);
+       void (*unmap_resource)(struct device *dev, dma_addr_t dma_handle,
+                       size_t size, enum dma_data_direction dir,
+                       unsigned long attrs);
+       void (*sync_single_for_cpu)(struct device *dev, dma_addr_t dma_handle,
+                       size_t size, enum dma_data_direction dir);
+       void (*sync_single_for_device)(struct device *dev,
+                       dma_addr_t dma_handle, size_t size,
+                       enum dma_data_direction dir);
+       void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
+                       int nents, enum dma_data_direction dir);
+       void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg,
+                       int nents, enum dma_data_direction dir);
+       void (*cache_sync)(struct device *dev, void *vaddr, size_t size,
+                       enum dma_data_direction direction);
+       int (*dma_supported)(struct device *dev, u64 mask);
+       u64 (*get_required_mask)(struct device *dev);
+       size_t (*max_mapping_size)(struct device *dev);
+       unsigned long (*get_merge_boundary)(struct device *dev);
+};
+
+#ifdef CONFIG_DMA_OPS
+#include <asm/dma-mapping.h>
+
+static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
+{
+       if (dev->dma_ops)
+               return dev->dma_ops;
+       return get_arch_dma_ops(dev->bus);
+}
+
+static inline void set_dma_ops(struct device *dev,
+                              const struct dma_map_ops *dma_ops)
+{
+       dev->dma_ops = dma_ops;
+}
+#else /* CONFIG_DMA_OPS */
+static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
+{
+       return NULL;
+}
+static inline void set_dma_ops(struct device *dev,
+                              const struct dma_map_ops *dma_ops)
+{
+}
+#endif /* CONFIG_DMA_OPS */
+
+#ifdef CONFIG_DMA_DECLARE_COHERENT
+int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
+               dma_addr_t device_addr, size_t size);
+int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
+               dma_addr_t *dma_handle, void **ret);
+int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr);
+int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
+               void *cpu_addr, size_t size, int *ret);
+
+void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size,
+               dma_addr_t *dma_handle);
+int dma_release_from_global_coherent(int order, void *vaddr);
+int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
+               size_t size, int *ret);
+
+#else
+static inline int dma_declare_coherent_memory(struct device *dev,
+               phys_addr_t phys_addr, dma_addr_t device_addr, size_t size)
+{
+       return -ENOSYS;
+}
+#define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
+#define dma_release_from_dev_coherent(dev, order, vaddr) (0)
+#define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
+
+static inline void *dma_alloc_from_global_coherent(struct device *dev,
+               ssize_t size, dma_addr_t *dma_handle)
+{
+       return NULL;
+}
+static inline int dma_release_from_global_coherent(int order, void *vaddr)
+{
+       return 0;
+}
+static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
+               void *cpu_addr, size_t size, int *ret)
+{
+       return 0;
+}
+#endif /* CONFIG_DMA_DECLARE_COHERENT */
+
+#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 /* CONFIG_ARCH_HAS_SETUP_DMA_OPS */
+
+#ifdef CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS
+void arch_teardown_dma_ops(struct device *dev);
+#else
+static inline void arch_teardown_dma_ops(struct device *dev)
+{
+}
+#endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */
+
+extern const struct dma_map_ops dma_dummy_ops;
+
+#endif /* _LINUX_DMA_MAP_OPS_H */
index 7c77cd6f3604a713901246956501652bd02b23be..9591cd482d7c2d3d6d4a22cf0e2945e68796228e 100644 (file)
  */
 #define DMA_ATTR_PRIVILEGED            (1UL << 9)
 
-struct dma_map_ops {
-       void* (*alloc)(struct device *dev, size_t size,
-                               dma_addr_t *dma_handle, gfp_t gfp,
-                               unsigned long attrs);
-       void (*free)(struct device *dev, size_t size,
-                             void *vaddr, dma_addr_t dma_handle,
-                             unsigned long attrs);
-       struct page *(*alloc_pages)(struct device *dev, size_t size,
-                       dma_addr_t *dma_handle, enum dma_data_direction dir,
-                       gfp_t gfp);
-       void (*free_pages)(struct device *dev, size_t size, struct page *vaddr,
-                       dma_addr_t dma_handle, enum dma_data_direction dir);
-       void* (*alloc_noncoherent)(struct device *dev, size_t size,
-                       dma_addr_t *dma_handle, enum dma_data_direction dir,
-                       gfp_t gfp);
-       void (*free_noncoherent)(struct device *dev, size_t size, void *vaddr,
-                       dma_addr_t dma_handle, enum dma_data_direction dir);
-       int (*mmap)(struct device *, struct vm_area_struct *,
-                         void *, dma_addr_t, size_t,
-                         unsigned long attrs);
-
-       int (*get_sgtable)(struct device *dev, struct sg_table *sgt, void *,
-                          dma_addr_t, size_t, unsigned long attrs);
-
-       dma_addr_t (*map_page)(struct device *dev, struct page *page,
-                              unsigned long offset, size_t size,
-                              enum dma_data_direction dir,
-                              unsigned long attrs);
-       void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
-                          size_t size, enum dma_data_direction dir,
-                          unsigned long attrs);
-       /*
-        * map_sg returns 0 on error and a value > 0 on success.
-        * It should never return a value < 0.
-        */
-       int (*map_sg)(struct device *dev, struct scatterlist *sg,
-                     int nents, enum dma_data_direction dir,
-                     unsigned long attrs);
-       void (*unmap_sg)(struct device *dev,
-                        struct scatterlist *sg, int nents,
-                        enum dma_data_direction dir,
-                        unsigned long attrs);
-       dma_addr_t (*map_resource)(struct device *dev, phys_addr_t phys_addr,
-                              size_t size, enum dma_data_direction dir,
-                              unsigned long attrs);
-       void (*unmap_resource)(struct device *dev, dma_addr_t dma_handle,
-                          size_t size, enum dma_data_direction dir,
-                          unsigned long attrs);
-       void (*sync_single_for_cpu)(struct device *dev,
-                                   dma_addr_t dma_handle, size_t size,
-                                   enum dma_data_direction dir);
-       void (*sync_single_for_device)(struct device *dev,
-                                      dma_addr_t dma_handle, size_t size,
-                                      enum dma_data_direction dir);
-       void (*sync_sg_for_cpu)(struct device *dev,
-                               struct scatterlist *sg, int nents,
-                               enum dma_data_direction dir);
-       void (*sync_sg_for_device)(struct device *dev,
-                                  struct scatterlist *sg, int nents,
-                                  enum dma_data_direction dir);
-       int (*dma_supported)(struct device *dev, u64 mask);
-       u64 (*get_required_mask)(struct device *dev);
-       size_t (*max_mapping_size)(struct device *dev);
-       unsigned long (*get_merge_boundary)(struct device *dev);
-};
-
 /*
  * A dma_addr_t can hold any valid DMA or bus address for the platform.  It can
  * be given to a device to use as a DMA source or target.  It is specific to a
@@ -140,79 +74,9 @@ struct dma_map_ops {
  */
 #define DMA_MAPPING_ERROR              (~(dma_addr_t)0)
 
-extern const struct dma_map_ops dma_virt_ops;
-extern const struct dma_map_ops dma_dummy_ops;
-
 #define DMA_BIT_MASK(n)        (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 
-#ifdef CONFIG_DMA_DECLARE_COHERENT
-/*
- * These three functions are only for dma allocator.
- * Don't use them in device drivers.
- */
-int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
-                                      dma_addr_t *dma_handle, void **ret);
-int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr);
-
-int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
-                           void *cpu_addr, size_t size, int *ret);
-
-void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle);
-int dma_release_from_global_coherent(int order, void *vaddr);
-int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
-                                 size_t size, int *ret);
-
-#else
-#define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
-#define dma_release_from_dev_coherent(dev, order, vaddr) (0)
-#define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
-
-static inline void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size,
-                                                  dma_addr_t *dma_handle)
-{
-       return NULL;
-}
-
-static inline int dma_release_from_global_coherent(int order, void *vaddr)
-{
-       return 0;
-}
-
-static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
-                                               void *cpu_addr, size_t size,
-                                               int *ret)
-{
-       return 0;
-}
-#endif /* CONFIG_DMA_DECLARE_COHERENT */
-
 #ifdef CONFIG_HAS_DMA
-#include <asm/dma-mapping.h>
-
-#ifdef CONFIG_DMA_OPS
-static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
-{
-       if (dev->dma_ops)
-               return dev->dma_ops;
-       return get_arch_dma_ops(dev->bus);
-}
-
-static inline void set_dma_ops(struct device *dev,
-                              const struct dma_map_ops *dma_ops)
-{
-       dev->dma_ops = dma_ops;
-}
-#else /* CONFIG_DMA_OPS */
-static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
-{
-       return NULL;
-}
-static inline void set_dma_ops(struct device *dev,
-                              const struct dma_map_ops *dma_ops)
-{
-}
-#endif /* CONFIG_DMA_OPS */
-
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
        debug_dma_mapping_error(dev, dma_addr);
@@ -595,24 +459,6 @@ static inline bool dma_addressing_limited(struct device *dev)
                            dma_get_required_mask(dev);
 }
 
-#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 /* CONFIG_ARCH_HAS_SETUP_DMA_OPS */
-
-#ifdef CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS
-void arch_teardown_dma_ops(struct device *dev);
-#else
-static inline void arch_teardown_dma_ops(struct device *dev)
-{
-}
-#endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */
-
 static inline unsigned int dma_get_max_seg_size(struct device *dev)
 {
        if (dev->dma_parms && dev->dma_parms->max_segment_size)
@@ -672,18 +518,6 @@ static inline int dma_get_cache_alignment(void)
        return 1;
 }
 
-#ifdef CONFIG_DMA_DECLARE_COHERENT
-int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
-                               dma_addr_t device_addr, size_t size);
-#else
-static inline int
-dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
-                           dma_addr_t device_addr, size_t size)
-{
-       return -ENOSYS;
-}
-#endif /* CONFIG_DMA_DECLARE_COHERENT */
-
 static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
                dma_addr_t *dma_handle, gfp_t gfp)
 {
@@ -741,4 +575,6 @@ static inline int dma_mmap_wc(struct device *dev,
 int dma_direct_set_offset(struct device *dev, phys_addr_t cpu_start,
                dma_addr_t dma_start, u64 size);
 
+extern const struct dma_map_ops dma_virt_ops;
+
 #endif /* _LINUX_DMA_MAPPING_H */
index c0685196fb6d4298e7de1184f142a33633dea9ba..5b5b6c7ec7f28e1f1a4b27f4eb25c1322230c458 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 
 struct dma_coherent_mem {
        void            *virt_base;
index 121a9c1969dd3a7bc8f24eae1c42a620338fdcb1..8cf5689a8c40445ec81df2a85fc35142d62bd411 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-contiguous.h>
 #include <linux/pfn.h>
index 6974b1bd7d0b88e2192f06563d5acb228cfb00dc..eacd4c5b10bf6d84b9ea905b1d7beb0fd6605904 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Dummy DMA ops that always fail.
  */
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 
 static int dma_dummy_mmap(struct device *dev, struct vm_area_struct *vma,
                void *cpu_addr, dma_addr_t dma_addr, size_t size,
index 9669550656a0b471976134113288ead29bab82fe..2e13e6d3903fa065c272830e88694bc7f1a6f04f 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/memblock.h> /* for max_pfn */
 #include <linux/acpi.h>
 #include <linux/dma-direct.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/export.h>
 #include <linux/gfp.h>
 #include <linux/of_device.h>
index 5828e5e01b7913bbf93a62ccec9c0634b85bfb65..60d7b6cdfd8d15f75ea163938346ddd8c32cf5a1 100644 (file)
@@ -4,6 +4,7 @@
  * the allocated memory contains normal pages in the direct kernel mapping.
  */
 #include <linux/dma-contiguous.h>
+#include <linux/dma-map-ops.h>
 #include <linux/dma-noncoherent.h>
 
 /*
index 6986bf1fd6689c9bb68249b3d2691f930d445632..59d32317dd574a5635f90bb8460718d0ac374596 100644 (file)
@@ -4,7 +4,7 @@
  */
 #include <linux/export.h>
 #include <linux/mm.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/scatterlist.h>
 
 static void *dma_virt_alloc(struct device *dev, size_t size,