linux-stable/drivers/dma
Cristian Ciocaltea f0cd63e5dd dmaengine: owl: Use correct lock in owl_dma_get_pchan()
commit f8f482deb0 upstream.

When the kernel is built with lockdep support and the owl-dma driver is
used, the following message is shown:

[    2.496939] INFO: trying to register non-static key.
[    2.501889] the code is fine but needs lockdep annotation.
[    2.507357] turning off the locking correctness validator.
[    2.512834] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.6.3+ #15
[    2.519084] Hardware name: Generic DT based system
[    2.523878] Workqueue: events_freezable mmc_rescan
[    2.528681] [<801127f0>] (unwind_backtrace) from [<8010da58>] (show_stack+0x10/0x14)
[    2.536420] [<8010da58>] (show_stack) from [<8080fbe8>] (dump_stack+0xb4/0xe0)
[    2.543645] [<8080fbe8>] (dump_stack) from [<8017efa4>] (register_lock_class+0x6f0/0x718)
[    2.551816] [<8017efa4>] (register_lock_class) from [<8017b7d0>] (__lock_acquire+0x78/0x25f0)
[    2.560330] [<8017b7d0>] (__lock_acquire) from [<8017e5e4>] (lock_acquire+0xd8/0x1f4)
[    2.568159] [<8017e5e4>] (lock_acquire) from [<80831fb0>] (_raw_spin_lock_irqsave+0x3c/0x50)
[    2.576589] [<80831fb0>] (_raw_spin_lock_irqsave) from [<8051b5fc>] (owl_dma_issue_pending+0xbc/0x120)
[    2.585884] [<8051b5fc>] (owl_dma_issue_pending) from [<80668cbc>] (owl_mmc_request+0x1b0/0x390)
[    2.594655] [<80668cbc>] (owl_mmc_request) from [<80650ce0>] (mmc_start_request+0x94/0xbc)
[    2.602906] [<80650ce0>] (mmc_start_request) from [<80650ec0>] (mmc_wait_for_req+0x64/0xd0)
[    2.611245] [<80650ec0>] (mmc_wait_for_req) from [<8065aa10>] (mmc_app_send_scr+0x10c/0x144)
[    2.619669] [<8065aa10>] (mmc_app_send_scr) from [<80659b3c>] (mmc_sd_setup_card+0x4c/0x318)
[    2.628092] [<80659b3c>] (mmc_sd_setup_card) from [<80659f0c>] (mmc_sd_init_card+0x104/0x430)
[    2.636601] [<80659f0c>] (mmc_sd_init_card) from [<8065a3e0>] (mmc_attach_sd+0xcc/0x16c)
[    2.644678] [<8065a3e0>] (mmc_attach_sd) from [<8065301c>] (mmc_rescan+0x3ac/0x40c)
[    2.652332] [<8065301c>] (mmc_rescan) from [<80143244>] (process_one_work+0x2d8/0x780)
[    2.660239] [<80143244>] (process_one_work) from [<80143730>] (worker_thread+0x44/0x598)
[    2.668323] [<80143730>] (worker_thread) from [<8014b5f8>] (kthread+0x148/0x150)
[    2.675708] [<8014b5f8>] (kthread) from [<801010b4>] (ret_from_fork+0x14/0x20)
[    2.682912] Exception stack(0xee8fdfb0 to 0xee8fdff8)
[    2.687954] dfa0:                                     00000000 00000000 00000000 00000000
[    2.696118] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.704277] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000

The obvious fix would be to use 'spin_lock_init()' on 'pchan->lock'
before attempting to call 'spin_lock_irqsave()' in 'owl_dma_get_pchan()'.

However, according to Manivannan Sadhasivam, 'pchan->lock' was supposed
to only protect 'pchan->vchan' while 'od->lock' does a similar job in
'owl_dma_terminate_pchan()'.

Therefore, this patch substitutes 'pchan->lock' with 'od->lock' and
removes the 'lock' attribute in 'owl_dma_pchan' struct.

