18 Sep, 2020

1 commit

  • In preparation for unconditionally passing the
    struct tasklet_struct pointer to all tasklet
    callbacks, switch to using the new tasklet_setup()
    and from_tasklet() to pass the tasklet pointer explicitly.

    Signed-off-by: Romain Perier
    Signed-off-by: Allen Pais
    Link: https://lore.kernel.org/r/20200831103542.305571-9-allen.lkml@gmail.com
    Signed-off-by: Vinod Koul

    Allen Pais
     

11 Sep, 2020

2 commits


24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

31 Jul, 2019

1 commit

  • Mark switch cases where we are expecting to fall through.

    This patch fixes the following warning (Building: arm):

    drivers/dma/imx-dma.c: In function ‘imxdma_xfer_desc’:
    drivers/dma/imx-dma.c:542:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (slot == IMX_DMA_2D_SLOT_A) {
    ^
    drivers/dma/imx-dma.c:559:2: note: here
    case IMXDMA_DESC_MEMCPY:
    ^~~~

    Notice that, in this particular case, the code comment is
    modified in accordance with what GCC is expecting to find.

    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20190729225221.GA24269@embeddedor
    Reviewed-by: Kees Cook
    Signed-off-by: Vinod Koul

    Gustavo A. R. Silva
     

15 Mar, 2019

1 commit

  • Pull dmaengine updates from Vinod Koul:

    - dmatest updates for modularizing common struct and code

    - remove SG support for VDMA xilinx IP and updates to driver

    - Update to dw driver to support Intel iDMA controllers multi-block
    support

    - tegra updates for proper reporting of residue

    - Add Snow Ridge ioatdma device id and support for IOATDMA v3.4

    - struct_size() usage and useless LIST_HEAD cleanups in subsystem.

    - qDMA controller driver for Layerscape SoCs

    - stm32-dma PM Runtime support

    - And usual updates to imx-sdma, sprd, Documentation, fsl-edma,
    bcm2835, qcom_hidma etc

    * tag 'dmaengine-5.1-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (81 commits)
    dmaengine: imx-sdma: fix consistent dma test failures
    dmaengine: imx-sdma: add a test for imx8mq multi sdma devices
    dmaengine: imx-sdma: add clock ratio 1:1 check
    dmaengine: dmatest: move test data alloc & free into functions
    dmaengine: dmatest: add short-hand `buf_size` var in dmatest_func()
    dmaengine: dmatest: wrap src & dst data into a struct
    dmaengine: ioatdma: support latency tolerance report (LTR) for v3.4
    dmaengine: ioatdma: add descriptor pre-fetch support for v3.4
    dmaengine: ioatdma: disable DCA enabling on IOATDMA v3.4
    dmaengine: ioatdma: Add Snow Ridge ioatdma device id
    dmaengine: sprd: Change channel id to slave id for DMA cell specifier
    dt-bindings: dmaengine: sprd: Change channel id to slave id for DMA cell specifier
    dmaengine: mv_xor: Use correct device for DMA API
    Documentation :dmaengine: clarify DMA desc. pointer after submission
    Documentation: dmaengine: fix dmatest.rst warning
    dmaengine: k3dma: Add support for dma-channel-mask
    dmaengine: k3dma: Delete axi_config
    dmaengine: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware
    Documentation: bindings: dma: Add binding for dma-channel-mask
    Documentation: bindings: k3dma: Extend the k3dma driver binding to support hisi-asp
    ...

    Linus Torvalds
     

04 Feb, 2019

1 commit

  • Once the "ld_queue" list is not empty, next descriptor will migrate
    into "ld_active" list. The "desc" variable will be overwritten
    during that transition. And later the dmaengine_desc_get_callback_invoke()
    will use it as an argument. As result we invoke wrong callback.

    That behaviour was in place since:
    commit fcaaba6c7136 ("dmaengine: imx-dma: fix callback path in tasklet").
    But after commit 4cd13c21b207 ("softirq: Let ksoftirqd do its job")
    things got worse, since possible delay between tasklet_schedule()
    from DMA irq handler and actual tasklet function execution got bigger.
    And that gave more time for new DMA request to be submitted and
    to be put into "ld_queue" list.

    It has been noticed that DMA issue is causing problems for "mxc-mmc"
    driver. While stressing the system with heavy network traffic and
    writing/reading to/from sd card simultaneously the timeout may happen:

    10013000.sdhci: mxcmci_watchdog: read time out (status = 0x30004900)

    That often lead to file system corruption.

    Signed-off-by: Leonid Iziumtsev
    Signed-off-by: Vinod Koul
    Cc: stable@vger.kernel.org

    Leonid Iziumtsev
     

20 Jan, 2019

3 commits

  • The return value of function 'imxdma_sg_next' is not checked anywhere,
    so make it void return type.

    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • now is used to keep size and it is better to change the variable
    type to size_t

    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • The warning got introduced by commit 930507c18304 ("arm64: add basic
    Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
    haven't been seen before since size_t was 'unsigned int' when built on
    arm32.

    ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
    ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
    ^~
    ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
    (__typecheck(x, y) && __no_side_effects(x, y))
    ^~~~~~~~~~~
    ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
    __builtin_choose_expr(__safe_cmp(x, y), \
    ^~~~~~~~~~
    ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
    #define min(x, y) __careful_cmp(x, y, len, sg_dma_len(sg));
    ^~~

    Rework so that we use min_t and pass in the size_t that returns the
    minimum of two values, using the specified type.

    Signed-off-by: Anders Roxell
    Acked-by: Olof Johansson
    Reviewed-by: Fabio Estevam
    Signed-off-by: Vinod Koul

    Anders Roxell
     

07 Oct, 2018

1 commit


23 May, 2018

1 commit


21 Jan, 2018

1 commit

  • The __memzero assembly code is almost identical to memset's except for
    two orr instructions. The runtime performance of __memset(p, n) and
    memset(p, 0, n) is accordingly almost identical.

    However, the memset() macro used to guard against a zero length and to
    call __memzero at compile time when the fill value is a constant zero
    interferes with compiler optimizations.

    Arnd found tha the test against a zero length brings up some new
    warnings with gcc v8:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103

    And successively rremoving the test against a zero length and the call
    to __memzero optimization produces the following kernel sizes for
    defconfig with gcc 6:

    text data bss dec hex filename
    12248142 6278960 413588 18940690 1210312 vmlinux.orig
    12244474 6278960 413588 18937022 120f4be vmlinux.no_zero_test
    12239160 6278960 413588 18931708 120dffc vmlinux.no_memzero

    So it is probably not worth keeping __memzero around given that the
    compiler can do a better job at inlining trivial memset(p,0,n) on its
    own. And the memset code already handles a zero length just fine.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Nicolas Pitre
    Acked-by: Ard Biesheuvel
    Acked-by: Arnd Bergmann
    Signed-off-by: Russell King

    Nicolas Pitre
     

24 Oct, 2017

1 commit


02 Jun, 2017

1 commit

  • This dma engine driver directly accesses page_link assuming knowledge
    that should be contained only in scatterlist.h.

    We replace these with calls to sg_chain and sg_assign_page.

    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Stephen Bates
    Acked-by: Linus Walleij
    Cc: Dan Williams
    Cc: Vinod Koul
    Cc: Per Förlin
    Signed-off-by: Vinod Koul

    Logan Gunthorpe
     

08 Aug, 2016

1 commit

  • This is in preperation of moving to a callback that provides results to the
    callback for the transaction. The conversion will maintain current behavior
    and the driver must convert to new callback mechanism at a later time in
    order to receive results.

    Signed-off-by: Dave Jiang
    Reviewed-by: Lars-Peter Clausen
    Signed-off-by: Vinod Koul

    Dave Jiang
     

16 Jul, 2016

2 commits


05 Aug, 2015

1 commit

  • Most drivers need to set constraints on the buffer alignment for async tx
    operations. However, even though it is documented, some drivers either use
    a defined constant that is not matching what the alignment variable expects
    (like DMA_BUSWIDTH_* constants) or fill the alignment in bytes instead of
    power of two.

    Add a new enum for these alignments that matches what the framework
    expects, and convert the drivers to it.

    Signed-off-by: Maxime Ripard
    Signed-off-by: Vinod Koul

    Maxime Ripard
     

07 Jul, 2015

1 commit


04 May, 2015

1 commit


03 Feb, 2015

1 commit


22 Dec, 2014

2 commits


20 Oct, 2014

1 commit


04 Aug, 2014

1 commit


06 Mar, 2014

2 commits


01 Nov, 2013

1 commit


31 Oct, 2013

1 commit

  • drivers/dma/imx-dma.c:575:3: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:575:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:589:4: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:599:4: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:929:2: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:929:2: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:959:2: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t'
    drivers/dma/imx-dma.c:959:2: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t'

    We can't use the %pa format for these because this relates to phys_addr_t,
    and dma_addr_t can be a different size. So, fix these by converting them
    to %llx and casting the dma_addr_t to always be unsigned long long.

    While we're here, also use %zu for size_t.

    Signed-off-by: Russell King
    Signed-off-by: Vinod Koul

    Russell King
     

25 Oct, 2013

1 commit


04 Oct, 2013

3 commits

  • We need to free the ld_active list head before jumping into the callback
    routine. Otherwise the callback could run into issue_pending and change
    our ld_active list head we just going to free. This will run the channel
    list into an currupted and undefined state.

    Signed-off-by: Michael Grzeschik
    Signed-off-by: Vinod Koul

    Michael Grzeschik
     
  • The tasklet and irqhandler are using spin_lock while other routines are
    using spin_lock_irqsave/restore. This leads to lockdep issues as
    described bellow. This patch is changing the code to use
    spinlock_irq_save/restore in both code pathes.

    As imxdma_xfer_desc always gets called with spin_lock_irqsave lock held,
    this patch also removes the spare call inside the routine to avoid
    double locking.

    [ 403.358162] =================================
    [ 403.362549] [ INFO: inconsistent lock state ]
    [ 403.366945] 3.10.0-20130823+ #904 Not tainted
    [ 403.371331] ---------------------------------
    [ 403.375721] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
    [ 403.381769] swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
    [ 403.386762] (&(&imxdma->lock)->rlock){?.-...}, at: [] imxdma_tasklet+0x20/0x134
    [ 403.395201] {IN-HARDIRQ-W} state was registered at:
    [ 403.400108] [] mark_lock+0x2a0/0x6b4
    [ 403.404798] [] __lock_acquire+0x650/0x1a64
    [ 403.410004] [] lock_acquire+0x94/0xa8
    [ 403.414773] [] _raw_spin_lock+0x54/0x8c
    [ 403.419720] [] dma_irq_handler+0x78/0x254
    [ 403.424845] [] handle_irq_event_percpu+0x38/0x1b4
    [ 403.430670] [] handle_irq_event+0x44/0x64
    [ 403.435789] [] handle_level_irq+0xd8/0xf0
    [ 403.440903] [] generic_handle_irq+0x28/0x38
    [ 403.446194] [] handle_IRQ+0x68/0x8c
    [ 403.450789] [] avic_handle_irq+0x3c/0x48
    [ 403.455811] [] __irq_svc+0x44/0x74
    [ 403.460314] [] cpu_startup_entry+0x88/0xf4
    [ 403.465525] [] rest_init+0xb8/0xe0
    [ 403.470045] [] start_kernel+0x28c/0x2d4
    [ 403.474986] [] 0xa0008040
    [ 403.478709] irq event stamp: 50854
    [ 403.482140] hardirqs last enabled at (50854): [] tasklet_action+0x38/0xdc
    [ 403.489954] hardirqs last disabled at (50853): [] tasklet_action+0x20/0xdc
    [ 403.497761] softirqs last enabled at (50850): [] _local_bh_enable+0x14/0x18
    [ 403.505741] softirqs last disabled at (50851): [] irq_exit+0x88/0xdc
    [ 403.513026]
    [ 403.513026] other info that might help us debug this:
    [ 403.519593] Possible unsafe locking scenario:
    [ 403.519593]
    [ 403.525548] CPU0
    [ 403.528020] ----
    [ 403.530491] lock(&(&imxdma->lock)->rlock);
    [ 403.534828]
    [ 403.537474] lock(&(&imxdma->lock)->rlock);
    [ 403.541983]
    [ 403.541983] *** DEADLOCK ***
    [ 403.541983]
    [ 403.547951] no locks held by swapper/0.
    [ 403.551813]
    [ 403.551813] stack backtrace:
    [ 403.556222] CPU: 0 PID: 0 Comm: swapper Not tainted 3.10.0-20130823+ #904
    [ 403.563039] Backtrace:
    [ 403.565581] [] (dump_backtrace+0x0/0x10c) from [] (show_stack+0x18/0x1c)
    [ 403.574054] r6:00000000 r5:c05c51d8 r4:c040bd58 r3:00200000
    [ 403.579872] [] (show_stack+0x0/0x1c) from [] (dump_stack+0x20/0x28)
    [ 403.587955] [] (dump_stack+0x0/0x28) from [] (print_usage_bug.part.28+0x224/0x28c)
    [ 403.597340] [] (print_usage_bug.part.28+0x0/0x28c) from [] (mark_lock+0x440/0x6b4)
    [ 403.606682] r8:c004a41c r7:00000000 r6:c040bd58 r5:c040c040 r4:00000002
    [ 403.613566] [] (mark_lock+0x0/0x6b4) from [] (__lock_acquire+0x6cc/0x1a64)
    [ 403.622244] [] (__lock_acquire+0x0/0x1a64) from [] (lock_acquire+0x94/0xa8)
    [ 403.631010] [] (lock_acquire+0x0/0xa8) from [] (_raw_spin_lock+0x54/0x8c)
    [ 403.639614] [] (_raw_spin_lock+0x0/0x8c) from [] (imxdma_tasklet+0x20/0x134)
    [ 403.648434] r6:c3847010 r5:c040e890 r4:c38470d4
    [ 403.653194] [] (imxdma_tasklet+0x0/0x134) from [] (tasklet_action+0x8c/0xdc)
    [ 403.662013] r8:c0599160 r7:00000000 r6:00000000 r5:c040e890 r4:c3847114 r3:c019d75c
    [ 403.670042] [] (tasklet_action+0x0/0xdc) from [] (__do_softirq+0xe4/0x1f0)
    [ 403.678687] r7:00000101 r6:c0402000 r5:c059919c r4:00000001
    [ 403.684498] [] (__do_softirq+0x0/0x1f0) from [] (irq_exit+0x88/0xdc)
    [ 403.692652] [] (irq_exit+0x0/0xdc) from [] (handle_IRQ+0x6c/0x8c)
    [ 403.700514] r4:00000030 r3:00000110
    [ 403.704192] [] (handle_IRQ+0x0/0x8c) from [] (avic_handle_irq+0x3c/0x48)
    [ 403.712664] r5:c0403f28 r4:c0593ebc
    [ 403.716343] [] (avic_handle_irq+0x0/0x48) from [] (__irq_svc+0x44/0x74)
    [ 403.724733] Exception stack(0xc0403f28 to 0xc0403f70)
    [ 403.729841] 3f20: 00000001 00000004 00000000 20000013 c0402000 c04104a8
    [ 403.738078] 3f40: 00000002 c0b69620 a0004000 41069264 a03fb5f4 c0403f7c c0403f40 c0403f70
    [ 403.746301] 3f60: c004b92c c0009e74 20000013 ffffffff
    [ 403.751383] r6:ffffffff r5:20000013 r4:c0009e74 r3:c004b92c
    [ 403.757210] [] (arch_cpu_idle+0x0/0x4c) from [] (cpu_startup_entry+0x88/0xf4)
    [ 403.766161] [] (cpu_startup_entry+0x0/0xf4) from [] (rest_init+0xb8/0xe0)
    [ 403.774753] [] (rest_init+0x0/0xe0) from [] (start_kernel+0x28c/0x2d4)
    [ 403.783051] r6:c03fc484 r5:ffffffff r4:c040a0e0
    [ 403.787797] [] (start_kernel+0x0/0x2d4) from [] (0xa0008040)

    Signed-off-by: Michael Grzeschik
    Signed-off-by: Vinod Koul

    Michael Grzeschik
     
  • When perparing cyclic_dma buffers by the sound layer, it will dump the
    following lockdep trace. The leading snd_pcm_action_single get called
    with read_lock_irq called. To fix this, we change the kcalloc call from
    GFP_KERNEL to GFP_ATOMIC.

    WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xcc/0x114()
    DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
    Modules linked in:
    CPU: 0 PID: 832 Comm: aplay Not tainted 3.11.0-20130823+ #903
    Backtrace:
    [] (dump_backtrace+0x0/0x10c) from [] (show_stack+0x18/0x1c)
    r6:c004c090 r5:00000009 r4:c2e0bd18 r3:00404000
    [] (show_stack+0x0/0x1c) from [] (dump_stack+0x20/0x28)
    [] (dump_stack+0x0/0x28) from [] (warn_slowpath_common+0x54/0x70)
    [] (warn_slowpath_common+0x0/0x70) from [] (warn_slowpath_fmt+0x38/0x40)
    r8:00004000 r7:a3b90000 r6:000080d0 r5:60000093 r4:c2e0a000 r3:00000009
    [] (warn_slowpath_fmt+0x0/0x40) from [] (lockdep_trace_alloc+0xcc/0x114)
    r3:c03955d8 r2:c03907db
    [] (lockdep_trace_alloc+0x0/0x114) from [] (__kmalloc+0x34/0x118)
    r6:000080d0 r5:c3800120 r4:000080d0 r3:c040a0f8
    [] (__kmalloc+0x0/0x118) from [] (imxdma_prep_dma_cyclic+0x64/0x168)
    r7:a3b90000 r6:00000004 r5:c39d8420 r4:c3847150
    [] (imxdma_prep_dma_cyclic+0x0/0x168) from [] (snd_dmaengine_pcm_trigger+0xa8/0x160)
    [] (snd_dmaengine_pcm_trigger+0x0/0x160) from [] (soc_pcm_trigger+0x90/0xb4)
    r8:c058c7b0 r7:c3b8140c r6:c39da560 r5:00000001 r4:c3b81000
    [] (soc_pcm_trigger+0x0/0xb4) from [] (snd_pcm_do_start+0x2c/0x38)
    r7:00000000 r6:00000003 r5:c058c7b0 r4:c3b81000
    [] (snd_pcm_do_start+0x0/0x38) from [] (snd_pcm_action_single+0x40/0x6c)
    [] (snd_pcm_action_single+0x0/0x6c) from [] (snd_pcm_action_lock_irq+0x7c/0x9c)
    r7:00000003 r6:c3b810f0 r5:c3b810f0 r4:c3b81000
    [] (snd_pcm_action_lock_irq+0x0/0x9c) from [] (snd_pcm_common_ioctl1+0x7f8/0xfd0)
    r8:c3b7f888 r7:005407b8 r6:c2c991c0 r5:c3b81000 r4:c3b81000 r3:00004142
    [] (snd_pcm_common_ioctl1+0x0/0xfd0) from [] (snd_pcm_playback_ioctl1+0x464/0x488)
    [] (snd_pcm_playback_ioctl1+0x0/0x488) from [] (snd_pcm_playback_ioctl+0x34/0x40)
    r8:c3b7f888 r7:00004142 r6:00000004 r5:c2c991c0 r4:005407b8
    [] (snd_pcm_playback_ioctl+0x0/0x40) from [] (vfs_ioctl+0x30/0x44)
    [] (vfs_ioctl+0x0/0x44) from [] (do_vfs_ioctl+0x55c/0x5c0)
    [] (do_vfs_ioctl+0x0/0x5c0) from [] (SyS_ioctl+0x40/0x68)
    [] (SyS_ioctl+0x0/0x68) from [] (ret_fast_syscall+0x0/0x44)
    r8:c0009544 r7:00000036 r6:bedeaa58 r5:00000000 r4:000000c0

    Signed-off-by: Michael Grzeschik
    Signed-off-by: Vinod Koul

    Michael Grzeschik
     

02 Sep, 2013

1 commit


05 Jul, 2013

2 commits


15 Apr, 2013

2 commits


26 Jan, 2013

1 commit