1. 25 6月, 2019 1 次提交
    • C
      dma-mapping: truncate dma masks to what dma_addr_t can hold · 4a54d16f
      Christoph Hellwig 提交于
      The dma masks in struct device are always 64-bits wide.  But for builds
      using a 32-bit dma_addr_t we need to ensure we don't store an
      unsupportable value.  Before Linux 5.0 this was handled at least by
      the ARM dma mapping code by never allowing to set a larger dma_mask,
      but these days we allow the driver to just set the largest supported
      value and never fall back to a smaller one.  Ensure this always works
      by truncating the value.
      
      Fixes: 9eb9e96e ("Documentation/DMA-API-HOWTO: update dma_mask sections")
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      4a54d16f
  2. 24 4月, 2019 1 次提交
  3. 08 4月, 2019 1 次提交
  4. 07 3月, 2019 1 次提交
  5. 18 2月, 2019 2 次提交
  6. 04 1月, 2019 2 次提交
  7. 21 12月, 2018 1 次提交
  8. 14 12月, 2018 4 次提交
  9. 02 12月, 2018 1 次提交
  10. 20 9月, 2018 2 次提交
    • C
      dma-mapping: support non-coherent devices in dma_common_get_sgtable · 9406a49f
      Christoph Hellwig 提交于
      We can use the arch_dma_coherent_to_pfn hook to provide a ->get_sgtable
      implementation.  Note that this isn't an endorsement of this interface
      (which is a horrible bad idea), but it is required to move arm64 over
      to the generic code without a loss of functionality.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      9406a49f
    • C
      dma-mapping: consolidate the dma mmap implementations · 58b04406
      Christoph Hellwig 提交于
      The only functional differences (modulo a few missing fixes in the arch
      code) is that architectures without coherent caches need a hook to
      convert a virtual or dma address into a pfn, given that we don't have
      the kernel linear mapping available for the otherwise easy virt_to_page
      call.  As a side effect we can support mmap of the per-device coherent
      area even on architectures not providing the callback, and we make
      previous dangerous default methods dma_common_mmap actually save for
      non-coherent architectures by rejecting it without the right helper.
      
      In addition to that we need a hook so that some architectures can
      override the protection bits when mmaping a dma coherent allocations.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
      58b04406
  11. 08 9月, 2018 2 次提交
  12. 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
  13. 03 5月, 2018 1 次提交
  14. 23 4月, 2018 1 次提交
  15. 08 12月, 2017 2 次提交
    • G
      driver core: Remove redundant license text · 32825709
      Greg Kroah-Hartman 提交于
      Now that the SPDX tag is in all driver core files, that identifies the
      license in a specific and legally-defined manner.  So the extra GPL text
      wording can be removed as it is no longer needed at all.
      
      This is done on a quest to remove the 700+ different ways that files in
      the kernel describe the GPL license text.  And there's unneeded stuff
      like the address (sometimes incorrect) for the FSF which is never
      needed.
      
      No copyright headers or other non-license-description text was removed.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32825709
    • G
      driver core: add SPDX identifiers to all driver core files · 989d42e8
      Greg Kroah-Hartman 提交于
      It's good to have SPDX identifiers in all files to make it easier to
      audit the kernel tree for correct licenses.
      
      Update the driver core files files with the correct SPDX license
      identifier based on the license text in the file itself.  The SPDX
      identifier is a legally binding shorthand, which can be used instead of
      the full boiler plate text.
      
      This work is based on a script and data from Thomas Gleixner, Philippe
      Ombredanne, and Kate Stewart.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      989d42e8
  16. 01 9月, 2017 1 次提交
  17. 20 7月, 2017 1 次提交
  18. 01 7月, 2017 1 次提交
    • V
      drivers: dma-mapping: allow dma_common_mmap() for NOMMU · 07c75d7a
      Vladimir Murzin 提交于
      Currently, internals of dma_common_mmap() is compiled out if build is
      done for either NOMMU or target which explicitly says it does not
      have/want coherent DMA mmap. It turned out that dma_common_mmap() can
      be handy in NOMMU setup (at least for ARM).
      
      This patch converts exitent NOMMU targets to use ARCH_NO_COHERENT_DMA_MMAP,
      thus when CONFIG_MMU is gone from dma_common_mmap() their behaviour stays
      unchanged.
      
      ARM is not converted to ARCH_NO_COHERENT_DMA_MMAP because it 1)
      already has mmap callback which can handle (at some extent) NOMMU 2)
      already defines dummy pgprot_noncached() for NOMMU build.
      
      c6x and frv stay untouched since they already have ARCH_NO_COHERENT_DMA_MMAP.
      
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NVladimir Murzin <vladimir.murzin@arm.com>
      Tested-by: NBenjamin Gaignard <benjamin.gaignard@linaro.org>
      07c75d7a
  19. 28 6月, 2017 2 次提交
  20. 03 6月, 2017 1 次提交
  21. 20 4月, 2017 3 次提交
  22. 09 4月, 2017 1 次提交
  23. 30 11月, 2016 1 次提交
  24. 31 8月, 2016 3 次提交
    • V
      drivers/base dmam_declare_coherent_memory leaks · 775115c0
      Vyacheslav V. Yurkov 提交于
      dmam_declare_coherent_memory doesn't take into account the return
      value of dma_declare_coherent_memory, which leads to incorrect resource
      handling
      Signed-off-by: NVyacheslav V. Yurkov <uvv.mail@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      775115c0
    • M
      dma-mapping: use vma_pages(). · 95da00e3
      Muhammad Falak R Wani 提交于
      Replace explicit computation of vma page count by a call to
      vma_pages()
      Signed-off-by: NMuhammad Falak R Wani <falakreyaz@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95da00e3
    • P
      drivers: base: dma-mapping: page align the size when unmap_kernel_range · 85714108
      Peng Fan 提交于
      When dma_common_free_remap, the input parameter 'size' may not
      be page aligned. And, met kernel warning when doing iommu dma
      for usb on i.MX8 platform:
      "
      WARNING: CPU: 0 PID: 869 at mm/vmalloc.c:70 vunmap_page_range+0x1cc/0x1d0()
      Modules linked in:
      CPU: 0 PID: 869 Comm: kworker/u8:2 Not tainted 4.1.12-00444-gc5f9d1d-dirty #147
      Hardware name: Freescale i.MX8DV Sabreauto (DT)
      Workqueue: ci_otg ci_otg_work
      Call trace:
      [<ffffffc000089920>] dump_backtrace+0x0/0x124
      [<ffffffc000089a54>] show_stack+0x10/0x1c
      [<ffffffc0006d1e6c>] dump_stack+0x84/0xc8
      [<ffffffc0000b4568>] warn_slowpath_common+0x98/0xd0
      [<ffffffc0000b4664>] warn_slowpath_null+0x14/0x20
      [<ffffffc000170348>] vunmap_page_range+0x1c8/0x1d0
      [<ffffffc000170388>] unmap_kernel_range+0x20/0x88
      [<ffffffc000460ad0>] dma_common_free_remap+0x74/0x84
      [<ffffffc0000940d8>] __iommu_free_attrs+0x9c/0x178
      [<ffffffc0005032bc>] ehci_mem_cleanup+0x140/0x194
      [<ffffffc000503548>] ehci_stop+0x8c/0xdc
      [<ffffffc0004e8258>] usb_remove_hcd+0xf0/0x1cc
      [<ffffffc000516bc0>] host_stop+0x1c/0x58
      [<ffffffc000514240>] ci_otg_work+0xdc/0x120
      [<ffffffc0000c9c34>] process_one_work+0x134/0x33c
      [<ffffffc0000c9f78>] worker_thread+0x13c/0x47c
      [<ffffffc0000cf43c>] kthread+0xd8/0xf0
      "
      
      For dma_common_pages_remap:
      dma_common_pages_remap
         |->get_vm_area_caller
              |->__get_vm_area_node
                  |->size = PAGE_ALIGN(size);   Round up to page aligned
      
      So, in dma_common_free_remap, we also need a page aligned size,
      pass 'PAGE_ALIGN(size)' to unmap_kernel_range.
      Signed-off-by: NPeng Fan <van.freenix@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85714108
  25. 21 1月, 2016 2 次提交
    • C
      dma-mapping: remove <asm-generic/dma-coherent.h> · 20d666e4
      Christoph Hellwig 提交于
      This wasn't an asm-generic header to start with, and can be merged into
      dma-mapping.h trivially.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Helge Deller <deller@gmx.de>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      20d666e4
    • C
      dma-mapping: make the generic coherent dma mmap implementation optional · 0d4a619b
      Christoph Hellwig 提交于
      This series converts all remaining architectures to use dma_map_ops and
      the generic implementation of the DMA API.  This not only simplifies the
      code a lot, but also prepares for possible future changes like more
      generic non-iommu dma_ops implementations or generic per-device
      dma_map_ops.
      
      This patch (of 16):
      
      We have a couple architectures that do not want to support this code, so
      add another Kconfig symbol that disables the code similar to what we do
      for the nommu case.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0d4a619b
  26. 25 3月, 2015 1 次提交