05 Aug, 2011

1 commit


04 Aug, 2011

1 commit

  • We could use DEFINE_IDR for statically allocated idr
    that allow us to save a few lines of code.

    And also remove unneeded mutex_init() for dma_list_mutex, as
    dma_list_mutex is initialized automatically by DEFINE_MUTEX().

    Signed-off-by: Axel Lin
    Signed-off-by: Dan Williams

    Axel Lin
     

02 Aug, 2011

1 commit

  • * 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (37 commits)
    Improve slave/cyclic DMA engine documentation
    dmaengine: pl08x: handle the rest of enums in pl08x_width
    DMA: PL08x: cleanup selection of burst size
    DMA: PL08x: avoid recalculating cctl at each prepare
    DMA: PL08x: cleanup selection of buswidth
    DMA: PL08x: constify plchan->cd and plat->slave_channels
    DMA: PL08x: separately store source/destination cctl
    DMA: PL08x: separately store source/destination slave address
    DMA: PL08x: clean up LLI debugging
    DMA: PL08x: select LLI bus only once per LLI setup
    DMA: PL08x: remove unused constants
    ARM: mxs-dma: reset after disable channel
    dma: intel_mid_dma: remove redundant pci_set_drvdata calls
    dma: mxs-dma: fix unterminated platform_device_id table
    dmaengine: pl330: make platform data optional
    dmaengine: imx-sdma: return proper error if kzalloc fails
    pch_dma: Fix CTL register access issue
    dmaengine: mxs-dma: skip request_irq for NO_IRQ
    dmaengine/coh901318: fix slave submission semantics
    dmaengine/ste_dma40: allow memory buswidth/burst to be configured
    ...

    Fix trivial whitespace conflict in drivers/dma/mv_xor.c

    Linus Torvalds
     

24 Jun, 2011

1 commit

  • There exist systems with multiple DMA controllers with different
    capabilities. For example, on some sh-mobile / rmobile systems there are
    DMA controllers, whose channels can be configured to be used with
    SD- and MMC-host controllers, serial ports etc. Besides there are also
    DMA controllers, that can only be used for one special function, e.g.,
    for USB. In such cases the DMA client filter function can just choose
    to specify to the DMA driver, which channel it needs. Then the
    .device_alloc_chan_resources() method of the DMA driver will check,
    whether it can provide that dunction. If not, it will fail and the loop
    in __dma_request_channel() will continue to the next DMA device, until
    it finds a suitable one. This works fine with just one minor glitch:
    the kernel logs error messages like

    dmaengine: failed to get : (-)

    after each such non-critical failure. This patch lowers priority of
    this message to the debug level.

    Reported-by: Kuninori Morimoto
    Signed-off-by: Guennadi Liakhovetski
    Tested-by: Kuninori Morimoto
    Tested-by: Magnus Damm
    Signed-off-by: Vinod Koul

    Guennadi Liakhovetski
     

22 Jun, 2011

1 commit

  • Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually).

    To prevent mm.h inclusion via other channels also extract "enum dma_data_direction"
    definition into separate header. This tiny piece is what gluing netdevice.h with mm.h
    via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h".
    Removal of mm.h from scatterlist.h was tried and was found not feasible
    on most archs, so the link was cutoff earlier.

    Hope people are OK with tiny include file.

    Note, that mm_types.h is still dragged in, but it is a separate story.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

08 Oct, 2010

3 commits


06 Oct, 2010

1 commit

  • Cyclic transfers are useful for audio where a single buffer divided
    in periods has to be transfered endlessly until stopped. After being
    prepared the transfer is started using the dma_async_descriptor->tx_submit
    function. dma_async_descriptor->callback is called after each period.
    The transfer is stopped using the DMA_TERMINATE_ALL callback.
    While being used for cyclic transfers the channel cannot be used
    for other transfer types.

    Signed-off-by: Sascha Hauer
    Cc: Haavard Skinnemoen
    Signed-off-by: Dan Williams

    Sascha Hauer
     

