mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
dma-mapping: clearly mark DMA ops as an architecture feature
DMA ops are a helper for architectures and not for drivers to override the DMA implementation. Unfortunately driver authors keep ignoring this. Make the fact more clear by renaming the symbol to ARCH_HAS_DMA_OPS and having the two drivers overriding their dma_ops depend on that. These drivers should probably be marked broken, but we can give them a bit of a grace period for that. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> # for IPU6 Acked-by: Robin Murphy <robin.murphy@arm.com>
This commit is contained in:
parent
92193b3569
commit
de6c85bf91
@ -17,6 +17,15 @@ config CPU_MITIGATIONS
|
||||
def_bool y
|
||||
endif
|
||||
|
||||
#
|
||||
# Selected by architectures that need custom DMA operations for e.g. legacy
|
||||
# IOMMUs not handled by dma-iommu. Drivers must never select this symbol.
|
||||
#
|
||||
config ARCH_HAS_DMA_OPS
|
||||
depends on HAS_DMA
|
||||
select DMA_OPS_HELPERS
|
||||
bool
|
||||
|
||||
menu "General architecture-dependent options"
|
||||
|
||||
config ARCH_HAS_SUBPAGE_FAULTS
|
||||
|
@ -4,12 +4,12 @@ config ALPHA
|
||||
default y
|
||||
select ARCH_32BIT_USTAT_F_TINODE
|
||||
select ARCH_HAS_CURRENT_STACK_POINTER
|
||||
select ARCH_HAS_DMA_OPS if PCI
|
||||
select ARCH_MIGHT_HAVE_PC_PARPORT
|
||||
select ARCH_MIGHT_HAVE_PC_SERIO
|
||||
select ARCH_NO_PREEMPT
|
||||
select ARCH_NO_SG_CHAIN
|
||||
select ARCH_USE_CMPXCHG_LOCKREF
|
||||
select DMA_OPS if PCI
|
||||
select FORCE_PCI
|
||||
select PCI_DOMAINS if PCI
|
||||
select PCI_SYSCALL if PCI
|
||||
|
@ -10,6 +10,7 @@ config ARM
|
||||
select ARCH_HAS_CURRENT_STACK_POINTER
|
||||
select ARCH_HAS_DEBUG_VIRTUAL if MMU
|
||||
select ARCH_HAS_DMA_ALLOC if MMU
|
||||
select ARCH_HAS_DMA_OPS
|
||||
select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
|
||||
select ARCH_HAS_ELF_RANDOMIZE
|
||||
select ARCH_HAS_FORTIFY_SOURCE
|
||||
@ -54,7 +55,6 @@ config ARM
|
||||
select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
select DMA_DECLARE_COHERENT
|
||||
select DMA_GLOBAL_POOL if !MMU
|
||||
select DMA_OPS
|
||||
select DMA_NONCOHERENT_MMAP if MMU
|
||||
select EDAC_SUPPORT
|
||||
select EDAC_ATOMIC_SCRUB
|
||||
|
@ -24,6 +24,7 @@ config ARM64
|
||||
select ARCH_HAS_CURRENT_STACK_POINTER
|
||||
select ARCH_HAS_DEBUG_VIRTUAL
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE
|
||||
select ARCH_HAS_DMA_OPS if XEN
|
||||
select ARCH_HAS_DMA_PREP_COHERENT
|
||||
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
|
||||
select ARCH_HAS_FAST_MULTIPLIER
|
||||
|
@ -8,6 +8,7 @@ config MIPS
|
||||
select ARCH_HAS_CPU_FINALIZE_INIT
|
||||
select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000
|
||||
select ARCH_HAS_DEBUG_VIRTUAL if !64BIT
|
||||
select ARCH_HAS_DMA_OPS if MACH_JAZZ
|
||||
select ARCH_HAS_FORTIFY_SOURCE
|
||||
select ARCH_HAS_KCOV
|
||||
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
|
||||
@ -393,7 +394,6 @@ config MACH_JAZZ
|
||||
select ARC_PROMLIB
|
||||
select ARCH_MIGHT_HAVE_PC_PARPORT
|
||||
select ARCH_MIGHT_HAVE_PC_SERIO
|
||||
select DMA_OPS
|
||||
select FW_ARC
|
||||
select FW_ARC32
|
||||
select ARCH_MAY_HAVE_PC_FDC
|
||||
|
@ -10,6 +10,7 @@ config PARISC
|
||||
select ARCH_WANT_FRAME_POINTERS
|
||||
select ARCH_HAS_CPU_CACHE_ALIASING
|
||||
select ARCH_HAS_DMA_ALLOC if PA11
|
||||
select ARCH_HAS_DMA_OPS
|
||||
select ARCH_HAS_ELF_RANDOMIZE
|
||||
select ARCH_HAS_STRICT_KERNEL_RWX
|
||||
select ARCH_HAS_STRICT_MODULE_RWX
|
||||
@ -23,7 +24,6 @@ config PARISC
|
||||
select ARCH_HAS_CACHE_LINE_SIZE
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE
|
||||
select HAVE_RELIABLE_STACKTRACE
|
||||
select DMA_OPS
|
||||
select RTC_CLASS
|
||||
select RTC_DRV_GENERIC
|
||||
select INIT_ALL_POSSIBLE
|
||||
|
@ -133,6 +133,7 @@ config PPC
|
||||
select ARCH_HAS_DEBUG_WX if STRICT_KERNEL_RWX
|
||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||
select ARCH_HAS_DMA_MAP_DIRECT if PPC_PSERIES
|
||||
select ARCH_HAS_DMA_OPS if PPC64
|
||||
select ARCH_HAS_FORTIFY_SOURCE
|
||||
select ARCH_HAS_GCOV_PROFILE_ALL
|
||||
select ARCH_HAS_KCOV
|
||||
@ -185,7 +186,6 @@ config PPC
|
||||
select CPUMASK_OFFSTACK if NR_CPUS >= 8192
|
||||
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
|
||||
select DMA_OPS_BYPASS if PPC64
|
||||
select DMA_OPS if PPC64
|
||||
select DYNAMIC_FTRACE if FUNCTION_TRACER
|
||||
select EDAC_ATOMIC_SCRUB
|
||||
select EDAC_SUPPORT
|
||||
|
@ -70,6 +70,7 @@ config S390
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE
|
||||
select ARCH_HAS_DEBUG_WX
|
||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||
select ARCH_HAS_DMA_OPS if PCI
|
||||
select ARCH_HAS_ELF_RANDOMIZE
|
||||
select ARCH_HAS_FORCE_DMA_UNENCRYPTED
|
||||
select ARCH_HAS_FORTIFY_SOURCE
|
||||
@ -137,7 +138,6 @@ config S390
|
||||
select BUILDTIME_TABLE_SORT
|
||||
select CLONE_BACKWARDS2
|
||||
select DCACHE_WORD_ACCESS if !KMSAN
|
||||
select DMA_OPS if PCI
|
||||
select DYNAMIC_FTRACE if FUNCTION_TRACER
|
||||
select FUNCTION_ALIGNMENT_8B if CC_IS_GCC
|
||||
select FUNCTION_ALIGNMENT_16B if !CC_IS_GCC
|
||||
|
@ -14,9 +14,9 @@ config SPARC
|
||||
bool
|
||||
default y
|
||||
select ARCH_HAS_CPU_CACHE_ALIASING
|
||||
select ARCH_HAS_DMA_OPS
|
||||
select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
|
||||
select ARCH_MIGHT_HAVE_PC_SERIO
|
||||
select DMA_OPS
|
||||
select OF
|
||||
select OF_PROMTREE
|
||||
select HAVE_ASM_MODVERSIONS
|
||||
|
@ -79,6 +79,7 @@ config X86
|
||||
select ARCH_HAS_DEBUG_VIRTUAL
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE if !X86_PAE
|
||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||
select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
|
||||
select ARCH_HAS_EARLY_DEBUG if KGDB
|
||||
select ARCH_HAS_ELF_RANDOMIZE
|
||||
select ARCH_HAS_FAST_MULTIPLIER
|
||||
@ -943,7 +944,6 @@ config DMI
|
||||
|
||||
config GART_IOMMU
|
||||
bool "Old AMD GART IOMMU support"
|
||||
select DMA_OPS
|
||||
select IOMMU_HELPER
|
||||
select SWIOTLB
|
||||
depends on X86_64 && PCI && AMD_NB
|
||||
|
@ -387,7 +387,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
|
||||
dma_set_max_seg_size(&dev->ofdev.dev, 65536);
|
||||
dma_set_seg_boundary(&dev->ofdev.dev, 0xffffffff);
|
||||
|
||||
#if defined(CONFIG_PCI) && defined(CONFIG_DMA_OPS)
|
||||
#if defined(CONFIG_PCI) && defined(CONFIG_ARCH_HAS_DMA_OPS)
|
||||
/* Set the DMA ops to the ones from the PCI device, this could be
|
||||
* fishy if we didn't know that on PowerMac it's always direct ops
|
||||
* or iommu ops that will work fine
|
||||
@ -396,7 +396,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
|
||||
*/
|
||||
dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata;
|
||||
dev->ofdev.dev.dma_ops = chip->lbus.pdev->dev.dma_ops;
|
||||
#endif /* CONFIG_PCI && CONFIG_DMA_OPS */
|
||||
#endif /* CONFIG_PCI && CONFIG_ARCH_HAS_DMA_OPS */
|
||||
|
||||
#ifdef DEBUG
|
||||
printk("preparing mdev @%p, ofdev @%p, dev @%p, kobj @%p\n",
|
||||
|
@ -4,8 +4,13 @@ config VIDEO_INTEL_IPU6
|
||||
depends on VIDEO_DEV
|
||||
depends on X86 && X86_64 && HAS_DMA
|
||||
depends on IPU_BRIDGE || !IPU_BRIDGE
|
||||
#
|
||||
# This driver incorrectly tries to override the dma_ops. It should
|
||||
# never have done that, but for now keep it working on architectures
|
||||
# that use dma ops
|
||||
#
|
||||
depends on ARCH_HAS_DMA_OPS
|
||||
select AUXILIARY_BUS
|
||||
select DMA_OPS
|
||||
select IOMMU_IOVA
|
||||
select VIDEO_V4L2_SUBDEV_API
|
||||
select MEDIA_CONTROLLER
|
||||
|
@ -35,7 +35,12 @@ config VDPA_SIM_BLOCK
|
||||
config VDPA_USER
|
||||
tristate "VDUSE (vDPA Device in Userspace) support"
|
||||
depends on EVENTFD && MMU && HAS_DMA
|
||||
select DMA_OPS
|
||||
#
|
||||
# This driver incorrectly tries to override the dma_ops. It should
|
||||
# never have done that, but for now keep it working on architectures
|
||||
# that use dma ops
|
||||
#
|
||||
depends on ARCH_HAS_DMA_OPS
|
||||
select VHOST_IOTLB
|
||||
select IOMMU_IOVA
|
||||
help
|
||||
|
@ -177,8 +177,8 @@ config XEN_GRANT_DMA_ALLOC
|
||||
|
||||
config SWIOTLB_XEN
|
||||
def_bool y
|
||||
depends on ARCH_HAS_DMA_OPS
|
||||
depends on XEN_PV || ARM || ARM64
|
||||
select DMA_OPS
|
||||
select SWIOTLB
|
||||
|
||||
config XEN_PCI_STUB
|
||||
@ -348,10 +348,10 @@ config XEN_GRANT_DMA_IOMMU
|
||||
|
||||
config XEN_GRANT_DMA_OPS
|
||||
bool
|
||||
select DMA_OPS
|
||||
|
||||
config XEN_VIRTIO
|
||||
bool "Xen virtio support"
|
||||
depends on ARCH_HAS_DMA_OPS
|
||||
depends on VIRTIO
|
||||
select XEN_GRANT_DMA_OPS
|
||||
select XEN_GRANT_DMA_IOMMU if OF
|
||||
|
@ -750,7 +750,7 @@ struct device {
|
||||
struct dev_pin_info *pins;
|
||||
#endif
|
||||
struct dev_msi_info msi;
|
||||
#ifdef CONFIG_DMA_OPS
|
||||
#ifdef CONFIG_ARCH_HAS_DMA_OPS
|
||||
const struct dma_map_ops *dma_ops;
|
||||
#endif
|
||||
u64 *dma_mask; /* dma mask (if dma'able device) */
|
||||
|
@ -75,7 +75,7 @@ struct dma_map_ops {
|
||||
unsigned long (*get_merge_boundary)(struct device *dev);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DMA_OPS
|
||||
#ifdef CONFIG_ARCH_HAS_DMA_OPS
|
||||
#include <asm/dma-mapping.h>
|
||||
|
||||
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
|
||||
@ -90,7 +90,7 @@ static inline void set_dma_ops(struct device *dev,
|
||||
{
|
||||
dev->dma_ops = dma_ops;
|
||||
}
|
||||
#else /* CONFIG_DMA_OPS */
|
||||
#else /* CONFIG_ARCH_HAS_DMA_OPS */
|
||||
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
|
||||
{
|
||||
return NULL;
|
||||
@ -99,7 +99,7 @@ static inline void set_dma_ops(struct device *dev,
|
||||
const struct dma_map_ops *dma_ops)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_DMA_OPS */
|
||||
#endif /* CONFIG_ARCH_HAS_DMA_OPS */
|
||||
|
||||
#ifdef CONFIG_DMA_CMA
|
||||
extern struct cma *dma_contiguous_default_area;
|
||||
|
@ -11,11 +11,6 @@ config HAS_DMA
|
||||
config DMA_OPS_HELPERS
|
||||
bool
|
||||
|
||||
config DMA_OPS
|
||||
depends on HAS_DMA
|
||||
select DMA_OPS_HELPERS
|
||||
bool
|
||||
|
||||
#
|
||||
# IOMMU drivers that can bypass the IOMMU code and optionally use the direct
|
||||
# mapping fast path should select this option and set the dma_ops_bypass
|
||||
@ -113,8 +108,8 @@ config DMA_BOUNCE_UNALIGNED_KMALLOC
|
||||
|
||||
config DMA_NEED_SYNC
|
||||
def_bool ARCH_HAS_SYNC_DMA_FOR_DEVICE || ARCH_HAS_SYNC_DMA_FOR_CPU || \
|
||||
ARCH_HAS_SYNC_DMA_FOR_CPU_ALL || DMA_API_DEBUG || DMA_OPS || \
|
||||
SWIOTLB
|
||||
ARCH_HAS_SYNC_DMA_FOR_CPU_ALL || DMA_API_DEBUG || \
|
||||
ARCH_HAS_DMA_OPS || SWIOTLB
|
||||
|
||||
config DMA_RESTRICTED_POOL
|
||||
bool "DMA Restricted Pool"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
obj-$(CONFIG_HAS_DMA) += mapping.o direct.o
|
||||
obj-$(CONFIG_DMA_OPS_HELPERS) += ops_helpers.o
|
||||
obj-$(CONFIG_DMA_OPS) += dummy.o
|
||||
obj-$(CONFIG_ARCH_HAS_DMA_OPS) += dummy.o
|
||||
obj-$(CONFIG_DMA_CMA) += contiguous.o
|
||||
obj-$(CONFIG_DMA_DECLARE_COHERENT) += coherent.o
|
||||
obj-$(CONFIG_DMA_API_DEBUG) += debug.o
|
||||
|
Loading…
Reference in New Issue
Block a user