ulli-kroll/rtw88-usb

rtw_8821cu fails to load on aarch64 kernel 5.4.70 with embedded USB

Opened this issue · 11 comments

Pix13 commented

Hi, i'm doing a quick package of your driver as an OpenWRT feed ( https://github.com/Pix13/openwrt-rtw88-usb-feed ), to use on a Rock Pi E SBC, but when loading the driver outputs a warning, and fails to load:

[ 7.174342] rtw_8821cu 1-1:1.2: USB: 2
[ 7.194416] rtw_8821cu 1-1:1.2: Firmware version 24.5.0, H2C version 12
[ 7.463526] ------------[ cut here ]------------
[ 7.463945] wiphy should have REGULATORY_CUSTOM_REG
[ 7.464478] WARNING: CPU: 0 PID: 254 at backports-5.8-1/net/wireless/reg.c:2349 wiphy_apply_custom_regulatory+0xb0/0x230 [cfg80211]
[ 7.465507] Modules linked in: rtw88_8821cu(+) rtw88_8821c pppoe ppp_async iptable_nat xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD rtw88_usb rtw88_core pppox ppp_generic nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack mac80211 ipt_REJECT cfg80211 xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG wireguard slhc nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_filter ip_tables crc_ccitt compat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 ip6_udp_tunnel udp_tunnel gpio_button_hotplug
[ 7.470566] CPU: 0 PID: 254 Comm: kmodloader Not tainted 5.4.70 #0
[ 7.471104] Hardware name: Radxa ROCK Pi E (DT)
[ 7.471501] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 7.471927] pc : wiphy_apply_custom_regulatory+0xb0/0x230 [cfg80211]
[ 7.472487] lr : wiphy_apply_custom_regulatory+0xb0/0x230 [cfg80211]
[ 7.473040] sp : ffff800011483830
[ 7.473331] x29: ffff800011483830 x28: ffff80001012bda0
[ 7.473796] x27: 00000000ffffffed x26: ffff800010968be8
[ 7.474262] x25: 0000000fffffffe0 x24: ffff800008a374f8
[ 7.474726] x23: ffff00003b006a40 x22: ffff00003b0002e0
[ 7.475190] x21: ffff800008a354c0 x20: ffff00003b0002e0
[ 7.475656] x19: ffff00003b002640 x18: 000000000000001b
[ 7.476120] x17: 000000000000003d x16: 0000000000000004
[ 7.476584] x15: ffff00003b002813 x14: ffff800010c0f090
[ 7.477049] x13: 0000000000000000 x12: ffff800010c0e000
[ 7.477513] x11: ffff800010b9a000 x10: 0000000000000010
[ 7.477977] x9 : 0000000000000000 x8 : 5355435f59524f54
[ 7.478442] x7 : 414c554745522065 x6 : 0000000000000136
[ 7.478906] x5 : 0000000000000000 x4 : 0000000000000000
[ 7.479370] x3 : 00000000ffffffff x2 : ffff800010b9a0a8
[ 7.479836] x1 : ffff00003c5ad080 x0 : 0000000000000027
[ 7.480300] Call trace:
[ 7.480524] wiphy_apply_custom_regulatory+0xb0/0x230 [cfg80211]
[ 7.481054] rtw_regd_init+0x13c/0x148 [rtw88_core]
[ 7.481485] rtw_register_hw+0x114/0x2f8 [rtw88_core]
[ 7.481928] rtw_usb_probe+0x4d0/0x1a78 [rtw88_usb]
[ 7.482358] 0xffff800008a8d014
[ 7.482641] usb_probe_interface+0xe8/0x280
[ 7.483012] really_probe+0xd4/0x328
[ 7.483328] driver_probe_device+0x54/0xe8
[ 7.483687] device_driver_attach+0x6c/0x78
[ 7.484055] __driver_attach+0x54/0xd0
[ 7.484385] bus_for_each_dev+0x60/0x98
[ 7.484723] driver_attach+0x20/0x28
[ 7.485038] bus_add_driver+0x178/0x1d8
[ 7.485374] driver_register+0x60/0x110
[ 7.485711] usb_register_driver+0x78/0x148
[ 7.486079] init_module+0x28/0x1000 [rtw88_8821cu]
[ 7.486510] do_one_initcall+0x74/0x1c8
[ 7.486851] do_init_module+0x50/0x1f0
[ 7.487181] load_module+0x1c2c/0x2088
[ 7.487512] __do_sys_init_module+0x154/0x200
[ 7.487894] __arm64_sys_init_module+0x18/0x20
[ 7.488287] el0_svc_common.constprop.1+0x7c/0x100
[ 7.488707] el0_svc_handler+0x20/0x80
[ 7.489037] el0_svc+0x8/0x200
[ 7.489305] ---[ end trace 4f0b9426f1b54e2a ]---
[ 7.489787] ------------[ cut here ]------------
[ 7.490204] WARNING: CPU: 0 PID: 254 at backports-5.8-1/net/wireless/reg.c:2363 wiphy_apply_custom_regulatory+0xbc/0x230 [cfg80211]
[ 7.491231] Modules linked in: rtw88_8821cu(+) rtw88_8821c pppoe ppp_async iptable_nat xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD rtw88_usb rtw88_core pppox ppp_generic nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack mac80211 ipt_REJECT cfg80211 xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG wireguard slhc nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_filter ip_tables crc_ccitt compat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 ip6_udp_tunnel udp_tunnel gpio_button_hotplug
[ 7.496276] CPU: 0 PID: 254 Comm: kmodloader Tainted: G W 5.4.70 #0
[ 7.496933] Hardware name: Radxa ROCK Pi E (DT)
[ 7.497330] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 7.497756] pc : wiphy_apply_custom_regulatory+0xbc/0x230 [cfg80211]
[ 7.498316] lr : wiphy_apply_custom_regulatory+0xb0/0x230 [cfg80211]
[ 7.498869] sp : ffff800011483830
[ 7.499160] x29: ffff800011483830 x28: ffff80001012bda0
[ 7.499626] x27: 00000000ffffffed x26: ffff800010968be8
[ 7.500090] x25: ffff00003b000c18 x24: ffff800008a374f8
[ 7.500555] x23: 0000000000000000 x22: ffff00003b0002e0
[ 7.501019] x21: ffff00003b000c18 x20: 0000000000000000
[ 7.501483] x19: ffff00003b002640 x18: 000000000000001b
[ 7.501948] x17: 000000000000003d x16: 0000000000000004
[ 7.502412] x15: ffff00003b002813 x14: ffff800010c0f090
[ 7.502876] x13: 0000000000000000 x12: ffff800010c0e000
[ 7.503341] x11: ffff800010b9a000 x10: 0000000000000010
[ 7.503805] x9 : 0000000000000000 x8 : 5355435f59524f54
[ 7.504269] x7 : 414c554745522065 x6 : 0000000000000136
[ 7.504734] x5 : 0000000000000000 x4 : 0000000000000000
[ 7.505198] x3 : 00000000ffffffff x2 : ffff800010b9a0a8
[ 7.505662] x1 : ffff00003c5ad080 x0 : 0000000000000001
[ 7.506126] Call trace:
[ 7.506349] wiphy_apply_custom_regulatory+0xbc/0x230 [cfg80211]
[ 7.506879] rtw_regd_init+0x13c/0x148 [rtw88_core]
[ 7.507309] rtw_register_hw+0x114/0x2f8 [rtw88_core]
[ 7.507751] rtw_usb_probe+0x4d0/0x1a78 [rtw88_usb]
[ 7.508179] 0xffff800008a8d014
[ 7.508456] usb_probe_interface+0xe8/0x280
[ 7.508826] really_probe+0xd4/0x328
[ 7.509141] driver_probe_device+0x54/0xe8
[ 7.509501] device_driver_attach+0x6c/0x78
[ 7.509868] __driver_attach+0x54/0xd0
[ 7.510198] bus_for_each_dev+0x60/0x98
[ 7.510535] driver_attach+0x20/0x28
[ 7.510850] bus_add_driver+0x178/0x1d8
[ 7.511187] driver_register+0x60/0x110
[ 7.511523] usb_register_driver+0x78/0x148
[ 7.511892] init_module+0x28/0x1000 [rtw88_8821cu]
[ 7.512319] do_one_initcall+0x74/0x1c8
[ 7.512658] do_init_module+0x50/0x1f0
[ 7.512988] load_module+0x1c2c/0x2088
[ 7.513318] __do_sys_init_module+0x154/0x200
[ 7.513700] __arm64_sys_init_module+0x18/0x20
[ 7.514091] el0_svc_common.constprop.1+0x7c/0x100
[ 7.514511] el0_svc_handler+0x20/0x80
[ 7.514841] el0_svc+0x8/0x200
[ 7.515109] ---[ end trace 4f0b9426f1b54e2b ]---
[ 7.515648] ------------[ cut here ]------------
[ 7.516066] WARNING: CPU: 0 PID: 254 at backports-5.8-1/net/wireless/core.c:872 wiphy_register+0x980/0x9d0 [cfg80211]
[ 7.516986] Modules linked in: rtw88_8821cu(+) rtw88_8821c pppoe ppp_async iptable_nat xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD rtw88_usb rtw88_core pppox ppp_generic nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack mac80211 ipt_REJECT cfg80211 xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG wireguard slhc nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_filter ip_tables crc_ccitt compat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 ip6_udp_tunnel udp_tunnel gpio_button_hotplug
[ 7.522029] CPU: 0 PID: 254 Comm: kmodloader Tainted: G W 5.4.70 #0
[ 7.522686] Hardware name: Radxa ROCK Pi E (DT)
[ 7.523083] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 7.523509] pc : wiphy_register+0x980/0x9d0 [cfg80211]
[ 7.523983] lr : ieee80211_register_hw+0x800/0xb98 [mac80211]
[ 7.524484] sp : ffff800011483780
[ 7.524774] x29: ffff800011483780 x28: ffff00003b0025d0
[ 7.525239] x27: 0000000000000000 x26: 0000000000000000
[ 7.525703] x25: 0000000000000000 x24: ffff8000089a1b90
[ 7.526168] x23: ffff8000089a1b88 x22: 0000000000000004
[ 7.526632] x21: 0000000000000928 x20: ffff00003afffee0
[ 7.527096] x19: ffff00003b000f80 x18: 0000000000000014
[ 7.527561] x17: 00000000163a3589 x16: 000000003a4db370
[ 7.528025] x15: 00000000e308aee7 x14: 0000000025c6dc4e
[ 7.528489] x13: 00000000b5c5a8b2 x12: 00000000ffffffbd
[ 7.528954] x11: ffff800008918d40 x10: ffff00003b000bf8
[ 7.529418] x9 : 0000000000000003 x8 : 000000007fffffff
[ 7.529882] x7 : 0000000000000003 x6 : 0000000013121706
[ 7.530347] x5 : 0000000000000004 x4 : 0000000000000000
[ 7.530811] x3 : 0000000000000000 x2 : 0000000000000000
[ 7.531275] x1 : 0000000000000000 x0 : ffff00003b0002e0
[ 7.531740] Call trace:
[ 7.531962] wiphy_register+0x980/0x9d0 [cfg80211]
[ 7.532392] ieee80211_register_hw+0x800/0xb98 [mac80211]
[ 7.532869] rtw_register_hw+0x11c/0x2f8 [rtw88_core]
[ 7.533312] rtw_usb_probe+0x4d0/0x1a78 [rtw88_usb]
[ 7.533739] 0xffff800008a8d014
[ 7.534018] usb_probe_interface+0xe8/0x280
[ 7.534388] really_probe+0xd4/0x328
[ 7.534703] driver_probe_device+0x54/0xe8
[ 7.535063] device_driver_attach+0x6c/0x78
[ 7.535431] __driver_attach+0x54/0xd0
[ 7.535761] bus_for_each_dev+0x60/0x98
[ 7.536098] driver_attach+0x20/0x28
[ 7.536413] bus_add_driver+0x178/0x1d8
[ 7.536749] driver_register+0x60/0x110
[ 7.537086] usb_register_driver+0x78/0x148
[ 7.537455] init_module+0x28/0x1000 [rtw88_8821cu]
[ 7.537882] do_one_initcall+0x74/0x1c8
[ 7.538220] do_init_module+0x50/0x1f0
[ 7.538551] load_module+0x1c2c/0x2088
[ 7.538881] __do_sys_init_module+0x154/0x200
[ 7.539263] __arm64_sys_init_module+0x18/0x20
[ 7.539654] el0_svc_common.constprop.1+0x7c/0x100
[ 7.540074] el0_svc_handler+0x20/0x80
[ 7.540403] el0_svc+0x8/0x200
[ 7.540671] ---[ end trace 4f0b9426f1b54e2c ]---
[ 7.541154] rtw_8821cu 1-1:1.2: failed to register hw
[ 7.541609] rtw_8821cu 1-1:1.2: failed to register hw
[ 7.542247] rtw_8821cu: probe of 1-1:1.2 failed with error -22
[ 7.542876] usbcore: registered new interface driver rtw_8821cu

