Commit f616ab59 authored by Christoph Hellwig's avatar Christoph Hellwig

dma-mapping: move the NEED_DMA_MAP_STATE config symbol to lib/Kconfig

This way we have one central definition of it, and user can select it as
needed.  Note that we now also always select it when CONFIG_DMA_API_DEBUG
is select, which fixes some incorrect checks in a few network drivers.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAnshuman Khandual <khandual@linux.vnet.ibm.com>
parent 86596f0a
...@@ -10,6 +10,7 @@ config ALPHA ...@@ -10,6 +10,7 @@ config ALPHA
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_PCSPKR_PLATFORM select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
select VIRT_TO_BUS select VIRT_TO_BUS
select GENERIC_IRQ_PROBE select GENERIC_IRQ_PROBE
...@@ -68,9 +69,6 @@ config ZONE_DMA ...@@ -68,9 +69,6 @@ config ZONE_DMA
config ARCH_DMA_ADDR_T_64BIT config ARCH_DMA_ADDR_T_64BIT
def_bool y def_bool y
config NEED_DMA_MAP_STATE
def_bool y
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
bool bool
default y default y
......
...@@ -95,6 +95,7 @@ config ARM ...@@ -95,6 +95,7 @@ config ARM
select HAVE_VIRT_CPU_ACCOUNTING_GEN select HAVE_VIRT_CPU_ACCOUNTING_GEN
select IRQ_FORCED_THREADING select IRQ_FORCED_THREADING
select MODULES_USE_ELF_REL select MODULES_USE_ELF_REL
select NEED_DMA_MAP_STATE
select NO_BOOTMEM select NO_BOOTMEM
select OF_EARLY_FLATTREE if OF select OF_EARLY_FLATTREE if OF
select OF_RESERVED_MEM if OF select OF_RESERVED_MEM if OF
...@@ -220,9 +221,6 @@ config ARCH_MAY_HAVE_PC_FDC ...@@ -220,9 +221,6 @@ config ARCH_MAY_HAVE_PC_FDC
config ZONE_DMA config ZONE_DMA
bool bool
config NEED_DMA_MAP_STATE
def_bool y
config ARCH_SUPPORTS_UPROBES config ARCH_SUPPORTS_UPROBES
def_bool y def_bool y
......
...@@ -132,6 +132,7 @@ config ARM64 ...@@ -132,6 +132,7 @@ config ARM64
select IRQ_FORCED_THREADING select IRQ_FORCED_THREADING
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select MULTI_IRQ_HANDLER select MULTI_IRQ_HANDLER
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
select NO_BOOTMEM select NO_BOOTMEM
select OF select OF
...@@ -240,9 +241,6 @@ config HAVE_GENERIC_GUP ...@@ -240,9 +241,6 @@ config HAVE_GENERIC_GUP
config ARCH_DMA_ADDR_T_64BIT config ARCH_DMA_ADDR_T_64BIT
def_bool y def_bool y
config NEED_DMA_MAP_STATE
def_bool y
config SMP config SMP
def_bool y def_bool y
......
...@@ -53,6 +53,7 @@ config IA64 ...@@ -53,6 +53,7 @@ config IA64
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select ARCH_USE_CMPXCHG_LOCKREF select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
default y default y
help help
...@@ -81,9 +82,6 @@ config MMU ...@@ -81,9 +82,6 @@ config MMU
config ARCH_DMA_ADDR_T_64BIT config ARCH_DMA_ADDR_T_64BIT
def_bool y def_bool y
config NEED_DMA_MAP_STATE
def_bool y
config SWIOTLB config SWIOTLB
bool bool
......
...@@ -1121,9 +1121,6 @@ config DMA_NONCOHERENT ...@@ -1121,9 +1121,6 @@ config DMA_NONCOHERENT
bool bool
select NEED_DMA_MAP_STATE select NEED_DMA_MAP_STATE
config NEED_DMA_MAP_STATE
bool
config SYS_HAS_EARLY_PRINTK config SYS_HAS_EARLY_PRINTK
bool bool
......
...@@ -51,6 +51,7 @@ config PARISC ...@@ -51,6 +51,7 @@ config PARISC
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_NO_COHERENT_DMA_MMAP select ARCH_NO_COHERENT_DMA_MMAP
select CPU_NO_EFFICIENT_FFS select CPU_NO_EFFICIENT_FFS
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
help help
...@@ -112,9 +113,6 @@ config PM ...@@ -112,9 +113,6 @@ config PM
config STACKTRACE_SUPPORT config STACKTRACE_SUPPORT
def_bool y def_bool y
config NEED_DMA_MAP_STATE
def_bool y
config ISA_DMA_API config ISA_DMA_API
bool bool
......
...@@ -710,6 +710,7 @@ menuconfig PCI ...@@ -710,6 +710,7 @@ menuconfig PCI
select PCI_MSI select PCI_MSI
select IOMMU_HELPER select IOMMU_HELPER
select IOMMU_SUPPORT select IOMMU_SUPPORT
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
help help
...@@ -735,9 +736,6 @@ config PCI_DOMAINS ...@@ -735,9 +736,6 @@ config PCI_DOMAINS
config HAS_IOMEM config HAS_IOMEM
def_bool PCI def_bool PCI
config NEED_DMA_MAP_STATE
def_bool PCI
config CHSC_SCH config CHSC_SCH
def_tristate m def_tristate m
prompt "Support for CHSC subchannels" prompt "Support for CHSC subchannels"
......
...@@ -49,6 +49,7 @@ config SUPERH ...@@ -49,6 +49,7 @@ config SUPERH
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_NMI select HAVE_NMI
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
help help
...@@ -161,9 +162,6 @@ config DMA_COHERENT ...@@ -161,9 +162,6 @@ config DMA_COHERENT
config DMA_NONCOHERENT config DMA_NONCOHERENT
def_bool !DMA_COHERENT def_bool !DMA_COHERENT
config NEED_DMA_MAP_STATE
def_bool DMA_NONCOHERENT
config PGTABLE_LEVELS config PGTABLE_LEVELS
default 3 if X2TLB default 3 if X2TLB
default 2 default 2
......
...@@ -43,6 +43,7 @@ config SPARC ...@@ -43,6 +43,7 @@ config SPARC
select ARCH_HAS_SG_CHAIN select ARCH_HAS_SG_CHAIN
select CPU_NO_EFFICIENT_FFS select CPU_NO_EFFICIENT_FFS
select LOCKDEP_SMALL if LOCKDEP select LOCKDEP_SMALL if LOCKDEP
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
config SPARC32 config SPARC32
...@@ -143,9 +144,6 @@ config ZONE_DMA ...@@ -143,9 +144,6 @@ config ZONE_DMA
bool bool
default y if SPARC32 default y if SPARC32
config NEED_DMA_MAP_STATE
def_bool y
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
bool bool
default y if SPARC32 default y if SPARC32
......
...@@ -19,6 +19,7 @@ config UNICORE32 ...@@ -19,6 +19,7 @@ config UNICORE32
select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_FRAME_POINTERS
select GENERIC_IOMAP select GENERIC_IOMAP
select MODULES_USE_ELF_REL select MODULES_USE_ELF_REL
select NEED_DMA_MAP_STATE
help help
UniCore-32 is 32-bit Instruction Set Architecture, UniCore-32 is 32-bit Instruction Set Architecture,
including a series of low-power-consumption RISC chip including a series of low-power-consumption RISC chip
...@@ -61,9 +62,6 @@ config ARCH_MAY_HAVE_PC_FDC ...@@ -61,9 +62,6 @@ config ARCH_MAY_HAVE_PC_FDC
config ZONE_DMA config ZONE_DMA
def_bool y def_bool y
config NEED_DMA_MAP_STATE
def_bool y
source "init/Kconfig" source "init/Kconfig"
source "kernel/Kconfig.freezer" source "kernel/Kconfig.freezer"
......
...@@ -28,6 +28,7 @@ config X86_64 ...@@ -28,6 +28,7 @@ config X86_64
select ARCH_USE_CMPXCHG_LOCKREF select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_SOFT_DIRTY select HAVE_ARCH_SOFT_DIRTY
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select NEED_DMA_MAP_STATE
select X86_DEV_DMA_OPS select X86_DEV_DMA_OPS
select ARCH_HAS_SYSCALL_WRAPPER select ARCH_HAS_SYSCALL_WRAPPER
...@@ -236,10 +237,6 @@ config ARCH_MMAP_RND_COMPAT_BITS_MAX ...@@ -236,10 +237,6 @@ config ARCH_MMAP_RND_COMPAT_BITS_MAX
config SBUS config SBUS
bool bool
config NEED_DMA_MAP_STATE
def_bool y
depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
def_bool y def_bool y
depends on ISA_DMA_API depends on ISA_DMA_API
...@@ -925,6 +922,7 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT ...@@ -925,6 +922,7 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
# need this always selected by IOMMU for the VIA workaround # need this always selected by IOMMU for the VIA workaround
config SWIOTLB config SWIOTLB
def_bool y if X86_64 def_bool y if X86_64
select NEED_DMA_MAP_STATE
---help--- ---help---
Support for software bounce buffers used on x86-64 systems Support for software bounce buffers used on x86-64 systems
which don't have a hardware IOMMU. Using this PCI devices which don't have a hardware IOMMU. Using this PCI devices
......
...@@ -146,6 +146,7 @@ config INTEL_IOMMU ...@@ -146,6 +146,7 @@ config INTEL_IOMMU
select DMA_DIRECT_OPS select DMA_DIRECT_OPS
select IOMMU_API select IOMMU_API
select IOMMU_IOVA select IOMMU_IOVA
select NEED_DMA_MAP_STATE
select DMAR_TABLE select DMAR_TABLE
help help
DMA remapping (DMAR) devices support enables independent address DMA remapping (DMAR) devices support enables independent address
......
...@@ -838,7 +838,7 @@ static inline int dma_mmap_wc(struct device *dev, ...@@ -838,7 +838,7 @@ static inline int dma_mmap_wc(struct device *dev,
#define dma_mmap_writecombine dma_mmap_wc #define dma_mmap_writecombine dma_mmap_wc
#endif #endif
#if defined(CONFIG_NEED_DMA_MAP_STATE) || defined(CONFIG_DMA_API_DEBUG) #ifdef CONFIG_NEED_DMA_MAP_STATE
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) #define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
......
...@@ -432,6 +432,9 @@ config SGL_ALLOC ...@@ -432,6 +432,9 @@ config SGL_ALLOC
config NEED_SG_DMA_LENGTH config NEED_SG_DMA_LENGTH
bool bool
config NEED_DMA_MAP_STATE
bool
config IOMMU_HELPER config IOMMU_HELPER
bool bool
......
...@@ -1634,6 +1634,7 @@ config PROVIDE_OHCI1394_DMA_INIT ...@@ -1634,6 +1634,7 @@ config PROVIDE_OHCI1394_DMA_INIT
config DMA_API_DEBUG config DMA_API_DEBUG
bool "Enable debugging of DMA-API usage" bool "Enable debugging of DMA-API usage"
select NEED_DMA_MAP_STATE
help help
Enable this option to debug the use of the DMA API by device drivers. Enable this option to debug the use of the DMA API by device drivers.
With this option you will be able to detect common bugs in device With this option you will be able to detect common bugs in device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment