Re: [RFC PATCH] dmaengine: xilinx_dma: Fix per-channel direction reporting via device_caps
From: Rahul Navale
Date: Wed Mar 04 2026 - 03:40:36 EST
From: Rahul Navale <rahul.navale@xxxxxxx>
Hi Folker,
Thanks — I followed your suggested debugging steps.
>For the next debugging step I suggest that we focus on (2) but also on
>getting some insight into the callers. Could you please reapply
>7e01511443c3, keep the RFC patch in place and additionally apply the
>below patch?
>This will exercise your bad case, print the differences for caps, and
>also print the call stacks for all calls to dma_get_slave_caps().
I have applied 7e01511443c3, kept RFC patch(xilinx_dma_device_caps + printk)
and dmaengine.c debug patch applied (dma_slave_caps_printk() + dump_stack())
Observation: Issue still persists. cyclic playback fails after the first buffer period.
logs:
root@pdm3:~# dmesg | grep xilinx_dma_device_caps
[ 0.302398] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.302401] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.303124] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 0.303128] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 7.762354] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 7.762358] xilinx_dma_device_caps: caps->directions = 0x00000001
root@pdm3:~# aplay closetoyou.wav
Playing WAVE 'closetoyou.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
^CAborted by signal Interrupt...
aplay: pcm_write:2178: write error: Interrupted system call
root@pdm3:~# ^C
root@pdm3:~# ^C
root@pdm3:~# dmesg | grep xilinx_dma_device_caps
[ 0.302398] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.302401] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.303124] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 0.303128] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 7.762354] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 7.762358] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 44.792624] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 44.792628] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 0.302360] dma_slave_caps:
<4>[ 0.302364] src_addr_widths = 0x00000000
<4>[ 0.302368] dst_addr_widths = 0x00000000
<4>[ 0.302371] directions = 0x00000000
<4>[ 0.302374] min_burst = 0x00000000
<4>[ 0.302377] max_burst = 0x00000000
<4>[ 0.302380] max_sg_burst = 0x00000000
<4>[ 0.302383] cmd_pause = 0x00
<4>[ 0.302386] cmd_resume = 0x00
<4>[ 0.302388] cmd_terminate = 0x00
<4>[ 0.302391] residue_granularity= 0x00000000
<4>[ 0.302394] descriptor_reuse = 0x00
<4>[ 0.302398] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 0.302401] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 0.302404] dma_slave_caps:
<4>[ 0.302406] src_addr_widths = 0x00000000
<4>[ 0.302409] dst_addr_widths = 0x00000000
<4>[ 0.302412] directions = 0x00000001
<4>[ 0.302415] min_burst = 0x00000000
<4>[ 0.302418] max_burst = 0x00000000
<4>[ 0.302421] max_sg_burst = 0x00000000
<4>[ 0.302423] cmd_pause = 0x00
<4>[ 0.302426] cmd_resume = 0x00
<4>[ 0.302429] cmd_terminate = 0x01
<4>[ 0.302431] residue_granularity= 0x00000001
<4>[ 0.302434] descriptor_reuse = 0x00
<4>[ 0.302437] <stack>
<4>[ 0.302442] CPU: 3 UID: 0 PID: 40 Comm: kworker/u20:0 Not tainted 6.12.74-stable-standard-00032-g4c3d957ee56f #1
<4>[ 0.302453] Hardware name: pdm3_10_001-2 (DT)
<4>[ 0.302459] Workqueue: events_unbound deferred_probe_work_func
<4>[ 0.302479] Call trace:
<4>[ 0.302482] dump_backtrace+0xd0/0x108
<4>[ 0.302498] show_stack+0x14/0x1c
<4>[ 0.302510] dump_stack_lvl+0x5c/0x78
<4>[ 0.302521] dump_stack+0x14/0x1c
<4>[ 0.302530] dma_get_slave_caps+0xf8/0x114
<4>[ 0.302544] dmaengine_pcm_new+0x190/0x29c
<4>[ 0.302557] snd_soc_pcm_component_new+0x50/0x88
<4>[ 0.302566] soc_new_pcm+0x520/0x618
<4>[ 0.302575] snd_soc_bind_card+0x6cc/0xa48
<4>[ 0.302585] snd_soc_register_card+0xec/0x100
<4>[ 0.302593] devm_snd_soc_register_card+0x48/0x88
<4>[ 0.302603] simple_probe+0x370/0x380
<4>[ 0.302611] platform_probe+0x64/0xb0
<4>[ 0.302623] really_probe+0x18c/0x32c
<4>[ 0.302633] __driver_probe_device+0x120/0x138
<4>[ 0.302643] driver_probe_device+0x38/0xf0
<4>[ 0.302653] __device_attach_driver+0x100/0x114
<4>[ 0.302664] bus_for_each_drv+0xac/0xd4
<4>[ 0.302673] __device_attach+0xe4/0x164
<4>[ 0.302683] device_initial_probe+0x10/0x18
<4>[ 0.302693] bus_probe_device+0x38/0x9c
<4>[ 0.302702] deferred_probe_work_func+0xc8/0xdc
<4>[ 0.302712] process_scheduled_works+0x18c/0x23c
<4>[ 0.302725] worker_thread+0x140/0x1c0
<4>[ 0.302736] kthread+0xd8/0xe8
<4>[ 0.302747] ret_from_fork+0x10/0x20
<4>[ 0.302756] </stack>
<4>[ 0.303089] dma_slave_caps:
<4>[ 0.303092] src_addr_widths = 0x00000000
<4>[ 0.303096] dst_addr_widths = 0x00000000
<4>[ 0.303099] directions = 0x00000000
<4>[ 0.303102] min_burst = 0x00000000
<4>[ 0.303105] max_burst = 0x00000000
<4>[ 0.303107] max_sg_burst = 0x00000000
<4>[ 0.303110] cmd_pause = 0x00
<4>[ 0.303113] cmd_resume = 0x00
<4>[ 0.303116] cmd_terminate = 0x00
<4>[ 0.303119] residue_granularity= 0x00000000
<4>[ 0.303121] descriptor_reuse = 0x00
<4>[ 0.303124] xilinx_dma_device_caps: caps->directions = 0x00000002
<4>[ 0.303128] xilinx_dma_device_caps: caps->directions = 0x00000002
<4>[ 0.303131] dma_slave_caps:
<4>[ 0.303133] src_addr_widths = 0x00000000
<4>[ 0.303135] dst_addr_widths = 0x00000000
<4>[ 0.303138] directions = 0x00000002
<4>[ 0.303141] min_burst = 0x00000000
<4>[ 0.303144] max_burst = 0x00000000
<4>[ 0.303147] max_sg_burst = 0x00000000
<4>[ 0.303149] cmd_pause = 0x00
<4>[ 0.303152] cmd_resume = 0x00
<4>[ 0.303155] cmd_terminate = 0x01
<4>[ 0.303158] residue_granularity= 0x00000001
<4>[ 0.303161] descriptor_reuse = 0x00
<4>[ 0.303163] <stack>
<4>[ 0.303176] Hardware name: pdm3_10_001-2 (DT)
.....
.....
.....
<6>[ 7.102399] macb ff0c0000.ethernet eth1: Link is Up - 100Mbps/Full - flow control tx
<3>[ 7.458535] lima fd4b0000.gpu: resume clk fail -13
<6>[ 7.683306] input: PDM3 virtual keyboard as /devices/virtual/input/input3
<4>[ 7.762300] dma_slave_caps:
<4>[ 7.762316] src_addr_widths = 0x00000000
<4>[ 7.762322] dst_addr_widths = 0x00000000
<4>[ 7.762325] directions = 0x00000000
<4>[ 7.762328] min_burst = 0x00000000
<4>[ 7.762331] max_burst = 0x00000000
<4>[ 7.762334] max_sg_burst = 0x00000000
<4>[ 7.762337] cmd_pause = 0x00
<4>[ 7.762341] cmd_resume = 0x00
<4>[ 7.762344] cmd_terminate = 0x00
<4>[ 7.762347] residue_granularity= 0x00000000
<4>[ 7.762350] descriptor_reuse = 0x00
<4>[ 7.762354] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 7.762358] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 7.762361] dma_slave_caps:
<4>[ 7.762364] src_addr_widths = 0x00000000
<4>[ 7.762366] dst_addr_widths = 0x00000000
<4>[ 7.762370] directions = 0x00000001
<4>[ 7.762373] min_burst = 0x00000000
<4>[ 7.762376] max_burst = 0x00000000
<4>[ 7.762379] max_sg_burst = 0x00000000
<4>[ 7.762382] cmd_pause = 0x00
<4>[ 7.762385] cmd_resume = 0x00
<4>[ 7.762387] cmd_terminate = 0x01
<4>[ 7.762390] residue_granularity= 0x00000001
<4>[ 7.762394] descriptor_reuse = 0x00
<4>[ 7.762397] <stack>
<4>[ 7.762416] Hardware name: pdm3_10_001-2 (DT)
<4>[ 7.762422] Call trace:
<4>[ 7.762425] dump_backtrace+0xd0/0x108
<4>[ 7.762447] show_stack+0x14/0x1c
<4>[ 7.762459] dump_stack_lvl+0x5c/0x78
<4>[ 7.762471] dump_stack+0x14/0x1c
<4>[ 7.762480] dma_get_slave_caps+0xf8/0x114
<4>[ 7.762495] snd_dmaengine_pcm_refine_runtime_hwparams+0x60/0x15c
<4>[ 7.762510] dmaengine_pcm_open+0x180/0x1a8
<4>[ 7.762524] snd_soc_component_open+0x50/0x5c
<4>[ 7.762532] __soc_pcm_open+0x84/0x3a4
<4>[ 7.762542] soc_pcm_open+0x28/0x44
<4>[ 7.762550] snd_pcm_open_substream+0x4ec/0x750
<4>[ 7.762560] snd_pcm_open+0xb8/0x1ec
<4>[ 7.762568] snd_pcm_playback_open+0x48/0x70
<4>[ 7.762576] snd_open+0x150/0x15c
<4>[ 7.762587] chrdev_open+0x170/0x198
<4>[ 7.762601] do_dentry_open+0x2f8/0x3a4
<4>[ 7.762613] vfs_open+0x24/0x44
<4>[ 7.762621] path_openat+0x8cc/0xa04
<4>[ 7.762629] do_filp_open+0x60/0xd0
<4>[ 7.762636] do_sys_openat2+0xa0/0xec
<4>[ 7.762644] do_sys_open+0x44/0x6c
<4>[ 7.762652] __arm64_sys_openat+0x1c/0x24
<4>[ 7.762659] invoke_syscall+0x68/0xf0
<4>[ 7.762671] el0_svc_common.constprop.0+0xb0/0xcc
<4>[ 7.762682] do_el0_svc+0x18/0x20
<4>[ 7.762693] el0_svc+0x18/0x44
<4>[ 7.762705] el0t_64_sync_handler+0x80/0x124
<4>[ 7.762717] el0t_64_sync+0x14c/0x150
<4>[ 7.762726] </stack>
.....
.....
.....
<5>[ 40.293549] audit: type=1327 audit(1772610878.644:23): proctitle=737368643A20726F6F74205B707269765D
<4>[ 44.792575] dma_slave_caps:
<4>[ 44.792589] src_addr_widths = 0x00000000
<4>[ 44.792593] dst_addr_widths = 0x00000000
<4>[ 44.792596] directions = 0x00000000
<4>[ 44.792599] min_burst = 0x00000000
<4>[ 44.792602] max_burst = 0x00000000
<4>[ 44.792606] max_sg_burst = 0x00000000
<4>[ 44.792609] cmd_pause = 0x00
<4>[ 44.792612] cmd_resume = 0x00
<4>[ 44.792614] cmd_terminate = 0x00
<4>[ 44.792618] residue_granularity= 0x00000000
<4>[ 44.792621] descriptor_reuse = 0x00
<4>[ 44.792624] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 44.792628] xilinx_dma_device_caps: caps->directions = 0x00000001
<4>[ 44.792631] dma_slave_caps:
<4>[ 44.792633] src_addr_widths = 0x00000000
<4>[ 44.792636] dst_addr_widths = 0x00000000
<4>[ 44.792639] directions = 0x00000001
<4>[ 44.792642] min_burst = 0x00000000
<4>[ 44.792645] max_burst = 0x00000000
<4>[ 44.792648] max_sg_burst = 0x00000000
<4>[ 44.792651] cmd_pause = 0x00
<4>[ 44.792654] cmd_resume = 0x00
<4>[ 44.792656] cmd_terminate = 0x01
<4>[ 44.792659] residue_granularity= 0x00000001
<4>[ 44.792662] descriptor_reuse = 0x00
<4>[ 44.792665] <stack>
<4>[ 44.792671] CPU: 3 UID: 0 PID: 1225 Comm: aplay Not tainted 6.12.74-stable..
<4>[ 44.792684] Hardware name: pdm3_10_001-2 (DT)
<4>[ 44.792689] Call trace:
<4>[ 44.792692] dump_backtrace+0xd0/0x108
<4>[ 44.792713] show_stack+0x14/0x1c
<4>[ 44.792725] dump_stack_lvl+0x5c/0x78
<4>[ 44.792737] dump_stack+0x14/0x1c
<4>[ 44.792746] dma_get_slave_caps+0xf8/0x114
<4>[ 44.792761] snd_dmaengine_pcm_refine_runtime_hwparams+0x60/0x15c
<4>[ 44.792775] dmaengine_pcm_open+0x180/0x1a8
<4>[ 44.792788] snd_soc_component_open+0x50/0x5c
<4>[ 44.792796] __soc_pcm_open+0x84/0x3a4
<4>[ 44.792805] soc_pcm_open+0x28/0x44
<4>[ 44.792813] snd_pcm_open_substream+0x4ec/0x750
<4>[ 44.792822] snd_pcm_open+0xb8/0x1ec
<4>[ 44.792830] snd_pcm_playback_open+0x48/0x70
<4>[ 44.792838] snd_open+0x150/0x15c
<4>[ 44.792849] chrdev_open+0x170/0x198
<4>[ 44.792863] do_dentry_open+0x2f8/0x3a4
<4>[ 44.792875] vfs_open+0x24/0x44
<4>[ 44.792882] path_openat+0x8cc/0xa04
<4>[ 44.792890] do_filp_open+0x60/0xd0
<4>[ 44.792897] do_sys_openat2+0xa0/0xec
<4>[ 44.792905] do_sys_open+0x44/0x6c
<4>[ 44.792912] __arm64_sys_openat+0x1c/0x24
<4>[ 44.792920] invoke_syscall+0x68/0xf0
<4>[ 44.792931] el0_svc_common.constprop.0+0xb0/0xcc
<4>[ 44.792942] do_el0_svc+0x18/0x20
<4>[ 44.792953] el0_svc+0x18/0x44
<4>[ 44.792964] el0t_64_sync_handler+0x80/0x124
<4>[ 44.792977] el0t_64_sync+0x14c/0x150
<4>[ 44.792985] </stack>
>To quickly test theory (2), you could then comment out the caps->
>assignments in dma_get_slave_caps() and check if this fixes your issue
>or not.
I have applied 7e01511443c3, kept RFC patch(xilinx_dma_device_caps + printk)
and dmaengine.c debug patch applied (dma_slave_caps_printk() + dump_stack())
and comment out the caps->assignments in dma_get_slave_caps()
Observation:Audio works normally.
logs:
root@pdm3:~# dmesg | grep xilinx_dma_device_caps
[ 0.301728] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 0.301731] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.302421] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 0.302424] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 5.882992] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 5.882996] xilinx_dma_device_caps: caps->directions = 0x00000001
root@pdm3:~#
root@pdm3:~# aplay closetoyou.wav
Playing WAVE 'closetoyou.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root@pdm3:~# aplay closetoyou.wav
Playing WAVE 'closetoyou.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root@pdm3:~# aplay closetoyou.wav
Playing WAVE 'closetoyou.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
^X^X^CAborted by signal Interrupt...
root@pdm3:~# dmesg | grep xilinx_dma_device_caps
[ 0.301728] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 0.301731] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 0.302421] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 0.302424] xilinx_dma_device_caps: caps->directions = 0x00000002
[ 5.882992] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 5.882996] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 324.413686] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 324.413689] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 348.022906] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 348.022910] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 402.654943] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 402.654946] xilinx_dma_device_caps: caps->directions = 0x00000001
[ 423.598936] xilinx_dma_device_caps: caps->directions = 0x00000000
[ 423.598940] xilinx_dma_device_caps: caps->directions = 0x00000001