As you can see, the kernel-side wireless code seems to be a 5.8 backport, maybe it's not yet supported on your sire ?

Seems to work fine within 5.10rc* kernel.
Maybe 'ts a CONFIG setting?

Also true for me with v5.10.rc on
x86_64 some random APU board
arm64 Marvell EspressoBin
armv5 pogoplug 4

with rtw8821 I have currently some issue with my devices no STA/AP
#14

Pix13 commented

Also true for me with v5.10.rc on
x86_64 some random APU board
arm64 Marvell EspressoBin
armv5 pogoplug 4

with rtw8821 I have currently some issue with my devices no STA/AP
#14

I have began to merge a patch from rtw88 on my tree of rtw88-usb related to that:

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
tasklet_init(&rtwdev->tx_tasklet, rtw_tx_tasklet,
(unsigned long)rtwdev);
#else
tasklet_setup(&rtwdev->tx_tasklet, rtw_tx_tasklet);
#endif

with parts of lwfinger/rtw88@d868001 and lwfinger/rtw88@5c35dba

Is there a kernel configuration option to force the use of the "old" tasklet init function ?

Is there a kernel configuration option to force the use of the "old" tasklet init function ?

NO

tasklet_setup() is introduced in v5.8 and the old one tasklet_init()
will at sometime in near future go away.
as latest -next with next-20201209 this symbol s still in.