Fixes: 47e20577c2 ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Link: https://lore.kernel.org/r/c6e6cdaca252b5364bd294093673951036488cf0.1588439073.git.cristian.ciocaltea@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27 17:37:38 +02:00
..
bestcomm treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
dw dmaengine: dw: platform: Switch to acpi_dma_controller_register() 2020-01-27 14:51:06 +01:00
dw-axi-dmac dmaengine: dw-axi-dmac: fix null dereference when pointer first is null 2019-06-25 11:35:55 +08:00
hsu dmaengine: hsu: Revert "set HSU_CH_MTSR to memory width" 2020-01-27 14:50:57 +01:00
ioat ioat: ioat_alloc_ring() failure handling. 2020-01-17 19:47:16 +01:00
ipu treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
mediatek
ppc4xx dmaengine: ppc4xx: fix off-by-one build failure 2018-11-13 11:08:41 -08:00
qcom dmaengine: qcom: bam_dma: Fix resource leak 2019-11-06 13:06:21 +01:00
sh dmaengine: rcar-dmac: set scatter/gather max segment size 2019-11-24 08:20:30 +01:00
ti dmaengine: ti: edma: fix missed failure handling 2020-01-27 14:51:22 +01:00
xilinx dmaengine: xilinx_dma: Clear desc_pendingcount in xilinx_dma_reset 2020-01-04 19:12:38 +01:00
acpi-dma.c
altera-msgdma.c
amba-pl08x.c
at_hdmac.c dmaengine: at_hdmac: fix module unloading 2018-12-05 19:32:12 +01:00
at_hdmac_regs.h
at_xdmac.c dmaengine: at_xdmac: remove a stray bottom half unlock 2019-11-20 18:46:20 +01:00
bcm-sba-raid.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
bcm2835-dma.c dmaengine: bcm2835: Print error in case setting DMA mask fails 2019-10-05 13:09:34 +02:00
coh901318.c dmaengine: coh901318: Fix a double lock bug in dma_tc_handle() 2020-03-11 14:15:12 +01:00
coh901318.h
coh901318_lli.c
dma-axi-dmac.c dmaengine: axi-dmac: Don't check the number of frames for alignment 2020-01-27 14:50:41 +01:00
dma-jz4740.c
dma-jz4780.c dmaengine: dma-jz4780: Further residue status fix 2019-11-20 18:46:17 +01:00
dmaengine.c dmaengine: Store module owner in dma_device struct 2020-02-24 08:34:44 +01:00
dmaengine.h
dmatest.c dmaengine: dmatest: Fix iteration non-stop logic 2020-05-06 08:13:32 +02:00
ep93xx_dma.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
fsl-edma.c
fsl_raid.c
fsl_raid.h
fsldma.c dmaengine: fsldma: simplify getting .drvdata 2018-04-22 21:37:17 +05:30
fsldma.h
idma64.c dmaengine: idma64: Use actual device for DMA transfers 2019-06-15 11:54:10 +02:00
idma64.h dmaengine: idma64: Use actual device for DMA transfers 2019-06-15 11:54:10 +02:00
img-mdc-dma.c
imx-dma.c dmaengine: imx-dma: fix warning comparison of distinct pointer types 2019-04-05 22:33:15 +02:00
imx-sdma.c dmaengine: imx-sdma: remove dma_slave_config direction usage and leave sdma_event_enable() 2020-03-11 14:15:08 +01:00
iop-adma.c dmaengine: iop-adma: use correct printk format strings 2019-10-05 13:09:42 +02:00
k3dma.c dmaengine: k3dma: Avoid null pointer traversal 2020-01-17 19:47:16 +01:00
Kconfig dmaengine: dma-jz4780: Don't depend on MACH_JZ4780 2019-11-20 18:46:16 +01:00
lpc18xx-dmamux.c
Makefile dmaengine: Add Actions Semi Owl family S900 DMA driver 2018-08-09 08:16:00 +05:30
mic_x100_dma.c dmaengine: mic_x100_dma: use devm_kzalloc to fix an issue 2018-08-27 11:16:04 +05:30
mic_x100_dma.h
mmp_pdma.c
mmp_tdma.c dmaengine: mmp_tdma: Reset channel error on release 2020-05-20 08:18:39 +02:00
moxart-dma.c treewide: Use struct_size() for kmalloc()-family 2018-06-06 11:15:43 -07:00
mpc512x_dma.c
mv_xor.c dmaengine: mv_xor: Use correct device for DMA API 2020-01-27 14:50:24 +01:00
mv_xor.h
mv_xor_v2.c dmaengine: mv_xor_v2: use {lower,upper}_32_bits to configure HW descriptor address 2018-07-25 17:53:22 +05:30
mxs-dma.c dmaengine: mxs-dma: Switch to SPDX identifier 2018-05-23 11:10:31 +05:30
nbpfaxi.c dmaengine: nbpfaxi: Mark expected switch fall-through 2018-07-09 17:01:35 +05:30
of-dma.c
owl-dma.c dmaengine: owl: Use correct lock in owl_dma_get_pchan() 2020-05-27 17:37:38 +02:00
pch_dma.c dmaengine: pch_dma.c: Avoid data race between probe and irq handler 2020-05-20 08:18:39 +02:00
pl330.c dmaengine: pl330: _stop: clear interrupt status 2019-05-31 06:46:14 -07:00
pxa_dma.c dmaengine: pxa: add a default requestor policy 2018-06-18 21:29:23 +02:00
s3c24xx-dma.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
sa11x0-dma.c treewide: Use struct_size() for kmalloc()-family 2018-06-06 11:15:43 -07:00
sirf-dma.c
sprd-dma.c dmaengine: sprd: Fix the possible memory leak issue 2019-11-12 19:20:54 +01:00
st_fdma.c
st_fdma.h
ste_dma40.c dmaengine: ste_dma40: fix unneeded variable warning 2019-09-06 10:21:54 +02:00
ste_dma40_ll.c
ste_dma40_ll.h
stm32-dma.c dmaengine: stm32-dma: check whether length is aligned on FIFO threshold 2019-12-05 09:21:35 +01:00
stm32-dmamux.c
stm32-mdma.c dmaengine: stm32-mdma: Fix a possible null-pointer dereference in stm32_mdma_irq_handler() 2019-09-06 10:21:56 +02:00
sun4i-dma.c
sun6i-dma.c
tegra20-apb-dma.c dmaengine: tegra-apb: Prevent race conditions of tasklet vs free list 2020-03-11 14:15:04 +01:00
tegra210-adma.c dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()' 2020-05-27 17:37:38 +02:00
timb_dma.c dmaengine: timb_dma: Use proper enum in td_prep_slave_sg 2019-11-24 08:19:46 +01:00
TODO
txx9dmac.c dmaengine: txx9dmac: simplify getting .drvdata 2018-04-22 21:38:06 +05:30
txx9dmac.h
virt-dma.c
virt-dma.h
xgene-dma.c
zx_dma.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00