frank-w/BPI-Router-Linux

mt7615 wifi doesn't work properly on kernel 5.15

MastMind opened this issue · 2 comments

Hi

I'd tried to extend wifi abilities of my bananapi-r2 board. For this purposes I bough an external PCIe wifi module mt7615. Also I'd compiled mt7615e driver as kernel module. I've got the next issue: when I load the kernel module everything is fine in dmesg output:

[  300.866646] mt7615e 0000:01:00.0: enabling device (0140 -> 0142)
[  300.872971] mt7615e 0000:01:00.0: Load eeprom: /lib/firmware/mediatek/mt7615e_rf.bin
[  300.881994] mt7615e 0000:01:00.0: Load eeprom OK, count 1200 byte
[  300.893024] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[  300.902178] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[  300.923577] mt7615e 0000:01:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[  300.923577] 
[  300.989698] mt7615e 0000:01:00.0: N9 Firmware Version: _reserved_, Build Time: 20200814163649
[  301.009874] mt7615e 0000:01:00.0: CR4 Firmware Version: _reserved_, Build Time: 20181207140436

And I can see wlan0 and wlan1 interfaces in the list of networking devices. But when I try to bring up one of them (or just gather information with iw list command) I've got an segfault error in command line and the next error messages in dmesg output:

[ 1604.251263] 8<--- cut here ---
[ 1604.254356] Unable to handle kernel NULL pointer dereference at virtual address 000000a6
[ 1604.262511] pgd = d82e545d
[ 1604.265232] [000000a6] *pgd=fb26f835
[ 1604.268827] Internal error: Oops: 817 [#1] SMP ARM
[ 1604.273626] Modules linked in: mt7615e mt7615_common mt76_connac_lib mt76 mac80211 libarc4 cfg80211 tun xt_nat xt_MASQUERADE iptable_nat nf_nat xt_tcpudp xt_state xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter ip_tables x_tables [last unloaded: mt7615e]
[ 1604.298243] CPU: 2 PID: 474 Comm: ip Not tainted 5.15.117-bpi-r2-main #4
[ 1604.304952] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1604.310526] PC is at cfg80211_mgd_wext_connect+0x68/0x18c [cfg80211]
[ 1604.317800] LR is at rtnl_is_locked+0x20/0x24
[ 1604.322178] pc : [<bf0ec64c>]    lr : [<c0ac4400>]    psr: 20000013
[ 1604.328450] sp : c5b4f6f8  ip : c5b4f6e8  fp : c5b4f71c
[ 1604.333678] r10: 00000000  r9 : c5b4fbd8  r8 : c5b9262c
[ 1604.338906] r7 : c6168000  r6 : c6168000  r5 : 00000002  r4 : c5b92608
[ 1604.345440] r3 : c5b928d0  r2 : ffffffff  r1 : c5b92000  r0 : 00000001
[ 1604.351972] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[ 1604.359115] Control: 10c5387d  Table: 8614006a  DAC: 00000051
[ 1604.364864] Register r0 information: non-paged memory
[ 1604.369934] Register r1 information: slab kmalloc-cg-8k start c5b92000 pointer offset 0 size 8192
[ 1604.378843] Register r2 information: non-paged memory
[ 1604.383900] Register r3 information: slab kmalloc-cg-8k start c5b92000 pointer offset 2256 size 8192
[ 1604.393058] Register r4 information: slab kmalloc-cg-8k start c5b92000 pointer offset 1544 size 8192
[ 1604.402216] Register r5 information: non-paged memory
[ 1604.407272] Register r6 information: non-slab/vmalloc memory
[ 1604.412938] Register r7 information: non-slab/vmalloc memory
[ 1604.418602] Register r8 information: slab kmalloc-cg-8k start c5b92000 pointer offset 1580 size 8192
[ 1604.427760] Register r9 information: non-slab/vmalloc memory
[ 1604.433427] Register r10 information: NULL pointer
[ 1604.438221] Register r11 information: non-slab/vmalloc memory
[ 1604.443973] Register r12 information: non-slab/vmalloc memory
[ 1604.449724] Process ip (pid: 474, stack limit = 0xb98d6c7a)
[ 1604.455306] Stack: (0xc5b4f6f8 to 0xc5b50000)
[ 1604.459670] f6e0:                                                       c0aba79c c6168a74
[ 1604.467860] f700: 00000010 c5b92000 c5b92608 c61681c0 c5b4f8cc c5b4f720 bf0844ec bf0ec5f0
[ 1604.476049] f720: c0149c94 c0149700 c5b92000 c6168520 c6168a70 c5b92188 c5b4f754 c5b4f748
[ 1604.484236] f740: bf1ca43c c0149c48 c5b4f774 c5b4f758 bf1a5344 bf1ca400 c5b92000 bf20a88c
[ 1604.492424] f760: 00000000 c5b92188 c5b4f794 c0d62700 c5b92000 00000000 c5b4f794 c5b4f788
[ 1604.500613] f780: c0d62700 c01309ec c5b4f7c4 c5b4f798 c0abb86c c0d626d0 00000000 00000000
[ 1604.508801] f7a0: 00000000 00000000 c2026d80 c559d000 c5b92000 c160ef80 c5b4f81c c5b4f7c8
[ 1604.516989] f7c0: c0baebd8 c0abb7fc 00000000 010000e0 c5b4f7ec 005e0001 00000100 00000000
[ 1604.525176] f7e0: 00000000 00000000 00000000 00000000 00000000 c0bb0560 00000000 010000e0
[ 1604.533364] f800: c5b4f81c c5b4f810 c0d62700 c01309ec c5b4f84c c5b4f820 c0badce8 c0d626d0
[ 1604.541552] f820: c160f2d4 dc96fa09 c559d000 c0d626c0 c59de380 c59de380 c5b4f854 c5b4f848
[ 1604.549741] f840: c0d626c0 c01309ec c5b4f894 c5b4f858 c0c0ab6c c0d62698 c5b92000 00000000
[ 1604.557929] f860: c5b4f8cc c5b4f870 c0ba83f0 00000001 fffffff2 c5b92000 c59de400 c160ef80
[ 1604.566118] f880: 00000000 c0154440 c5b4f888 c5b4f888 c0c0f508 c0154440 c5b4f8cc dc96fa09
[ 1604.574306] f8a0: 00c58970 dc96fa09 bf215234 ffffffea 00000001 c5b4f918 c54f1410 c5b4fbd8
[ 1604.582494] f8c0: c5b4f8ec c5b4f8d0 c0154440 bf08408c c5b4f918 00000001 c160ef80 00001002
[ 1604.590682] f8e0: c5b4f914 c5b4f8f0 c0aa71b8 c0154408 00000000 c5b4f900 c5b92000 c5b92000
[ 1604.598870] f900: 00000001 00000000 c5b4f93c c5b4f918 c0ab7b74 c0aa7164 c5b92000 00000000
[ 1604.607058] f920: 00000000 dc96fa09 c5b92000 00000000 c5b4f95c c5b4f940 c0ab84f4 c0ab7b18
[ 1604.615246] f940: c5b92000 c5b4faf0 c5b4fcd0 c5ab2b40 c5b4f9f4 c5b4f960 c0ac8964 c0ab84b4
[ 1604.623434] f960: 00000000 00000000 c5b4f9ec c5b4f978 c031bf10 bf20a88c c017408c c0ab2538
[ 1604.631622] f980: c5b4f9a4 c5b4f990 c0ab2538 c01af624 00000000 c0602830 c5b4fac4 c5b4f9a8
[ 1604.639811] f9a0: c0ac67e4 00000000 c54f1420 c54f1400 c54f1400 c0ac4400 c5b4f9d4 c5b4f9c8
[ 1604.647998] f9c0: c0ac4400 dc96fa09 c5b4f9f4 00000000 00000000 c5b92000 c54f1400 c5b4fcd0
[ 1604.656186] f9e0: 00000000 c153df20 c5b4fc54 c5b4f9f8 c0ac9a6c c0ac8668 c5b4faf0 c5b4fbd8
[ 1604.664374] fa00: 00000000 00000000 c5ab2b40 c559d300 c160fa38 c54f1410 00000000 00000000
[ 1604.672562] fa20: c160ef80 c0ec294c 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.680749] fa40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.688936] fa60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.697123] fa80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.705310] faa0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.713497] fac0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.721684] fae0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.729871] fb00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.738057] fb20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.746244] fb40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.754431] fb60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.762618] fb80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.770804] fba0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.778991] fbc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.787178] fbe0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.795365] fc00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.803553] fc20: 00000000 dc96fa09 00000000 c559d300 c5ab2b40 c54f1400 c5b4fcd0 c5b4fcd0
[ 1604.811741] fc40: 00000000 c160fa38 c5b4fc74 c5b4fc58 c0ac9e00 c0ac9488 c54f1400 00000000
[ 1604.819929] fc60: c160fa38 c5ab2b40 c5b4fccc c5b4fc78 c0ac6f10 c0ac9db8 00000000 c228f7c0
[ 1604.828116] fc80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 dc96fa09
[ 1604.836304] fca0: c5a83400 c5ab2b40 c0ac6d14 c54f1400 00000020 00000000 c5a82d8c 00000000
[ 1604.844491] fcc0: c5b4fd14 c5b4fcd0 c0b3534c c0ac6d20 00000000 00000000 00000000 00000000
[ 1604.852679] fce0: 00000000 00000000 00000000 00000000 00000000 dc96fa09 c21a0000 00000020
[ 1604.860867] fd00: c228f6c0 c5ab2b40 c5b4fd24 c5b4fd18 c0ac53dc c0b35290 c5b4fd54 c5b4fd28
[ 1604.869055] fd20: c0b3498c c0ac53c8 7fffffff dc96fa09 c5b4ff48 00000020 c5ab2b40 c5a82c00
[ 1604.877243] fd40: c5b4ff50 00000000 c5b4fdb4 c5b4fd58 c0b34c70 c0b347f0 00056f26 00000000
[ 1604.885431] fd60: 00000881 00000001 00000008 00000020 c2209400 00000000 000001da 00000000
[ 1604.893619] fd80: 00000000 dc96fa09 00000001 c5b4ff48 c0b34a80 c39ee080 00000000 00000000
[ 1604.901807] fda0: c5b4fdc4 c5b4fdc4 c5b4fe14 c5b4fdb8 c0a85644 c0b34a8c 00000000 00000000
[ 1604.909994] fdc0: 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.918181] fde0: 00000000 dc96fa09 c5b4fe14 00000000 c5b4ff48 c39ee080 00000000 00000000
[ 1604.926369] fe00: c5b4fe44 c5b4fe84 c5b4ff34 c5b4fe18 c0a87968 c0a85460 00000000 c5b4ff50
[ 1604.934557] fe20: c036fdb0 00000000 00000000 00000000 be9ec6e8 00000001 00000000 00000000
[ 1604.942744] fe40: 00000000 be9ec710 00000020 00000000 00000000 00000000 00000000 00000000
[ 1604.950932] fe60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.959120] fe80: 00000000 00000010 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.967308] fea0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.975496] fec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.983683] fee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1604.991871] ff00: 00000000 dc96fa09 c037404c 00000000 c39ee080 00000000 be9ec694 c01002a4
[ 1605.000059] ff20: c5b4e000 00000128 c5b4ffa4 c5b4ff38 c0a87bcc c0a8787c 00000000 00000000
[ 1605.008247] ff40: 00000000 fffffff7 c5b4fe84 0000000c 00010000 00000000 00000000 c5b4fe4c
[ 1605.016434] ff60: 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000
[ 1605.024622] ff80: c5b4ffac dc96fa09 00000003 00089000 00089284 00000128 00000000 c5b4ffa8
[ 1605.032810] ffa0: c0100060 c0a87b58 00000003 00089000 00000003 be9ec694 00000000 00000000
[ 1605.040998] ffc0: 00000003 00089000 00089284 00000128 00000000 00000001 be9eceb5 00063805
[ 1605.049186] ffe0: 00089114 be9ec650 00060c7c b6ee3a2c 60000010 00000003 00000000 00000000
[ 1605.057368] Backtrace: 
[ 1605.059818] [<bf0ec5e4>] (cfg80211_mgd_wext_connect [cfg80211]) from [<bf0844ec>] (cfg80211_netdev_notifier_call+0x46c/0x510 [cfg80211])
[ 1605.073529]  r6:c61681c0 r5:c5b92608 r4:c5b92000
[ 1605.078151] [<bf084080>] (cfg80211_netdev_notifier_call [cfg80211]) from [<c0154440>] (raw_notifier_call_chain+0x44/0x78)
[ 1605.089784]  r9:c5b4fbd8 r8:c54f1410 r7:c5b4f918 r6:00000001 r5:ffffffea r4:bf215234
[ 1605.097534] [<c01543fc>] (raw_notifier_call_chain) from [<c0aa71b8>] (call_netdevice_notifiers_info+0x60/0xa8)
[ 1605.107569]  r7:00001002 r6:c160ef80 r5:00000001 r4:c5b4f918
[ 1605.113230] [<c0aa7158>] (call_netdevice_notifiers_info) from [<c0ab7b74>] (__dev_notify_flags+0x68/0xe8)
[ 1605.122824]  r6:00000000 r5:00000001 r4:c5b92000
[ 1605.127441] [<c0ab7b0c>] (__dev_notify_flags) from [<c0ab84f4>] (dev_change_flags+0x4c/0x54)
[ 1605.135902]  r5:00000000 r4:c5b92000
[ 1605.139477] [<c0ab84a8>] (dev_change_flags) from [<c0ac8964>] (do_setlink+0x308/0xc74)
[ 1605.147420]  r7:c5ab2b40 r6:c5b4fcd0 r5:c5b4faf0 r4:c5b92000
[ 1605.153080] [<c0ac865c>] (do_setlink) from [<c0ac9a6c>] (__rtnl_newlink+0x5f0/0x930)
[ 1605.160850]  r10:c153df20 r9:00000000 r8:c5b4fcd0 r7:c54f1400 r6:c5b92000 r5:00000000
[ 1605.168684]  r4:00000000
[ 1605.171217] [<c0ac947c>] (__rtnl_newlink) from [<c0ac9e00>] (rtnl_newlink+0x54/0x74)
[ 1605.178987]  r10:c160fa38 r9:00000000 r8:c5b4fcd0 r7:c5b4fcd0 r6:c54f1400 r5:c5ab2b40
[ 1605.186822]  r4:c559d300
[ 1605.189355] [<c0ac9dac>] (rtnl_newlink) from [<c0ac6f10>] (rtnetlink_rcv_msg+0x1fc/0x2dc)
[ 1605.197557]  r7:c5ab2b40 r6:c160fa38 r5:00000000 r4:c54f1400
[ 1605.203217] [<c0ac6d14>] (rtnetlink_rcv_msg) from [<c0b3534c>] (netlink_rcv_skb+0xc8/0x12c)
[ 1605.211598]  r10:00000000 r9:c5a82d8c r8:00000000 r7:00000020 r6:c54f1400 r5:c0ac6d14
[ 1605.219433]  r4:c5ab2b40
[ 1605.221965] [<c0b35284>] (netlink_rcv_skb) from [<c0ac53dc>] (rtnetlink_rcv+0x20/0x24)
[ 1605.229906]  r7:c5ab2b40 r6:c228f6c0 r5:00000020 r4:c21a0000
[ 1605.235567] [<c0ac53bc>] (rtnetlink_rcv) from [<c0b3498c>] (netlink_unicast+0x1a8/0x29c)
[ 1605.243678] [<c0b347e4>] (netlink_unicast) from [<c0b34c70>] (netlink_sendmsg+0x1f0/0x46c)
[ 1605.251969]  r9:00000000 r8:c5b4ff50 r7:c5a82c00 r6:c5ab2b40 r5:00000020 r4:c5b4ff48
[ 1605.259716] [<c0b34a80>] (netlink_sendmsg) from [<c0a85644>] (____sys_sendmsg+0x1f0/0x24c)
[ 1605.268010]  r10:c5b4fdc4 r9:c5b4fdc4 r8:00000000 r7:00000000 r6:c39ee080 r5:c0b34a80
[ 1605.275845]  r4:c5b4ff48
[ 1605.278378] [<c0a85454>] (____sys_sendmsg) from [<c0a87968>] (___sys_sendmsg+0xf8/0x130)
[ 1605.286494]  r10:c5b4fe84 r9:c5b4fe44 r8:00000000 r7:00000000 r6:c39ee080 r5:c5b4ff48
[ 1605.294329]  r4:00000000
[ 1605.296862] [<c0a87870>] (___sys_sendmsg) from [<c0a87bcc>] (sys_sendmsg+0x80/0xc8)
[ 1605.304540]  r10:00000128 r9:c5b4e000 r8:c01002a4 r7:be9ec694 r6:00000000 r5:c39ee080
[ 1605.312375]  r4:00000000
[ 1605.314908] [<c0a87b4c>] (sys_sendmsg) from [<c0100060>] (ret_fast_syscall+0x0/0x48)
[ 1605.322668] Exception stack(0xc5b4ffa8 to 0xc5b4fff0)
[ 1605.327727] ffa0:                   00000003 00089000 00000003 be9ec694 00000000 00000000
[ 1605.335916] ffc0: 00000003 00089000 00089284 00000128 00000000 00000001 be9eceb5 00063805
[ 1605.344102] ffe0: 00089114 be9ec650 00060c7c b6ee3a2c
[ 1605.349160]  r7:00000128 r6:00089284 r5:00089000 r4:00000003
[ 1605.354827] Code: e5843204 0a000016 e2843fb2 e1d320d0 (e58520a4) 
[ 1605.360989] ---[ end trace a3b7f10f219c14e2 ]---

