1. 14 6月, 2018 1 次提交
    • C
      dma-mapping: move all DMA mapping code to kernel/dma · cf65a0f6
      Christoph Hellwig 提交于
      Currently the code is split over various files with dma- prefixes in the
      lib/ and drives/base directories, and the number of files keeps growing.
      Move them into a single directory to keep the code together and remove
      the file name prefixes.  To match the irq infrastructure this directory
      is placed under the kernel/ directory.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      cf65a0f6
  2. 24 5月, 2018 1 次提交
    • R
      dma-debug: check scatterlist segments · 78c47830
      Robin Murphy 提交于
      Drivers/subsystems creating scatterlists for DMA should be taking care
      to respect the scatter-gather limitations of the appropriate device, as
      described by dma_parms. A DMA API implementation cannot feasibly split
      a scatterlist into *more* entries than originally passed, so it is not
      well defined what they should do when given a segment larger than the
      limit they are also required to respect.
      
      Conversely, devices which are less limited than the rather conservative
      defaults, or indeed have no limitations at all (e.g. GPUs with their own
      internal MMU), should be encouraged to set appropriate dma_parms, as
      they may get more efficient DMA mapping performance out of it.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      78c47830
  3. 08 5月, 2018 3 次提交
  4. 23 2月, 2018 1 次提交
  5. 18 11月, 2017 1 次提交
  6. 04 5月, 2017 1 次提交
  7. 24 4月, 2017 1 次提交
  8. 02 3月, 2017 2 次提交
  9. 23 2月, 2017 1 次提交
  10. 01 10月, 2016 1 次提交
  11. 27 9月, 2016 1 次提交
  12. 24 8月, 2016 1 次提交
  13. 27 7月, 2016 1 次提交
  14. 27 5月, 2016 1 次提交
  15. 15 1月, 2016 1 次提交
  16. 17 12月, 2015 1 次提交
    • D
      dma-debug: Fix dma_debug_entry offset calculation · 0354aec1
      Daniel Mentz 提交于
      dma-debug uses struct dma_debug_entry to keep track of dma coherent
      memory allocation requests. The virtual address is converted into a pfn
      and an offset. Previously, the offset was calculated using an incorrect
      bit mask.  As a result, we saw incorrect error messages from dma-debug
      like the following:
      
      "DMA-API: exceeded 7 overlapping mappings of cacheline 0x03e00000"
      
      Cacheline 0x03e00000 does not exist on our platform.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 0abdd7a8 ("dma-debug: introduce debug_dma_assert_idle()")
      Signed-off-by: NDaniel Mentz <danielmentz@google.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0354aec1
  17. 07 11月, 2015 1 次提交
  18. 04 10月, 2015 1 次提交
  19. 18 7月, 2015 1 次提交
    • H
      dma-debug: skip debug_dma_assert_idle() when disabled · c9d120b0
      Haggai Eran 提交于
      If dma-debug is disabled due to a memory error, DMA unmaps do not affect
      the dma_active_cacheline radix tree anymore, and debug_dma_assert_idle()
      can print false warnings.
      
      Disable debug_dma_assert_idle() when dma_debug_disabled() is true.
      Signed-off-by: NHaggai Eran <haggaie@mellanox.com>
      Fixes: 0abdd7a8 ("dma-debug: introduce debug_dma_assert_idle()")
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Vinod Koul <vinod.koul@intel.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c9d120b0
  20. 17 4月, 2015 1 次提交
    • S
      lib/dma-debug: fix bucket_find_contain() · a7a2c02a
      Sebastian Ott 提交于
      bucket_find_contain() will search the bucket list for a dma_debug_entry.
      When the entry isn't found it needs to search other buckets too, since
      only the start address of a dma range is hashed (which might be in a
      different bucket).
      
      A copy of the dma_debug_entry is used to get the previous hash bucket
      but when its list is searched the original dma_debug_entry is to be used
      not its modified copy.
      
      This fixes false "device driver tries to sync DMA memory it has not allocated"
      warnings.
      Signed-off-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a7a2c02a
  21. 11 12月, 2014 2 次提交
    • F
      dma-debug: prevent early callers from crashing · 2ce8e7ed
      Florian Fainelli 提交于
      dma_debug_init() is called by architecture specific code at different
      levels, but typically as a fs_initcall due to the debugfs initialization.
      Some platforms may have early callers of the DMA-API, running prior to the
      fs_initcall() level, which is not much of an issue unless
      CONFIG_DMA_API_DEBUG is set.  When the DMA-API debugging facilities are
      turned on a caller will go through:
      
      debug_dma_map_{single,page}
        -> dma_mapping_error (inline function usually)
          -> debug_dma_mapping_error
            -> get_hash_bucket
      
      Calling get_hash_bucket() returns a valid hash value since we hash on high
      bits of the dma_addr cookie, but we will grab an unitialized spinlock,
      which typically won't crash but produce a warning, the real crash will
      however happen during the bucket list traversal because the list has not
      been initialized yet.
      
      An obvious solution is of course to move some of the offenders to run
      after the fs_initcall level, but since this might not always be an option,
      we add a flag "dma_debug_initialized" which is set to false by default,
      and set to true once dma_debug_init() has had a chance to run.
      
      The dma_debug_disabled() helper function previously introduced just needs
      to check for dma_debug_initialized to allow the caller to proceed or not.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2ce8e7ed
    • F
      dma-debug: introduce dma_debug_disabled · 01ce18b3
      Florian Fainelli 提交于
      Add a helper function which returns whether the DMA debugging API is
      disabled, right now we only check for global_disable, but in order to
      accommodate early callers of the DMA-API, we will check for more
      initialization flags in the next patch.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01ce18b3
  22. 02 9月, 2014 1 次提交
  23. 04 3月, 2014 1 次提交
  24. 30 1月, 2014 1 次提交
  25. 22 1月, 2014 1 次提交
    • D
      dma-debug: introduce debug_dma_assert_idle() · 0abdd7a8
      Dan Williams 提交于
      Record actively mapped pages and provide an api for asserting a given
      page is dma inactive before execution proceeds.  Placing
      debug_dma_assert_idle() in cow_user_page() flagged the violation of the
      dma-api in the NET_DMA implementation (see commit 77873803 "net_dma:
      mark broken").
      
      The implementation includes the capability to count, in a limited way,
      repeat mappings of the same page that occur without an intervening
      unmap.  This 'overlap' counter is limited to the few bits of tag space
      in a radix tree.  This mechanism is added to mitigate false negative
      cases where, for example, a page is dma mapped twice and
      debug_dma_assert_idle() is called after the page is un-mapped once.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Vinod Koul <vinod.koul@intel.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0abdd7a8
  26. 23 3月, 2013 2 次提交
    • A
      dma-debug: update DMA debug API to better handle multiple mappings of a buffer · 96e7d7a1
      Alexander Duyck 提交于
      There were reports of the igb driver unmapping buffers without calling
      dma_mapping_error.  On closer inspection issues were found in the DMA
      debug API and how it handled multiple mappings of the same buffer.
      
      The issue I found is the fact that the debug_dma_mapping_error would
      only set the map_err_type to MAP_ERR_CHECKED in the case that the was
      only one match for device and device address.  However in the case of
      non-IOMMU, multiple addresses existed and as a result it was not setting
      this field once a second mapping was instantiated.  I have resolved this
      by changing the search so that it instead will now set MAP_ERR_CHECKED
      on the first buffer that matches the device and DMA address that is
      currently in the state MAP_ERR_NOT_CHECKED.
      
      A secondary side effect of this patch is that in the case of multiple
      buffers using the same address only the last mapping will have a valid
      map_err_type.  The previous mappings will all end up with map_err_type
      set to MAP_ERR_CHECKED because of the dma_mapping_error call in
      debug_dma_map_page.  However this behavior may be preferable as it means
      you will likely only see one real error per multi-mapped buffer, versus
      the current behavior of multiple false errors mer multi-mapped buffer.
      Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Reviewed-by: NShuah Khan <shuah.khan@hp.com>
      Tested-by: NShuah Khan <shuah.khan@hp.com>
      Cc: Jakub Kicinski <kubakici@wp.pl>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96e7d7a1
    • A
      dma-debug: fix locking bug in check_unmap() · 8d640a51
      Alexander Duyck 提交于
      In check_unmap() it is possible to get into a dead-locked state if
      dma_mapping_error is called.  The problem is that the bucket is locked in
      check_unmap, and locked again by debug_dma_mapping_error which is called
      by dma_mapping_error.  To resolve that we must release the lock on the
      bucket before making the call to dma_mapping_error.
      
      [akpm@linux-foundation.org: restore 80-col trickery to be consistent with the rest of the file]
      Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Reviewed-by: NShuah Khan <shuah.khan@hp.com>
      Tested-by: NShuah Khan <shuah.khan@hp.com>
      Cc: Jakub Kicinski <kubakici@wp.pl>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8d640a51
  27. 17 11月, 2012 1 次提交
  28. 24 10月, 2012 1 次提交
    • S
      dma-debug: New interfaces to debug dma mapping errors · 6c9c6d63
      Shuah Khan 提交于
      Add dma-debug interface debug_dma_mapping_error() to debug
      drivers that fail to check dma mapping errors on addresses
      returned by dma_map_single() and dma_map_page() interfaces.
      This interface clears a flag set by debug_dma_map_page() to
      indicate that dma_mapping_error() has been called by the
      driver. When driver does unmap, debug_dma_unmap() checks the
      flag and if this flag is still set, prints warning message
      that includes call trace that leads up to the unmap. This
      interface can be called from dma_mapping_error() routines to
      enable dma mapping error check debugging.
      
      Tested: Intel iommu and swiotlb (iommu=soft) on x86-64 with
              CONFIG_DMA_API_DEBUG enabled and disabled.
      Signed-off-by: NShuah Khan <shuah.khan@hp.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      6c9c6d63
  29. 20 10月, 2012 1 次提交
  30. 02 10月, 2012 1 次提交
  31. 02 7月, 2012 1 次提交
  32. 12 4月, 2012 1 次提交
  33. 25 1月, 2012 1 次提交
    • A
      Remove useless get_driver()/put_driver() calls · f3ff9247
      Alan Stern 提交于
      As part of the removal of get_driver()/put_driver(), this patch
      (as1512) gets rid of various useless and unnecessary calls in several
      drivers.  In some cases it may be desirable to pin the driver by
      calling try_module_get(), but that can be done later.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      CC: Michael Buesch <m@bues.ch>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f3ff9247
  34. 21 11月, 2011 1 次提交
  35. 01 11月, 2011 1 次提交