Merge tag 'dma-mapping-4.21' of git://git.infradead.org/users/hch/dma-mapping
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Dec 2018 22:12:21 +0000 (14:12 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Dec 2018 22:12:21 +0000 (14:12 -0800)
Pull DMA mapping updates from Christoph Hellwig:
 "A huge update this time, but a lot of that is just consolidating or
  removing code:

   - provide a common DMA_MAPPING_ERROR definition and avoid indirect
     calls for dma_map_* error checking

   - use direct calls for the DMA direct mapping case, avoiding huge
     retpoline overhead for high performance workloads

   - merge the swiotlb dma_map_ops into dma-direct

   - provide a generic remapping DMA consistent allocator for
     architectures that have devices that perform DMA that is not cache
     coherent. Based on the existing arm64 implementation and also used
     for csky now.

   - improve the dma-debug infrastructure, including dynamic allocation
     of entries (Robin Murphy)

   - default to providing chaining scatterlist everywhere, with opt-outs
     for the few architectures (alpha, parisc, most arm32 variants) that
     can't cope with it

   - misc sparc32 dma-related cleanups

   - remove the dma_mark_clean arch hook used by swiotlb on ia64 and
     replace it with the generic noncoherent infrastructure

   - fix the return type of dma_set_max_seg_size (Niklas Söderlund)

   - move the dummy dma ops for not DMA capable devices from arm64 to
     common code (Robin Murphy)

   - ensure dma_alloc_coherent returns zeroed memory to avoid kernel
     data leaks through userspace. We already did this for most common
     architectures, but this ensures we do it everywhere.
     dma_zalloc_coherent has been deprecated and can hopefully be
     removed after -rc1 with a coccinelle script"

* tag 'dma-mapping-4.21' of git://git.infradead.org/users/hch/dma-mapping: (73 commits)
  dma-mapping: fix inverted logic in dma_supported
  dma-mapping: deprecate dma_zalloc_coherent
  dma-mapping: zero memory returned from dma_alloc_*
  sparc/iommu: fix ->map_sg return value
  sparc/io-unit: fix ->map_sg return value
  arm64: default to the direct mapping in get_arch_dma_ops
  PCI: Remove unused attr variable in pci_dma_configure
  ia64: only select ARCH_HAS_DMA_COHERENT_TO_PFN if swiotlb is enabled
  dma-mapping: bypass indirect calls for dma-direct
  vmd: use the proper dma_* APIs instead of direct methods calls
  dma-direct: merge swiotlb_dma_ops into the dma_direct code
  dma-direct: use dma_direct_map_page to implement dma_direct_map_sg
  dma-direct: improve addressability error reporting
  swiotlb: remove dma_mark_clean
  swiotlb: remove SWIOTLB_MAP_ERROR
  ACPI / scan: Refactor _CCA enforcement
  dma-mapping: factor out dummy DMA ops
  dma-mapping: always build the direct mapping code
  dma-mapping: move dma_cache_sync out of line
  dma-mapping: move various slow path functions out of line
  ...

25 files changed:
1  2 
arch/arc/Kconfig
arch/arc/mm/cache.c
arch/arm/Kconfig
arch/arm/mm/dma-mapping.c
arch/arm64/Kconfig
arch/arm64/mm/dma-mapping.c
arch/mips/Kconfig
arch/parisc/kernel/setup.c
arch/powerpc/Kconfig
arch/powerpc/include/asm/dma-mapping.h
arch/powerpc/include/asm/iommu.h
arch/powerpc/kernel/dma-iommu.c
arch/powerpc/kernel/dma-swiotlb.c
arch/powerpc/kernel/iommu.c
arch/powerpc/platforms/pseries/vio.c
arch/riscv/Kconfig
arch/sparc/include/asm/leon.h
arch/sparc/kernel/iommu.c
arch/x86/Kconfig
drivers/acpi/scan.c
drivers/base/platform.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
include/linux/dma-mapping.h
kernel/dma/direct.c
lib/Kconfig

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index e49b5a0c85853f00df16bacc3593eae3692abead,2993aa9842c090758af3f6d5ddb569c182bafdd9..63183a8454d6f52f8fab4c0ea3783ec9b1875259
@@@ -16,9 -15,7 +16,8 @@@ config MIP
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_EXTABLE_SORT
        select CLONE_BACKWARDS
 +      select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1)
        select CPU_PM if CPU_IDLE