And device can't be rebooted after that. But wired network is working fine. Also I have the next lspci output:

00:00.0 PCI bridge: MEDIATEK Corp. Device 0801 (rev 01)
00:01.0 PCI bridge: MEDIATEK Corp. Device 0801 (rev 01)
01:00.0 Unclassified device [0002]: MEDIATEK Corp. Device 7615
02:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)

Linux can't identify the mt7615 board as a network device. With loaded mt7615e or not. I have Linux bpi-r2 5.15.117-bpi-r2-main #4 SMP Thu Aug 17 11:51:19 MSK 2023 armv7l GNU/Linux kernel which built from this repo. What can I do in this situation? It seems like wrong firmware binaries.

i don't think it is firmware-related

Unable to handle kernel NULL pointer dereference at virtual address 000000a6
...

[ 1604.310526] PC is at cfg80211_mgd_wext_connect+0x68/0x18c [cfg80211]
[ 1604.317800] LR is at rtnl_is_locked+0x20/0x24

seems it is happening in cfg80211_mgd_wext_connect, for more you can add some debug prints to find the right location

try to update code first to latest 5.15 (./build.sh updatesrc), maybe it is already fixed

i see you use 5.15.117 which is quite old...5.15 is now at 156 (my repo was at 149)...updated now my repo to latest...maybe it solves your issue.

if you still have the issue you can try debugging it:

https://elinux.org/Debugging_by_printing
https://elixir.bootlin.com/linux/v5.15.156/source/net/wireless/wext-sme.c#L18

seems commit 4d3b2bd breaks r2 wifi driver...i try to fix this...

Thank you very much.
The latest update works well. I could run 2.4Ghz interface (I didn't tested 5Ghz yet but I guess it works fine too)