Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f72e24a1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'dma-mapping-4.13' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping infrastructure from Christoph Hellwig:
 "This is the first pull request for the new dma-mapping subsystem

  In this new subsystem we'll try to properly maintain all the generic
  code related to dma-mapping, and will further consolidate arch code
  into common helpers.

  This pull request contains:

   - removal of the DMA_ERROR_CODE macro, replacing it with calls to
     ->mapping_error so that the dma_map_ops instances are more self
     contained and can be shared across architectures (me)

   - removal of the ->set_dma_mask method, which duplicates the
     ->dma_capable one in terms of functionality, but requires more
     duplicate code.

   - various updates for the coherent dma pool and related arm code
     (Vladimir)

   - various smaller cleanups (me)"

* tag 'dma-mapping-4.13' of git://git.infradead.org/users/hch/dma-mapping: (56 commits)
  ARM: dma-mapping: Remove traces of NOMMU code
  ARM: NOMMU: Set ARM_DMA_MEM_BUFFERABLE for M-class cpus
  ARM: NOMMU: Introduce dma operations for noMMU
  drivers: dma-mapping: allow dma_common_mmap() for NOMMU
  drivers: dma-coherent: Introduce default DMA pool
  drivers: dma-coherent: Account dma_pfn_offset when used with device tree
  dma: Take into account dma_pfn_offset
  dma-mapping: replace dmam_alloc_noncoherent with dmam_alloc_attrs
  dma-mapping: remove dmam_free_noncoherent
  crypto: qat - avoid an uninitialized variable warning
  au1100fb: remove a bogus dma_free_nonconsistent call
  MAINTAINERS: add entry for dma mapping helpers
  powerpc: merge __dma_set_mask into dma_set_mask
  dma-mapping: remove the set_dma_mask method
  powerpc/cell: use the dma_supported method for ops switching
  powerpc/cell: clean up fixed mapping dma_ops initialization
  tile: remove dma_supported and mapping_error methods
  xen-swiotlb: remove xen_swiotlb_set_dma_mask
  arm: implement ->dma_supported instead of ->set_dma_mask
  mips/loongson64: implement ->dma_supported instead of ->set_dma_mask
  ...
parents 2c669275 1655cf88
Loading
Loading
Loading
Loading
+5 −26
Original line number Diff line number Diff line
@@ -550,32 +550,11 @@ and to unmap it:
	dma_unmap_single(dev, dma_handle, size, direction);

You should call dma_mapping_error() as dma_map_single() could fail and return
error. Not all DMA implementations support the dma_mapping_error() interface.
However, it is a good practice to call dma_mapping_error() interface, which
will invoke the generic mapping error check interface. Doing so will ensure
that the mapping code will work correctly on all DMA implementations without
any dependency on the specifics of the underlying implementation. Using the
returned address without checking for errors could result in failures ranging
from panics to silent data corruption. A couple of examples of incorrect ways
to check for errors that make assumptions about the underlying DMA
implementation are as follows and these are applicable to dma_map_page() as
well.

Incorrect example 1:
	dma_addr_t dma_handle;

	dma_handle = dma_map_single(dev, addr, size, direction);
	if ((dma_handle & 0xffff != 0) || (dma_handle >= 0x1000000)) {
		goto map_error;
	}

Incorrect example 2:
	dma_addr_t dma_handle;

	dma_handle = dma_map_single(dev, addr, size, direction);
	if (dma_handle == DMA_ERROR_CODE) {
		goto map_error;
	}
error.  Doing so will ensure that the mapping code will work correctly on all
DMA implementations without any dependency on the specifics of the underlying
implementation. Using the returned address without checking for errors could
result in failures ranging from panics to silent data corruption.  The same
applies to dma_map_page() as well.

You should call dma_unmap_single() when the DMA activity is finished, e.g.,
from the interrupt which told you that the DMA transfer is done.
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ Linux implementation note:
- If a "linux,cma-default" property is present, then Linux will use the
  region for the default pool of the contiguous memory allocator.

- If a "linux,dma-default" property is present, then Linux will use the
  region for the default pool of the consistent DMA allocator.

Device node references to reserved memory
-----------------------------------------
Regions in the /reserved-memory node may be referenced by other device
+1 −2
Original line number Diff line number Diff line
@@ -240,10 +240,9 @@ CLOCK

DMA
  dmam_alloc_coherent()
  dmam_alloc_noncoherent()
  dmam_alloc_attrs()
  dmam_declare_coherent_memory()
  dmam_free_coherent()
  dmam_free_noncoherent()
  dmam_pool_create()
  dmam_pool_destroy()

+15 −0
Original line number Diff line number Diff line
@@ -2631,6 +2631,21 @@ S: Maintained
F:	net/bluetooth/
F:	include/net/bluetooth/

DMA MAPPING HELPERS
M:	Christoph Hellwig <hch@lst.de>
M:	Marek Szyprowski <m.szyprowski@samsung.com>
R:	Robin Murphy <robin.murphy@arm.com>
L:	linux-kernel@vger.kernel.org
T:	git git://git.infradead.org/users/hch/dma-mapping.git
W:	http://git.infradead.org/users/hch/dma-mapping.git
S:	Supported
F:	lib/dma-debug.c
F:	lib/dma-noop.c
F:	lib/dma-virt.c
F:	drivers/base/dma-mapping.c
F:	drivers/base/dma-coherent.c
F:	include/linux/dma-mapping.h

BONDING DRIVER
M:	Jay Vosburgh <j.vosburgh@gmail.com>
M:	Veaceslav Falico <vfalico@gmail.com>
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ config ARM
	select CLONE_BACKWARDS
	select CPU_PM if (SUSPEND || CPU_IDLE)
	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
	select DMA_NOOP_OPS if !MMU
	select EDAC_SUPPORT
	select EDAC_ATOMIC_SCRUB
	select GENERIC_ALLOCATOR
Loading