16 Nov, 2013

1 commit

  • Pull dmaengine changes from Dan

    1/ Bartlomiej and Dan finalized a rework of the dma address unmap
    implementation.

    2/ In the course of testing 1/ a collection of enhancements to dmatest
    fell out. Notably basic performance statistics, and fixed / enhanced
    test control through new module parameters 'run', 'wait', 'noverify',
    and 'verbose'. Thanks to Andriy and Linus for their review.

    3/ Testing the raid related corner cases of 1/ triggered bugs in the
    recently added 16-source operation support in the ioatdma driver.

    4/ Some minor fixes / cleanups to mv_xor and ioatdma.

    Conflicts:
    drivers/dma/dmatest.c

    Signed-off-by: Vinod Koul

    Vinod Koul
     

15 Nov, 2013

29 commits

  • Despite requesting two memory resources, called 'base' and 'high_base', the
    driver uses explicitly only the former. The latter is being used implicitly
    by addressing at offset +0x200, which in practice accesses high_base.

    In other words, the current driver breaks if the second memory resource
    is ever place at an offset different from +0x200.

    This patch fixes the above by defining the registers with the offset from
    high_base, and use high_base explicitly where appropriate.

    Signed-off-by: Ezequiel Garcia
    Acked-by: Thomas Petazzoni
    Signed-off-by: Dan Williams

    Ezequiel Garcia
     
  • This mmio address is checked at probe-time, which makes this test
    redundant. Let's just remove it.

    Acked-by: Thomas Petazzoni
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Dan Williams

    Ezequiel Garcia
     
  • The implementation of ioat3_irq_reinit has two bugs:

    1/ The mode is incorrectly set to MSIX for the MSI case

    2/ The 'dev_id' parameter to free_irq is the ioatdma_device not the channel in
    the msi and intx case

    Include a small cleanup to clarify that ioat3_irq_reinit is only for bwd
    hardware

    Cc: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Once we have determined that we will not have all of our desired msix
    vectors there is no point in attempting a single msix allocation. The
    driver will already need to read registers to determine the source of
    the interrupt the fact that it is msix is moot. Fallback directly to
    msi.

    Reported-by: Alexander Gordeev
    Cc: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • With 24 disks and an ioatdma instance with 16 source support there is a
    corner case where the driver needs to be careful to account for the
    number of implied sources in the continuation case.

    Also bump the default case to test more than 16 sources now that it
    triggers different paths in offload drivers.

    Cc: Dave Jiang
    Acked-by: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use a single cache for all sed allocations. No need to make it per
    channel. This also avoids the slub_debug warnings for multiple caches
    with the same name.

    Switching to dmam_pool_create() to fix leaking the dma pools on
    initialization failure and lets us kill ioat3_dma_remove().

    Cc: Dave Jiang
    Acked-by: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • When performing continuations there are implied sources that need to be
    added to the source count. Quoting dma_set_maxpq:

    /* dma_maxpq - reduce maxpq in the face of continued operations
    * @dma - dma device with PQ capability
    * @flags - to check if DMA_PREP_CONTINUE and DMA_PREP_PQ_DISABLE_P are set
    *
    * When an engine does not support native continuation we need 3 extra
    * source slots to reuse P and Q with the following coefficients:
    * 1/ {00} * P : remove P from Q', but use it as a source for P'
    * 2/ {01} * Q : use Q to continue Q' calculation
    * 3/ {00} * Q : subtract Q from P' to cancel (2)
    *
    * In the case where P is disabled we only need 1 extra source:
    * 1/ {01} * Q : use Q to continue Q' calculation
    */

    ...fix the selection of the 16 source path to take these implied sources
    into account.

    Note this also kills the BUG_ON(src_cnt < 9) check in
    __ioat3_prep_pq16_lock(). Besides not accounting for implied sources
    the check is redundant given we already made the path selection.

    Cc:
    Cc: Dave Jiang
    Acked-by: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • The array to lookup the sed pool based on the number of sources
    (pq16_idx_to_sedi) is 16 entries and expects a max source index.
    However, we pass the total source count which runs off the end of the
    array when src_cnt == 16. The minimal fix is to just pass src_cnt-1,
    but given we know the source count is > 8 we can just calculate the sed
    pool by (src_cnt - 2) >> 3.

    Cc: Dave Jiang
    Cc:
    Acked-by: Dave Jiang
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Commit 48a9db4 (3.11) removed the memset op in the xor selftest for ioatdma.
    The issue is that with the removal of that op, it never replaced the memset
    with a CPU memset. The memory being operated on is expected to be zeroes but
    was not. This is causing the xor selftest to fail.

    Cc:
    Signed-off-by: Dave Jiang
    Signed-off-by: Dan Williams

    Dave Jiang
     
  • Verbose mode turns on test success messages, by default we only output
    test summaries and failure results.

    Also cleaned up some stray quotes, leftover from putting the result
    message format string all on one line.

    Cc: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Remove the open coded unmap and add coverage for this core functionality
    to dmatest.

    Also fixes up a couple places where we leaked dma mappings.

    Signed-off-by: Dan Williams

    Dan Williams
     
  • Allows for scripting test runs by module load / unload. Prevent module
    load from returning until 'iterations' (finite) tests have completed, or
    cause reads of the 'wait' parameter in sysfs to pause until the tests
    are done.

    Also killed the local waitqueue since we can just let the thread exit
    naturally as long as we hold a reference.

    Cc: Nicolas Ferre
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Add iops and throughput to the summary output.

    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Towards enabling dmatest to checkout performance add a 'noverify' mode.

    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • There is no need for dmatest to drain the entropy pool.

    It would be nice to one day have repeatable runs, but would need a
    larger rework to synchronize and order calls to the rng across test
    threads.

    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Currently we only test raid channels that happen to also have 'copy'
    capability. Search for capable channels that do not have DMA_MEMCPY.

    Note the return value from run_threaded_test never really made sense
    because it could return errors after successfully starting tests. We
    already have the test results per channel so missing channels can be
    detected at that time.

    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • 1/ move 'run' control to a module parameter so we can do:
    modprobe dmatest run=1. With this moved the rest of the debugfs
    boilerplate can go.

    2/ Fix parameter initialization. Previously the test was being started
    without taking the parameters into account in the built-in case.

    Also killed off the '__' version of some routines. The new rule is just
    hold the lock when calling a *threaded_test() routine.

    Acked-by: Linus Walleij
    Cc: Andy Shevchenko
    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • ...now that we have a common pr_fmt.

    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • For long running tests the tracking results in a memory leak for the "ok"
    results, and for the failures the kernel log should be sufficient. Provide a
    uniform format for error messages so they can be easily parsed and remove the
    debugfs file.

    Cc: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • This reverts commit d86b2f298e6de124984f5d5817ed1e6e759b3ada.

    The kernel log buffer is sufficient for collecting test results. The
    current logging OOMs the machine on long running tests, and usually only
    the first error is relevant. It is better to stop on error and parse
    the kernel output. If output volume becomes an issue we can always
    investigate using trace messages.

    Cc: Andy Shevchenko
    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Remove no longer needed DMA unmap flags:
    - DMA_COMPL_SKIP_SRC_UNMAP
    - DMA_COMPL_SKIP_DEST_UNMAP
    - DMA_COMPL_SRC_UNMAP_SINGLE
    - DMA_COMPL_DEST_UNMAP_SINGLE

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Acked-by: Jon Mason
    Acked-by: Mark Brown
    [djbw: clean up straggling skip unmap flags in ntb]
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     
  • Remove support for DMA unmapping from drivers as it is no longer
    needed (DMA core code is now handling it).

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    [djbw: fix up chan2parent() unused warning in drivers/dma/dw/core.c]
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Acked-by: Jon Mason
    [djbw: fix up unmap len, and GFP flags]
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    [bzolnier: keep temporary dma_dest array in do_async_gen_syndrome()]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    [bzolnier: keep temporary dma_dest array in async_mult()]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    [bzolnier: minor cleanups]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use the generic unmap object to unmap dma buffers.

    Later we can push this unmap object up to the raid layer and get rid of
    the 'scribble' parameter.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    [bzolnier: minor cleanups]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Use the generic unmap object to unmap dma buffers.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Reported-by: Bartlomiej Zolnierkiewicz
    [bzolnier: add missing unmap->len initialization]
    [bzolnier: fix whitespace damage]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    [djbw: add DMA_ENGINE=n support]
    Signed-off-by: Dan Williams

    Dan Williams
     