-       select DMA_DIRECT_OPS
        select GENERIC_ATOMIC64 if !64BIT
        select GENERIC_CLOCKEVENTS
        select GENERIC_CMOS_UPDATE
Simple merge
Simple merge
index e847ff69cb2bf1a2af1953d265a7cf5a3fd1ddfc,55312990d1d2de44ae7fcd3c1765319da4e000c6..17524d222a7b6760c2d785d7c314485c544654ae
@@@ -237,10 -233,13 +235,8 @@@ static inline int iommu_add_device(stru
  static inline void iommu_del_device(struct device *dev)
  {
  }
 -
 -static inline int __init tce_iommu_bus_notifier_init(void)
 -{
 -        return 0;
 -}
  #endif /* !CONFIG_IOMMU_API */
  
- int dma_iommu_mapping_error(struct device *dev, dma_addr_t dma_addr);
  #else
  
  static inline void *get_iommu_table_base(struct device *dev)
index 2ca6cfaebf650c04815ff1fe46b31dd0f1a24d50,5ebacf0fe41a13542ac259f2fda179bf05b3b23b..9c9bcaae2f759921569001ad7b4474a5f66faecc
@@@ -120,5 -116,5 +115,4 @@@ struct dma_map_ops dma_iommu_ops = 
        .map_page               = dma_iommu_map_page,
        .unmap_page             = dma_iommu_unmap_page,
        .get_required_mask      = dma_iommu_get_required_mask,
-       .mapping_error          = dma_iommu_mapping_error,
  };
 -EXPORT_SYMBOL(dma_iommu_ops);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 375c77e8d52fa0aa17d4dee12651836fc7981556,79da61b49fa4a33065ff3564eb85da742bf38bf6..355d16acee6dd17aa7998d1ea55a6abcb3e01e92
@@@ -309,38 -373,5 +373,10 @@@ int dma_direct_supported(struct device 
  
        min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT);
  
 -      return mask >= phys_to_dma(dev, min_mask);
 +      /*
 +       * This check needs to be against the actual bit mask value, so
 +       * use __phys_to_dma() here so that the SME encryption mask isn't
 +       * part of the check.
 +       */
 +      return mask >= __phys_to_dma(dev, min_mask);
  }
- int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
- {
-       return dma_addr == DIRECT_MAPPING_ERROR;
- }
- const struct dma_map_ops dma_direct_ops = {
-       .alloc                  = dma_direct_alloc,
-       .free                   = dma_direct_free,
-       .map_page               = dma_direct_map_page,
-       .map_sg                 = dma_direct_map_sg,
- #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE)
-       .sync_single_for_device = dma_direct_sync_single_for_device,
-       .sync_sg_for_device     = dma_direct_sync_sg_for_device,
- #endif
- #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
-     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
-       .sync_single_for_cpu    = dma_direct_sync_single_for_cpu,
-       .sync_sg_for_cpu        = dma_direct_sync_sg_for_cpu,
-       .unmap_page             = dma_direct_unmap_page,
-       .unmap_sg               = dma_direct_unmap_sg,
- #endif
-       .get_required_mask      = dma_direct_get_required_mask,
-       .dma_supported          = dma_direct_supported,
-       .mapping_error          = dma_direct_mapping_error,
-       .cache_sync             = arch_dma_cache_sync,
- };
- EXPORT_SYMBOL(dma_direct_ops);
diff --cc lib/Kconfig
Simple merge