DMA MMAP support for ralink mips mt7628

Hi all,
We are trying to play a WAVE file on MT7628 based skylab board(SKW92_EVB) by using aplay with -M option(using MMAP) and getting following crash:

root@router:~# aplay -M /etc/config/pcm_8K_S8.wav

aplay: playback:[   94.994501] Kernel bug detected[#1]:
[   95.004297] CPU: 0 PID: 2143 Comm: aplay Not tainted 4.4.71 #0
[   95.015843] task: 828e5950 ti: 82958000 task.ti: 82958000
[   95.026520] $ 0   : 00000000 00000001 00000000 00000fa0
[   95.036875] $ 4   : 838fb210 00000001 a3200000 03200000
[   95.047223] $ 8   : 0000007c 3233202c 30303030 66202c30
[   95.057571] $12   : 00000000 00003000 00000000 7c7c7c7c
[   95.067918] $16   : 832d4268 82984200 83149f00 83034480
[   95.078266] $20   : 77a3e000 77a3f000 00000000 00000001
[   95.088614] $24   : 00000002 801cb4dc
[   95.098963] $28   : 82958000 82959dc8 00000000 80229cd8
[   95.109314] Hi    : 00000000
[   95.115002] Lo    : ec4e4000
[   95.120714] epc   : 80229d08 snd_pcm_lib_default_mmap+0xc0/0x134
[   95.132601] ra    : 80229cd8 snd_pcm_lib_default_mmap+0x90/0x134
[   95.144480] Status: 1100e403 KERNEL EXL IE
[   95.152764] Cause : 10800034 (ExcCode 0d)
[   95.160691] PrId  : 00019655 (MIPS 24KEc)
[   95.168614] Modules linked in: cdc_wdm usbserial cdc_ncm cdc_ether usbnet cdc_acm ledtrig_usbport ohci_platform ohci_hcd ehci_platform ehci_hcd usbcore nls_base usb_common pppoe ppp_async iptable_nat pppox ppp_generic nf_nat_ipv4 nf_conntrack_netlink nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE xt_u32 xt_time xt_tcpudp xt_string xt_state xt_recent xt_quota xt_pkttype xt_physdev xt_owner xt_nat xt_multiport xt_mark xt_mac xt_limit xt_iprange xt_helper xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_addrtype xt_TCPMSS xt_REDIRECT xt_LOG xt_IPMARK ts_kmp ts_fsm ts_bm slhc nfnetlink nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack iptable_mangle iptable_filter ip_tables crc_ccitt compat_xtables br_netfilter i2c_mt7621 i2c_dev mt7628_pcm_machine mt7628_pcm_codec mt7628_pcm ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables snd_seq_midi snd_seq_midi_event snd_seq snd_compress snd_pcm_oss snd_mixer_oss snd_rawmidi snd_seq_device regmap_i2c i2c_core leds_gpio mii 
[   95.372314] Process aplay (pid: 2143, threadinfo=82958000, task=828e5950, tls=77a4bd48)
[   95.388150] Stack : 00000000 00000002 838fb210 832d4268 a3200000 03200000 00000fa0 803e638c
          00000dd1 82984200 00000008 80229e54 00000008 83149f00 83034480 77a3e000
          832d4268 800bb1dc 00000000 00001000 83149f00 00001000 000000fb 00000000
          83149f00 00000000 00000000 00000000 00000008 804a0000 00000001 8303cc08
          8303cc1c 8303cc18 77a3e000 000000fb 83149f00 00001000 00000001 00000002
          ...
[   95.458534] Call Trace:
[   95.463371] [<80229d08>] snd_pcm_lib_default_mmap+0xc0/0x134
[   95.474576] [<80229e54>] snd_pcm_mmap_data+0xd8/0x124
[   95.484584] [<800bb1dc>] mmap_region+0x29c/0x544
[   95.493720] [<800bb7dc>] do_mmap+0x358/0x3d4
[   95.502178] [<800abe4c>] vm_mmap_pgoff+0x70/0xb8
[   95.511316] [<800b9cf0>] SyS_mmap_pgoff+0x8c/0xd8
[   95.520633] [<8000682c>] syscall_common+0x30/0x54
[   95.529934]
[   95.532868]
Code: 3c02804a  8c422604  2c450001 <00050336> 1040000a  00000000  8c420008  10400007  00000000
---[ end trace 312fa3810a43d707 ]---

[   95.568787] Fatal exception: panic in 5 seconds

Playing raw data '/etc/config/pcm_8K_S8.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

[  100.586200] Kernel panic - not syncing: Fatal exception
[  100.599773] Rebooting in 3 seconds..[04040D08][04040D07]

but without -M option, it is finely playing the same file.

While looking into this, we figured out return dma_mmap_cohrent inside snd_pcm_lib_default_mmap() is failing. It seems like dma_map_ops structure is returning as null.

So my question is Does mips support mmap dma operations? Or do we have any other way to support dma mmap for playing wave files.

Thanks

Hi folks,

Anybody can help regarding this.
@tmomas @hammer looking for your responses.

If you have a message telling there is a bug in the kernel, and effectively there is a kernel panic, I woul not spend more time in this forum, and file a bug report directly.

@eduperez. Thanks for your response.

Actually the crash is occuring because of missing mmap callback in I2S/PCM driver. This mmap will help in reducing the latency and also avoid copying of wave file buffer to dma buffers. It might improve/retain the audio quality also in case the CPU is busy with other high intensity operations.

So we are looking for mmap function callback implementation for MT7628 PCM/I2S dma.

HI! Which version of openWRT are you using? do you have the link? THANKS!

It is with service tag 17.01.2. Anyways my issue was resolved now. Thanks all for your help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.