latest upstream rtw88 in v5.10-rc1 uses already new tasklet_setup()

I've not updated to my master branch with latest changes in rtw88, but I will do this,
in the next couple of day.
Which will also remove the REGULATORY_CUSTOM_REG warning, which is the real issue (I think)
This will cause some problems, as you have detect yourself :-)
So I need to setup some "backport" branch(es)

In the meantime I sync rtw88-usb to some sane version, so I can do
git filter-branch <directory>--subdirectory-filter <directory>
so I can
git cherry-pick
upstream rtw88 changes

please read
Documentation/process/stable-api-nonsense.rst
if you are curious about these changes

Pix13 commented

tasklet_setup() is introduced in v5.8 and the old one tasklet_init()

Which will also remove the REGULATORY_CUSTOM_REG warning, which is the real issue (I think)

Yes :) But the tasklet init is also an issue because some time after i posted here, when i dug into it, i discovered that OpenWRT, while using a 5.4 kernel, uses a backport of 5.10 for all the network part ( i guess the wifi support is way better), hence the tasklet init/setup issue piling on the regulatory custom reg one.

Very glad to know you plan to merge the latest changes of rtw88, i'll wait for it :) ( i'm a vaguely-coding-aware hacker, my merge is probably a train wreck )

please use backports branch
compile tested with v5.4