18 May, 2010

2 commits


17 May, 2010

1 commit

  • The member 'private' of 'struct dma_chan' is meant for passing
    data between client and the controller driver.

    The DMA client driver may point it to platform specific stuff after
    acquiring the channel. So, it is the responsiblity of the same code
    to reset it, if it must.

    The DMA engine doesn't set it and hence, shouldn't reset it either.

    This reseting of private by DMA Engine comes in the way of implementing
    default channel settings during DMAC probe. That capability is useful
    for not having the clients to always provide platform specific data,
    like Rx/Tx FIFO addresses, which usually doesn't change across channel
    requests.

    Signed-off-by: Jassi Brar
    Signed-off-by: Dan Williams

    Jassi Brar
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

27 Mar, 2010

2 commits

  • Convert the device_is_tx_complete() operation on the
    DMA engine to a generic device_tx_status()operation which
    can return three states, DMA_TX_RUNNING, DMA_TX_COMPLETE,
    DMA_TX_PAUSED.

    [dan.j.williams@intel.com: update for timberdale]
    Signed-off-by: Linus Walleij
    Acked-by: Mark Brown
    Cc: Maciej Sosnowski
    Cc: Nicolas Ferre
    Cc: Pavel Machek
    Cc: Li Yang
    Cc: Guennadi Liakhovetski
    Cc: Paul Mundt
    Cc: Ralf Baechle
    Cc: Haavard Skinnemoen
    Cc: Magnus Damm
    Cc: Liam Girdwood
    Cc: Joe Perches
    Cc: Roland Dreier
    Signed-off-by: Dan Williams

    Linus Walleij
     
  • Convert the device_terminate_all() operation on the
    DMA engine to a generic device_control() operation
    which can now optionally support also pausing and
    resuming DMA on a certain channel. Implemented for the
    COH 901 318 DMAC as an example.

    [dan.j.williams@intel.com: update for timberdale]
    Signed-off-by: Linus Walleij
    Acked-by: Mark Brown
    Cc: Maciej Sosnowski
    Cc: Nicolas Ferre
    Cc: Pavel Machek
    Cc: Li Yang
    Cc: Guennadi Liakhovetski
    Cc: Paul Mundt
    Cc: Ralf Baechle
    Cc: Haavard Skinnemoen
    Cc: Magnus Damm
    Cc: Liam Girdwood
    Cc: Joe Perches
    Cc: Roland Dreier
    Signed-off-by: Dan Williams

    Linus Walleij
     

03 Mar, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
    percpu: add __percpu sparse annotations to what's left
    percpu: add __percpu sparse annotations to fs
    percpu: add __percpu sparse annotations to core kernel subsystems
    local_t: Remove leftover local.h
    this_cpu: Remove pageset_notifier
    this_cpu: Page allocator conversion
    percpu, x86: Generic inc / dec percpu instructions
    local_t: Move local.h include to ringbuffer.c and ring_buffer_benchmark.c
    module: Use this_cpu_xx to dynamically allocate counters
    local_t: Remove cpu_local_xx macros
    percpu: refactor the code in pcpu_[de]populate_chunk()
    percpu: remove compile warnings caused by __verify_pcpu_ptr()
    percpu: make accessors check for percpu pointer in sparse
    percpu: add __percpu for sparse.
    percpu: make access macros universal
    percpu: remove per_cpu__ prefix.

    Linus Torvalds
     

17 Feb, 2010

1 commit

  • Add __percpu sparse annotations to places which didn't make it in one
    of the previous patches. All converions are trivial.

    These annotations are to make sparse consider percpu variables to be
    in a different address space and warn if accessed without going
    through percpu accessors. This patch doesn't affect normal builds.

    Signed-off-by: Tejun Heo
    Acked-by: Borislav Petkov
    Cc: Dan Williams
    Cc: Huang Ying
    Cc: Len Brown
    Cc: Neil Brown

    Tejun Heo
     

