1. 14 Jul, 2017 1 commit
  2. 05 Jun, 2017 1 commit
  3. 26 Sep, 2016 1 commit
  4. 04 Aug, 2016 1 commit
    • Krzysztof Kozlowski's avatar
      dma-mapping: use unsigned long for dma_attrs · 00085f1e
      Krzysztof Kozlowski authored
      The dma-mapping core and the implementations do not change the DMA
      attributes passed by pointer.  Thus the pointer can point to const data.
      However the attributes do not have to be a bitfield.  Instead unsigned
      long will do fine:
      
      1. This is just simpler.  Both in terms of reading the code and setting
         attributes.  Instead of initializing local attributes on the stack
         and passing pointer to it to dma_set_attr(), just set the bits.
      
      2. It brings safeness and checking for const correctness because the
         attributes are passed by value.
      
      Semantic patches for this change (at least most of them):
      
          virtual patch
          virtual context
      
          @r@
          identifier f, attrs;
      
          @@
          f(...,
          - struct dma_attrs *attrs
          + unsigned long attrs
          , ...)
          {
          ...
          }
      
          @@
          identifier r.f;
          @@
          f(...,
          - NULL
          + 0
           )
      
      and
      
          // Options: --all-includes
          virtual patch
          virtual context
      
          @r@
          identifier f, attrs;
          type t;
      
          @@
          t f(..., struct dma_attrs *attrs);
      
          @@
          identifier r.f;
          @@
          f(...,
          - NULL
          + 0
           )
      
      Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.comSigned-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Acked-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Acked-by: default avatarHans-Christian Noren Egtvedt <egtvedt@samfundet.no>
      Acked-by: Mark Salter <msalter@redhat.com> [c6x]
      Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> [cris]
      Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> [drm]
      Reviewed-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
      Acked-by: Fabien Dessenne <fabien.dessenne@st.com> [bdisp]
      Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> [vb2-core]
      Acked-by: David Vrabel <david.vrabel@citrix.com> [xen]
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [xen swiotlb]
      Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
      Acked-by: Richard Kuo <rkuo@codeaurora.org> [hexagon]
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
      Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> [s390]
      Acked-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> [avr32]
      Acked-by: Vineet Gupta <vgupta@synopsys.com> [arc]
      Acked-by: Robin Murphy <robin.murphy@arm.com> [arm64 and dma-iommu]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      00085f1e
  5. 12 Jan, 2016 1 commit
  6. 09 Nov, 2015 1 commit
  7. 24 Sep, 2015 1 commit
  8. 08 Sep, 2015 1 commit
  9. 29 May, 2015 1 commit
  10. 26 May, 2014 1 commit
  11. 20 May, 2014 2 commits
  12. 17 Sep, 2013 1 commit
  13. 24 Oct, 2012 1 commit
    • Shuah Khan's avatar
      dma-debug: New interfaces to debug dma mapping errors · 6c9c6d63
      Shuah Khan authored
      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: default avatarShuah Khan <shuah.khan@hp.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
      6c9c6d63
  14. 02 Nov, 2011 1 commit
  15. 11 Aug, 2010 1 commit
  16. 12 Mar, 2010 7 commits
  17. 12 Jun, 2009 1 commit
  18. 02 Jun, 2009 1 commit
  19. 17 Mar, 2009 1 commit
  20. 30 Jan, 2009 1 commit
  21. 15 Jan, 2009 1 commit
  22. 02 Dec, 2008 1 commit
  23. 09 Oct, 2008 1 commit
  24. 26 Jul, 2008 1 commit
    • FUJITA Tomonori's avatar
      dma-mapping: add the device argument to dma_mapping_error() · 8d8bb39b
      FUJITA Tomonori authored
      Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
      architecture does:
      
      This enables us to cleanly fix the Calgary IOMMU issue that some devices
      are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).
      
      I think that per-device dma_mapping_ops support would be also helpful for
      KVM people to support PCI passthrough but Andi thinks that this makes it
      difficult to support the PCI passthrough (see the above thread).  So I
      CC'ed this to KVM camp.  Comments are appreciated.
      
      A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
      pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
      NULL, the system-wide dma_ops pointer is used as before.
      
      If it's useful for KVM people, I plan to implement a mechanism to register
      a hook called when a new pci (or dma capable) device is created (it works
      with hot plugging).  It enables IOMMUs to set up an appropriate
      dma_mapping_ops per device.
      
      The major obstacle is that dma_mapping_error doesn't take a pointer to the
      device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
      device.  Note all the POWER IOMMUs use the same dma_mapping_error function
      so this is not a problem for POWER but x86 IOMMUs use different
      dma_mapping_error functions.
      
      The first patch adds the device argument to dma_mapping_error.  The patch
      is trivial but large since it touches lots of drivers and dma-mapping.h in
      all the architecture.
      
      This patch:
      
      dma_mapping_error() doesn't take a pointer to the device unlike other DMA
      operations.  So we can't have dma_mapping_ops per device.
      
      Note that POWER already has dma_mapping_ops per device but all the POWER
      IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
      argument.
      
      [akpm@linux-foundation.org: fix sge]
      [akpm@linux-foundation.org: fix svc_rdma]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix bnx2x]
      [akpm@linux-foundation.org: fix s2io]
      [akpm@linux-foundation.org: fix pasemi_mac]
      [akpm@linux-foundation.org: fix sdhci]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix sparc]
      [akpm@linux-foundation.org: fix ibmvscsi]
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Muli Ben-Yehuda <muli@il.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Avi Kivity <avi@qumranet.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8d8bb39b
  25. 29 Apr, 2008 2 commits
  26. 12 Oct, 2007 1 commit
    • David Brownell's avatar
      dma_free_coherent() needs irqs enabled (sigh) · aa24886e
      David Brownell authored
      On at least ARM (and I'm told MIPS too) dma_free_coherent() has a newish
      call context requirement: unlike its dma_alloc_coherent() sibling, it may
      not be called with IRQs disabled.  (This was new behavior on ARM as of late
      2005, caused by ARM SMP updates.) This little surprise can be annoyingly
      driver-visible.
      
      Since it looks like that restriction won't be removed, this patch changes
      the definition of the API to include that requirement.  Also, to help catch
      nonportable drivers, it updates the x86 and swiotlb versions to include the
      relevant warnings.  (I already observed that it trips on the
      bus_reset_tasklet of the new firewire_ohci driver.)
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: David Miller <davem@davemloft.net>
      Acked-by: default avatarRussell King <rmk@arm.linux.org.uk>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      aa24886e
  27. 31 Jul, 2007 1 commit
  28. 07 Dec, 2006 3 commits
  29. 30 Nov, 2006 1 commit
  30. 14 Apr, 2006 1 commit
    • David Brownell's avatar
      [PATCH] dma doc updates · 21440d31
      David Brownell authored
      This updates the DMA API documentation to address a few issues:
      
       - The dma_map_sg() call results are used like pci_map_sg() results:
         using sg_dma_address() and sg_dma_len().  That's not wholly obvious
         to folk reading _only_ the "new" DMA-API.txt writeup.
      
       - Buffers allocated by dma_alloc_coherent() may not be completely
         free of coherency concerns ... some CPUs also have write buffers
         that may need to be flushed.
      
       - Cacheline coherence issues are now mentioned as being among issues
         which affect dma buffers, and complicate/prevent using of static and
         (especially) stack based buffers with the DMA calls.
      
      I don't think many drivers currently need to worry about flushing write
      buffers, but I did hit it with one SOC using external SDRAM for DMA
      descriptors:  without explicit writebuffer flushing, the on-chip DMA
      controller accessed descriptors before the CPU completed the writes.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      21440d31