14 Nov, 2013

4 commits

  • Hang a common 'unmap' object off of dma descriptors for the purpose of
    providing a unified unmapping interface. The lifetime of a mapping may
    span multiple descriptors, so these unmap objects are reference counted
    by related descriptor.

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    [bzolnier: fix IS_ENABLED() check]
    [bzolnier: fix release ordering in dmaengine_destroy_unmap_pool()]
    [bzolnier: fix check for success in dmaengine_init_unmap_pool()]
    [bzolnier: use mempool_free() instead of kmem_cache_free()]
    [bzolnier: add missing unmap->len initializations]
    [bzolnier: add __init tag to dmaengine_init_unmap_pool()]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    [djbw: move DMAENGINE=n support to this patch for async_tx]
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Add a hook for a common dma unmap implementation to enable removal of
    the per driver custom unmap code. (A reworked version of Bartlomiej
    Zolnierkiewicz's patches to remove the custom callbacks and the size
    increase of dma_async_tx_descriptor for drivers that don't care about
    raid).

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    [bzolnier: prepare pl330 driver for adding missing unmap while at it]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Copying from page to page (dma_async_memcpy_pg_to_pg) is the superset,
    make the other two apis use that one in preparation for providing a
    common dma unmap implementation. The common implementation just wants
    to assume all buffers are mapped with dma_map_page().

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Make the driver DMA unmap also source buffers by itself
    (currently it DMA unmaps only destination buffers) as
    a preparation for introducing generic 'ummap' data.

    Cc: Dan Williams
    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Cc: Andy Shevchenko
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Acked-by: Andy Shevchenko
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     