03 Feb, 2010

1 commit


15 Dec, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (34 commits)
    m68k: rename global variable vmalloc_end to m68k_vmalloc_end
    percpu: add missing per_cpu_ptr_to_phys() definition for UP
    percpu: Fix kdump failure if booted with percpu_alloc=page
    percpu: make misc percpu symbols unique
    percpu: make percpu symbols in ia64 unique
    percpu: make percpu symbols in powerpc unique
    percpu: make percpu symbols in x86 unique
    percpu: make percpu symbols in xen unique
    percpu: make percpu symbols in cpufreq unique
    percpu: make percpu symbols in oprofile unique
    percpu: make percpu symbols in tracer unique
    percpu: make percpu symbols under kernel/ and mm/ unique
    percpu: remove some sparse warnings
    percpu: make alloc_percpu() handle array types
    vmalloc: fix use of non-existent percpu variable in put_cpu_var()
    this_cpu: Use this_cpu_xx in trace_functions_graph.c
    this_cpu: Use this_cpu_xx for ftrace
    this_cpu: Use this_cpu_xx in nmi handling
    this_cpu: Use this_cpu operations in RCU
    this_cpu: Use this_cpu ops for VM statistics
    ...

    Fix up trivial (famous last words) global per-cpu naming conflicts in
    arch/x86/kvm/svm.c
    mm/slab.c

    Linus Torvalds
     

20 Nov, 2009

2 commits


03 Oct, 2009

1 commit

  • There are cases where we can use this_cpu_ptr and as the result
    of using this_cpu_ptr() we no longer need to determine the
    currently executing cpu.

    In those places no get/put_cpu combination is needed anymore.
    The local cpu variable can be eliminated.

    Preemption still needs to be disabled and enabled since the
    modifications of the per cpu variables is not atomic. There may
    be multiple per cpu variables modified and those must all
    be from the same processor.

    Acked-by: Maciej Sosnowski
    Acked-by: Dan Williams
    Acked-by: Tejun Heo
    cc: Eric Biederman
    cc: Stephen Hemminger
    cc: David L Stevens
    Signed-off-by: Christoph Lameter
    Signed-off-by: Tejun Heo

    Christoph Lameter
     

09 Sep, 2009

4 commits

  • Conflicts:
    crypto/async_tx/async_xor.c
    drivers/dma/ioat/dma_v2.h
    drivers/dma/ioat/pci.c
    drivers/md/raid5.c

    Dan Williams
     
  • The tx_list attribute of struct dma_async_tx_descriptor is common to
    most, but not all dma driver implementations. None of the upper level
    code (dmaengine/async_tx) uses it, so allow drivers to implement it
    locally if they need it. This saves sizeof(struct list_head) bytes for
    drivers that do not manage descriptors with a linked list (e.g.: ioatdma
    v2,3).

    Signed-off-by: Dan Williams

    Dan Williams
     
  • Channel switching is problematic for some dmaengine drivers as the
    architecture precludes separating the ->prep from ->submit. In these
    cases the driver can select ASYNC_TX_DISABLE_CHANNEL_SWITCH to modify
    the async_tx allocator to only return channels that support all of the
    required asynchronous operations.

    For example MD_RAID456=y selects support for asynchronous xor, xor
    validate, pq, pq validate, and memcpy. When
    ASYNC_TX_DISABLE_CHANNEL_SWITCH=y any channel with all these
    capabilities is marked DMA_ASYNC_TX allowing async_tx_find_channel() to
    quickly locate compatible channels with the guarantee that dependency
    chains will remain on one channel. When
    ASYNC_TX_DISABLE_CHANNEL_SWITCH=n async_tx_find_channel() may select
    channels that lead to operation chains that need to cross channel
    boundaries using the async_tx channel switch capability.

    Signed-off-by: Dan Williams

    Dan Williams
     
  • Conflicts:
    include/linux/dmaengine.h

    Dan Williams
     

30 Aug, 2009

