1. 06 Nov, 2015 1 commit
    • Robin Murphy's avatar
      dma-mapping: tidy up dma_parms default handling · 002edb6f
      Robin Murphy authored
      Many DMA controllers and other devices set max_segment_size to
      indicate their scatter-gather capability, but have no interest in
      segment_boundary_mask. However, the existence of a dma_parms structure
      precludes the use of any default value, leaving them as zeros (assuming
      a properly kzalloc'ed structure). If a well-behaved IOMMU (or SWIOTLB)
      then tries to respect this by ensuring a mapped segment does not cross
      a zero-byte boundary, hilarity ensues.
      Since zero is a nonsensical value for either parameter, treat it as an
      indicator for "default", as might be expected. In the process, clean up
      a bit by replacing the bare constants with slightly more meaningful
      macros and removing the superfluous "else" statements.
      [akpm@linux-foundation.org: dma-mapping.h needs sizes.h for SZ_64K]
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Reviewed-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Sakari Ailus <sakari.ailus@iki.fi>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  2. 09 Mar, 2015 1 commit
  3. 01 Dec, 2014 2 commits
  4. 25 Aug, 2014 1 commit
  5. 20 May, 2014 2 commits
  6. 07 May, 2014 1 commit
    • Santosh Shilimkar's avatar
      of: configure the platform device dma parameters · 591c1ee4
      Santosh Shilimkar authored
      Retrieve DMA configuration from DT and setup platform device's DMA
      parameters. The DMA configuration in DT has to be specified using
      "dma-ranges" and "dma-coherent" properties if supported.
      We setup dma_pfn_offset using "dma-ranges" and dma_coherent_ops
      using "dma-coherent" device tree properties.
      The set_arch_dma_coherent_ops macro has to be defined by arch if
      it supports coherent dma_ops. Otherwise, set_arch_dma_coherent_ops() is
      declared as nop.
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
  7. 31 Oct, 2013 2 commits
    • Santosh Shilimkar's avatar
      ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function · 00c8f162
      Santosh Shilimkar authored
      Most of the kernel assumes that PFN0 is the start of the physical
      memory (RAM). This assumptions is not true on most of the ARM SOCs
      and hence and if one try to update the ARM port to follow the assumptions,
      we end of breaking the dma bounce limit for few block layer drivers.
      One such example is trying to unify the meaning of max*_pfn on ARM
      as the bootmem layer expects, breaks few block layer driver dma
      bounce limit.
      To fix this problem, we introduce dma_max_pfn(dev) generic helper with
      a possibility of override from the architecture code. The helper converts
      a DMA bitmask of bits to a block PFN number. In all the generic cases,
      it is just  "dev->dma_mask >> PAGE_SHIFT" and hence default behavior
      is maintained as is.
      Subsequent patches will make use of the helper. No functional change.
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    • Russell King's avatar
      DMA-API: provide a helper to setup DMA masks · fa6a8d6d
      Russell King authored
      Many drivers contain code such as:
      	dev->dma_mask = &dev->coherent_dma_mask;
      	dev->coherent_dma_mask = MASK;
      Let's move this pattern out of drivers and have the DMA API provide a
      helper for it.  This helper uses dma_set_mask_and_coherent() to allow
      platform issues to be properly dealt with via dma_set_mask()/
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
  8. 17 Sep, 2013 1 commit
  9. 29 Aug, 2013 1 commit
  10. 30 Jul, 2012 1 commit
    • Marek Szyprowski's avatar
      common: dma-mapping: introduce dma_get_sgtable() function · d2b7428e
      Marek Szyprowski authored
      This patch adds dma_get_sgtable() function which is required to let
      drivers to share the buffers allocated by DMA-mapping subsystem. Right
      now the driver gets a dma address of the allocated buffer and the kernel
      virtual mapping for it. If it wants to share it with other device (= map
      into its dma address space) it usually hacks around kernel virtual
      addresses to get pointers to pages or assumes that both devices share
      the DMA address space. Both solutions are just hacks for the special
      cases, which should be avoided in the final version of buffer sharing.
      To solve this issue in a generic way, a new call to DMA mapping has been
      introduced - dma_get_sgtable(). It allocates a scatter-list which
      describes the allocated buffer and lets the driver(s) to use it with
      other device(s) by calling dma_map_sg() on it.
      This patch provides a generic implementation based on virt_to_page()
      call. Architectures which require more sophisticated translation might
      provide their own get_sgtable() methods.
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Reviewed-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
  11. 28 Mar, 2012 3 commits
  12. 25 Mar, 2012 1 commit
  13. 02 Nov, 2011 1 commit
  14. 19 Sep, 2011 1 commit
  15. 26 Jul, 2011 1 commit
  16. 21 Jun, 2011 1 commit
    • Alexey Dobriyan's avatar
      net: remove mm.h inclusion from netdevice.h · b7f080cf
      Alexey Dobriyan authored
      Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually).
      To prevent mm.h inclusion via other channels also extract "enum dma_data_direction"
      definition into separate header. This tiny piece is what gluing netdevice.h with mm.h
      via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h".
      Removal of mm.h from scatterlist.h was tried and was found not feasible
      on most archs, so the link was cutoff earlier.
      Hope people are OK with tiny include file.
      Note, that mm_types.h is still dragged in, but it is a separate story.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
  17. 22 Sep, 2010 1 commit
  18. 13 Aug, 2010 1 commit
  19. 11 Aug, 2010 1 commit
  20. 27 May, 2010 2 commits
  21. 12 Mar, 2010 2 commits
  22. 27 Aug, 2009 1 commit
  23. 27 Jul, 2009 1 commit
  24. 19 Jun, 2009 2 commits
  25. 07 Apr, 2009 1 commit
  26. 06 Jan, 2009 1 commit
  27. 19 Sep, 2008 1 commit
  28. 14 Sep, 2008 1 commit
  29. 10 Sep, 2008 1 commit
  30. 29 Apr, 2008 1 commit
    • Arthur Kepner's avatar
      dma: add dma_*map*_attrs() interfaces · 74bc7cee
      Arthur Kepner authored
      Introduce new interfaces, dma_*map*_attrs(), for passing architecture-specific
      attributes when memory is mapped and unmapped for DMA.  Give the interfaces
      default implementations which ignore attributes.  Also introduce the
      dma_{set|get}_attr() interfaces for setting and retrieving individual
      attributes.  Define one attribute, DMA_ATTR_WRITE_BARRIER, in anticipation of
      its use by ia64/sn.  Select whether architectures implement arch-specific
      versions of the dma_*map*_attrs() interfaces via HAVE_DMA_ATTRS in Kconfig.
      [markn@au1.ibm.com: dma_{set,get}_attr() have to be static inline]
      Signed-off-by: default avatarArthur Kepner <akepner@sgi.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Jes Sorensen <jes@sgi.com>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Roland Dreier <rdreier@cisco.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Grant Grundler <grundler@parisc-linux.org>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  31. 05 Feb, 2008 2 commits
    • FUJITA Tomonori's avatar
      iommu sg merging: add accessors for segment_boundary_mask in device_dma_parameters() · d22a6966
      FUJITA Tomonori authored
      This adds new accessors for segment_boundary_mask in device_dma_parameters
      structure in the same way I did for max_segment_size.  So we can easily change
      where to place struct device_dma_parameters in the future.
      dma_get_segment boundary returns 0xffffffff if dma_parms in struct device
      isn't set up properly.  0xffffffff is the default value used in the block
      layer and the scsi mid layer.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • FUJITA Tomonori's avatar
      iommu sg merging: add device_dma_parameters structure · 6b7b6510
      FUJITA Tomonori authored
      IOMMUs merges scatter/gather segments without considering a low level
      driver's restrictions. The problem is that IOMMUs can't access to the
      limitations because they are in request_queue.
      This patchset introduces a new structure, device_dma_parameters,
      including dma information. A pointer to device_dma_parameters is added
      to struct device. The bus specific structures (like pci_dev) includes
      device_dma_parameters. Low level drivers can use dma_set_max_seg_size
      to tell IOMMUs about the restrictions.
      We can move more dma stuff in struct device (like dma_mask) to struct
      device_dma_parameters later (needs some cleanups before that).
      This includes patches for all the IOMMUs that could merge sg (x86_64,
      ppc, IA64, alpha, sparc64, and parisc) though only the ppc patch was
      tested. The patches for other IOMMUs are only compile tested.
      This patch:
      Add a new structure, device_dma_parameters, including dma information.  A
      pointer to device_dma_parameters is added to struct device.
      - there are only max_segment_size and segment_boundary_mask there but we'll
        move more dma stuff in struct device (like dma_mask) to struct
        device_dma_parameters later.  segment_boundary_mask is not supported yet.
      - new accessors for the dma parameters are added.  So we can easily change
        where to place struct device_dma_parameters in the future.
      - dma_get_max_seg_size returns 64K if dma_parms in struct device isn't set
        up properly.  64K is the default max_segment_size in the block layer.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Acked-by: default avatarJeff Garzik <jeff@garzik.org>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>