13 Nov, 2013

6 commits

  • On 64 bit systems GCC warns that:

    drivers/dma/pl330.c: In function ‘pl330_filter’:
    drivers/dma/pl330.c:2317:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

    It's harmless and I have casted it away.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Vinod Koul

    Dan Carpenter
     
  • There are only AMBA_NR_IRQS (2) elements in adev->irq[]. This code
    maybe works if the there is a zero directly after the array.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Vinod Koul

    Dan Carpenter
     
  • mxs dma channel hardware reset command is not reliable and can cause
    a channel stall. The only way to fix the channel stall is a DMA engine
    reset.

    To avoid channel resets we use the hardware semaphore counter. For each
    transmitted segment, the DMA channel will decrease the counter by one.
    To use this mechanism with cyclic DMA, we need to increase the semaphore
    counter with each completed DMA command in the interrupt handler. To
    avoid any interruptions between the DMA transfers, the semaphore counter
    is initialized with 2. This way the counter can be increased in the
    interrupt handler without an influence on the transfer of the DMA
    engine.

    When disabling the channel, we stop increasing the semaphore counter in
    the interrupt handler.

    This patch was tested on i.MX28 with the SAIF DMA channel.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Vinod Koul

    Markus Pargmann
     
  • After a channel reset, the channel stops running automatically. The
    state update was missing so that a channel perperation right after a
    channel reset failed.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Vinod Koul

    Markus Pargmann
     
  • This is no official errata, but I noticed that the channel reset may
    stop working if the DMA state engine is in the READ_FLUSH state.

    This patch uses the channel debug1 register to wait for the DMA
    statemachine to leave the READ_FLUSH state. After that we can continue
    to reset the channel.

    Tested on i.MX28.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Vinod Koul

    Markus Pargmann
     
  • Use the channel's buffer address register to calculate correct residue
    value for tx_status.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Vinod Koul

    Markus Pargmann