1. 06 Jan, 2016 6 commits
  2. 18 Dec, 2015 8 commits
  3. 05 Dec, 2015 16 commits
  4. 16 Nov, 2015 10 commits
    • Julia Lawall's avatar
      dmaengine: ioatdma: constify dca_ops structures · 2bb129eb
      Julia Lawall authored
      The dca_ops structure is never modified, so declare it as const.
      
      Done with the help of Coccinelle.
      Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
      Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      2bb129eb
    • Dave Jiang's avatar
      dmaengine: IOATDMA: Cleanup pre v3.0 chansts register reads · d3cd63f9
      Dave Jiang authored
      Remove pre-3.0 channel status reads. 3.0 and later chansts register
      is 64bit and can be read 64bit. This was clarified with the hardware
      architects and since the driver now only support 3.0+ we don't need the
      legacy support
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      d3cd63f9
    • Robert Jarzmik's avatar
      dmaengine: pxa_dma: declare transfer are reusable · d3651b8e
      Robert Jarzmik authored
      As this driver provides a mechanism to reuse transfers, declare it in
      its probe function.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      d3651b8e
    • Robert Jarzmik's avatar
      dmaengine: enable DMA_CTRL_REUSE · 9eeacd3a
      Robert Jarzmik authored
      In the current state, the capability of transfer reuse can neither be
      set by a slave dmaengine driver, nor used by a client driver, because
      the capability is not available to dma_get_slave_caps().
      
      Fix this by adding a way to declare the capability.
      
      Fixes: 27242021 ("dmaengine: Add DMA_CTRL_REUSE")
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      9eeacd3a
    • Robert Jarzmik's avatar
      dmaengine: virt-dma: don't always free descriptor upon completion · 13bb26ae
      Robert Jarzmik authored
      This patch attempts to enhance the case of a transfer submitted multiple
      times, and where the cost of creating the descriptors chain is not
      negligible.
      
      This happens with big video buffers (several megabytes, ie. several
      thousands of linked descriptors in one scatter-gather list). In these
      cases, a video driver would want to do :
       - tx = dmaengine_prep_slave_sg()
       - dma_engine_submit(tx);
       - dma_async_issue_pending()
       - wait for video completion
       - read video data (or not, skipping a frame is also possible)
       - dma_engine_submit(tx)
         => here, the descriptors chain recalculation will take time
         => the dma coherent allocation over and over might create holes in
            the dma pool, which is counter-productive.
       - dma_async_issue_pending()
       - etc ...
      
      In order to cope with this case, virt-dma is modified to prevent freeing
      the descriptors upon completion if DMA_CTRL_REUSE flag is set in the
      transfer.
      
      This patch is a respin of the former DMA_CTRL_ACK approach, which was
      reverted due to a regression in audio drivers.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      13bb26ae
    • Lars-Peter Clausen's avatar
      ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown · bc0e7345
      Lars-Peter Clausen authored
      Use the new dmaengine_synchronize() function to make sure that all complete
      callbacks have finished running before the runtime data, which is accessed
      in the completed callback, is freed.
      
      This fixes a long standing use-after-free race condition that has been
      observed on some systems.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      bc0e7345
    • Lars-Peter Clausen's avatar
      dmaengine: axi_dmac: Add synchronization support · 860dd64c
      Lars-Peter Clausen authored
      Implement the new device_synchronize() callback to allow proper
      synchronization when stopping a channel. Since the driver already makes
      sure that no new complete callbacks are scheduled after the
      device_terminate_all() callback has been called, all left to do in the
      device_synchronize() callback is to wait for all currently running complete
      callbacks to finish.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      860dd64c
    • Lars-Peter Clausen's avatar
      dmaengine: virt-dma: Add synchronization helper function · 2ed08629
      Lars-Peter Clausen authored
      Add a synchronize helper function for the virt-dma library. The function
      makes sure that any scheduled descriptor complete callbacks have finished
      running before the function returns.
      
      This needs to be called by drivers using virt-dma in their
      device_synchronize() callback. Depending on the driver additional
      operations might be necessary in addition to calling vchan_synchronize() to
      ensure proper synchronization.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      2ed08629
    • Lars-Peter Clausen's avatar
      dmaengine: Add transfer termination synchronization support · b36f09c3
      Lars-Peter Clausen authored
      The DMAengine API has a long standing race condition that is inherent to
      the API itself. Calling dmaengine_terminate_all() is supposed to stop and
      abort any pending or active transfers that have previously been submitted.
      Unfortunately it is possible that this operation races against a currently
      running (or with some drivers also scheduled) completion callback.
      
      Since the API allows dmaengine_terminate_all() to be called from atomic
      context as well as from within a completion callback it is not possible to
      synchronize to the execution of the completion callback from within
      dmaengine_terminate_all() itself.
      
      This means that a user of the DMAengine API does not know when it is safe
      to free resources used in the completion callback, which can result in a
      use-after-free race condition.
      
      This patch addresses the issue by introducing an explicit synchronization
      primitive to the DMAengine API called dmaengine_synchronize().
      
      The existing dmaengine_terminate_all() is deprecated in favor of
      dmaengine_terminate_sync() and dmaengine_terminate_async(). The former
      aborts all pending and active transfers and synchronizes to the current
      context, meaning it will wait until all running completion callbacks have
      finished. This means it is only possible to call this function from
      non-atomic context. The later function does not synchronize, but can still
      be used in atomic context or from within a complete callback. It has to be
      followed up by dmaengine_synchronize() before a client can free the
      resources used in a completion callback.
      
      In addition to this the semantics of the device_terminate_all() callback
      are slightly relaxed by this patch. It is now OK for a driver to only
      schedule the termination of the active transfer, but does not necessarily
      have to wait until the DMA controller has completely stopped. The driver
      must ensure though that the controller has stopped and no longer accesses
      any memory when the device_synchronize() callback returns.
      
      This was in part done since most drivers do not pay attention to this
      anyway at the moment and to emphasize that this needs to be done when the
      device_synchronize() callback is implemented. But it also helps with
      implementing support for devices where stopping the controller can require
      operations that may sleep.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      b36f09c3
    • Linus Torvalds's avatar
      Linux 4.4-rc1 · 8005c49d
      Linus Torvalds authored
      8005c49d