most of the changes from v5.10 are there
I've discovered some issues with

  • failed to wait usb ctrl req
  • failed to get rx_queue, overflow

first one is due the (in my opinion) wrongly usb control message handling with a callback function.
I must verify this with the mt76 driver.

second one gets looked after first one ;-)

they some rtw88 changes pending in -next

Pix13 commented

Ok thank you very much! i'll wait for an update of backports branch then ( still have the "wiphy should have REGULATORY_CUSTOM_REG" error that prevents the driver from registering)

Do you think i could get a patch from rtw88 to apply it on backport branch for the time being? i'm gonna dig in the commits

damn I missed the changes in regd.c from upstream, before v5.9
-master and -backports have already lastest fixes which are in upcoming v511-rc1

I must also diff some other files.
And the usb control stuff is almost ready ...

Pix13 commented

Yeah you're doing a tremendous amount of work i can see that.. i tried to update just the rtw_regd_init_wiphy() function with upstream init ( see Pix13@281ad0c ) but it was not enough, i don't have the "wiphy should have REGULATORY_CUSTOM_REG" error anymore but the driver still crashes when it tries to load. I'm gonna make a full diff and see what other differences i could try to add too

Pix13 commented

Hi,
I've just tried your latest commits on branch backports ( 55687e7 ) but as the regulatory error went out, i still have an initialization failure that looks related to wiphy_register:

[    7.267853] rtw_8821cu 1-1:1.2: USB: 2
[    7.285403] rtw_8821cu 1-1:1.2: Firmware version 24.5.0, H2C version 12
[    7.557762] ------------[ cut here ]------------
[    7.558219] WARNING: CPU: 1 PID: 250 at backports-5.8-1/net/wireless/core.c:872 wiphy_register+0x980/0x9d0 [cfg80211]
[    7.559140] Modules linked in: rtw88_8821cu(+) rtw88_8821c pppoe ppp_async rtw88_usb rtw88_core pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject_bridge nft_reject nft_redir nft_quota nft_objref nft_numgen nf
t_meta_bridge nft_log nft_limit nft_hash nft_fwd_netdev nft_dup_netdev nft_ct nft_counter nf_tables_set nf_tables nf_conntrack_netlink mac80211 iptable_nat ipt_REJECT cfg80211 cdc_ether xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt
_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_MASQUERADE xt_LOG xt_HL xt_FLOWOFFLOAD xt_DSCP xt_CT xt_CL
ASSIFY wireguard usbnet slhc sch_cake nfnetlink nf_reject_ipv4 nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_dup_netdev nf_conntrack_rtcache nf_conncount iptable_raw iptable_mangle iptable_filter ipt_ECN ipheth ip_tables crc_ccitt 
compat act_connmark nf_conntrack nf_defrag_ipv6
[    7.559248]  nf_defrag_ipv4 sch_tbf sch_ingress sch_htb sch_hfsc em_u32 cls_u32 cls_tcindex cls_route cls_matchall cls_fw cls_flow cls_basic act_skbedit act_mirred nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip
6t_REJECT x_tables nf_reject_ipv6 ifb ip6_udp_tunnel udp_tunnel gpio_button_hotplug
[    7.569239] CPU: 1 PID: 250 Comm: kmodloader Not tainted 5.4.70 #0
[    7.569779] Hardware name: Radxa ROCK Pi E (DT)
[    7.570178] pstate: 60000005 (nZCv daif -PAN -UAO)
[    7.570626] pc : wiphy_register+0x980/0x9d0 [cfg80211]
[    7.571113] lr : ieee80211_register_hw+0x800/0xb98 [mac80211]
[    7.571614] sp : ffff800011483780
[    7.571904] x29: ffff800011483780 x28: ffff00003b1825d0 
[    7.572369] x27: 0000000000000000 x26: 0000000000000000 
[    7.572833] x25: 0000000000000000 x24: ffff800008b5cb90 
[    7.573298] x23: ffff800008b5cb88 x22: 0000000000000004 
[    7.573763] x21: 0000000000000928 x20: ffff00003b17fee0 
[    7.574227] x19: ffff00003b180f80 x18: 0000000000000014 
[    7.574692] x17: 00000000ff4e471e x16: 0000000020809f98 
[    7.575156] x15: 0000000044a05909 x14: 00000000b214e7f6 
[    7.575620] x13: 000000005146950f x12: 00000000ffffffbd 
[    7.576084] x11: ffff800008ae5d40 x10: ffff00003b180bf8 
[    7.576549] x9 : 0000000000000003 x8 : 000000007fffffff 
[    7.577013] x7 : 0000000000000003 x6 : 0000000013121706 
[    7.577477] x5 : 0000000000000004 x4 : 0000000000000000 
[    7.577942] x3 : 0000000000000000 x2 : 0000000000000000 
[    7.578406] x1 : 0000000000000000 x0 : ffff00003b1802e0 
[    7.578872] Call trace:
[    7.579098]  wiphy_register+0x980/0x9d0 [cfg80211]
[    7.579530]  ieee80211_register_hw+0x800/0xb98 [mac80211]
[    7.580010]  rtw_register_hw+0x11c/0x2f8 [rtw88_core]
[    7.580453]  rtw_usb_probe+0x354/0x1a80 [rtw88_usb]
[    7.580883]  init_module+0x3ed014/0x3ed01c [rtw88_8821cu]
[    7.581360]  usb_probe_interface+0xe8/0x280
[    7.581734]  really_probe+0xd4/0x328
[    7.582050]  driver_probe_device+0x54/0xe8
[    7.582409]  device_driver_attach+0x6c/0x78
[    7.582776]  __driver_attach+0x54/0xd0
[    7.583106]  bus_for_each_dev+0x60/0x98
[    7.583442]  driver_attach+0x20/0x28
[    7.583757]  bus_add_driver+0x178/0x1d8
[    7.584096]  driver_register+0x60/0x110
[    7.584432]  usb_register_driver+0x78/0x148
[    7.584799]  init_module+0x28/0x1000 [rtw88_8821cu]
[    7.585229]  do_one_initcall+0x74/0x1c8
[    7.585572]  do_init_module+0x50/0x1f0
[    7.585902]  load_module+0x1c2c/0x2088
[    7.586231]  __do_sys_init_module+0x154/0x200
[    7.586615]  __arm64_sys_init_module+0x18/0x20
[    7.587008]  el0_svc_common.constprop.1+0x7c/0x100
[    7.587428]  el0_svc_handler+0x20/0x80
[    7.587756]  el0_svc+0x8/0x200
[    7.588027] ---[ end trace 18f0159d810162b0 ]---
[    7.588535] rtw_8821cu 1-1:1.2: failed to register hw
[    7.588984] rtw_8821cu 1-1:1.2: failed to register hw
[    7.589684] rtw_8821cu: probe of 1-1:1.2 failed with error -22