2 commits

  • [ Based on an original patch by Yuri Tikhonov ]

    This adds support for doing asynchronous GF multiplication by adding
    two additional functions to the async_tx API:

    async_gen_syndrome() does simultaneous XOR and Galois field
    multiplication of sources.

    async_syndrome_val() validates the given source buffers against known P
    and Q values.

    When a request is made to run async_pq against more than the hardware
    maximum number of supported sources we need to reuse the previous
    generated P and Q values as sources into the next operation. Care must
    be taken to remove Q from P' and P from Q'. For example to perform a 5
    source pq op with hardware that only supports 4 sources at a time the
    following approach is taken:

    p, q = PQ(src0, src1, src2, src3, COEF({01}, {02}, {04}, {08}))
    p', q' = PQ(p, q, q, src4, COEF({00}, {01}, {00}, {10}))

    p' = p + q + q + src4 = p + src4
    q' = {00}*p + {01}*q + {00}*q + {10}*src4 = q + {10}*src4

    Note: 4 is the minimum acceptable maxpq otherwise we punt to
    synchronous-software path.

    The DMA_PREP_CONTINUE flag indicates to the driver to reuse p and q as
    sources (in the above manner) and fill the remaining slots up to maxpq
    with the new sources/coefficients.

    Note1: Some devices have native support for P+Q continuation and can skip
    this extra work. Devices with this capability can advertise it with
    dma_set_maxpq. It is up to each driver how to handle the
    DMA_PREP_CONTINUE flag.

    Note2: The api supports disabling the generation of P when generating Q,
    this is ignored by the synchronous path but is implemented by some dma
    devices to save unnecessary writes. In this case the continuation
    algorithm is simplified to only reuse Q as a source.

    Cc: H. Peter Anvin
    Cc: David Woodhouse
    Signed-off-by: Yuri Tikhonov
    Signed-off-by: Ilya Yanok
    Reviewed-by: Andre Noll
    Acked-by: Maciej Sosnowski
    Signed-off-by: Dan Williams

    Dan Williams
     
  • We currently walk the parent chain when waiting for a given tx to
    complete however this walk may race with the driver cleanup routine.
    The routines in async_raid6_recov.c may fall back to the synchronous
    path at any point so we need to be prepared to call async_tx_quiesce()
    (which calls dma_wait_for_async_tx). To remove the ->parent walk we
    guarantee that every time a dependency is attached ->issue_pending() is
    invoked, then we can simply poll the initial descriptor until
    completion.

    This also allows for a lighter weight 'issue pending' implementation as
    there is no longer a requirement to iterate through all the channels'
    ->issue_pending() routines as long as operations have been submitted in
    an ordered chain. async_tx_issue_pending() is added for this case.

    Signed-off-by: Dan Williams

    Dan Williams
     

13 May, 2009

1 commit

  • as reported by Alexander Beregalov

    ioatdma 0000:00:08.0: DMA-API: device driver frees DMA memory with
    wrong function [device address=0x000000007f76f800] [size=2000 bytes]
    [map
    ped as single] [unmapped as page]

    The ioatdma driver was unmapping all regions
    (either allocated as page or single) using unmap_page.
    This patch lets dma driver recognize if unmap_single or unmap_page should be used.
    It introduces two new dma control flags:
    DMA_COMPL_SRC_UNMAP_SINGLE and DMA_COMPL_DEST_UNMAP_SINGLE.
    They should be set to indicate dma driver to do dma-unmapping as single
    (first one for the source, tha latter for the destination).
    If respective flag is not set, the driver assumes dma-unmapping as page.

    Signed-off-by: Maciej Sosnowski
    Reported-by: Alexander Beregalov
    Tested-by: Alexander Beregalov
    Signed-off-by: Dan Williams

    Maciej Sosnowski
     

09 Apr, 2009

1 commit

  • 'zero_sum' does not properly describe the operation of generating parity
    and checking that it validates against an existing buffer. Change the
    name of the operation to 'val' (for 'validate'). This is in
    anticipation of the p+q case where it is a requirement to identify the
    target parity buffers separately from the source buffers, because the
    target parity buffers will not have corresponding pq coefficients.

    Reviewed-by: Andre Noll
    Acked-by: Maciej Sosnowski
    Signed-off-by: Dan Williams

    Dan Williams
     

27 Mar, 2009

1 commit

  • Currently dma_request_channel() set DMA_PRIVATE capability but never
    clear it. So if a public channel was once grabbed by
    dma_request_channel(), the device stay PRIVATE forever. Add
    privatecnt member to dma_device to correctly revert it.

    [lg@denx.de: fix bad usage of 'chan' in dma_async_device_register]
    Signed-off-by: Atsushi Nemoto
    Acked-by: Maciej Sosnowski
    Signed-off-by: Dan Williams

    Atsushi Nemoto
     

26 Mar, 2009

2 commits


19 Feb, 2009

1 commit

  • The conversion of atmel-mci to dma_request_channel missed the
    initialization of the channel dma_slave information. The filter_fn passed
    to dma_request_channel is responsible for initializing the channel's
    private data. This implementation has the additional benefit of enabling
    a generic client-channel data passing mechanism.

    Reviewed-by: Atsushi Nemoto
    Signed-off-by: Dan Williams
    Acked-by: Haavard Skinnemoen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

20 Jan, 2009

1 commit

  • dma_find_channel and dma_issue_pending_all are good places to warn about
    improper api usage. However, warning correctly means synchronizing with
    dma_list_mutex, i.e. too much overhead for these fast-path calls.

    Reported-by: Ingo Molnar
    Signed-off-by: Dan Williams

    Dan Williams
     

13 Jan, 2009

1 commit

  • In dmaengine we track the dependencies between the descriptors
    using the 'next' pointers of the structure. These pointers are
    set to NULL as soon as the corresponding descriptor has been
    submitted to the channel (in dma_run_dependencies()).

    But, the first 'next' in chain is still remaining set, regardless
    the fact, that tx->next has been already submitted. This may lead to
    multiple submissions of the same descriptor. This patch fixes this.

    Actually, some previous implementation of the xxx_run_dependencies()
    function already had this fix in place. The fdb..0eaf3 commit, beside the
    correct things, broke this.

    Cc:
    Signed-off-by: Yuri Tikhonov
    Signed-off-by: Dan Williams

    Yuri Tikhonov
     

07 Jan, 2009

4 commits

  • There are dmaengine users that would like to register dma devices at
    subsys_initcall time to ensure channels are available by device_initcall
    time.

    Cc: Maciej Sosnowski
    Cc: Guennadi Liakhovetski
    Cc: Nicolas Ferre
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Allow dma_filter_fn routines to disambiguate multiple channels on a device
    rather than assuming that all channels on a device are equal.

    Cc: Maciej Sosnowski
    Reported-by: Guennadi Liakhovetski
    Signed-off-by: Dan Williams

    Dan Williams
     
  • This brings some predictability to dma device numbers, i.e. an rmmod/insmod
    cycle may now result in /sys/class/dma/dma0chan0 being restored rather than
    /sys/class/dma/dma1chan0 appearing.

    Cc: Maciej Sosnowski
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Resolves:
    WARNING: at drivers/base/core.c:122 device_release+0x4d/0x52()
    Device 'dma0chan0' does not have a release() function, it is broken and must be fixed.

    The dma_chan_dev object is introduced to gear-match sysfs kobject and
    dmaengine channel lifetimes. When a channel is removed access to the
    sysfs entries return -ENODEV until the kobject can be released.

    The bulk of the change is updates to existing code to handle the extra
    layer of indirection between a dma_chan and its struct device.

    Reported-by: Alexander Beregalov
    Acked-by: Stephen Hemminger
    Cc: Haavard Skinnemoen
    Signed-off-by: Dan Williams

    Dan Williams