Bug 216530

Summary: Realtek 8821CE Failed to power on mac
Product: Networking Reporter: Manuel C. (sir.louen)
Component: WirelessAssignee: networking_wireless (networking_wireless)
Status: NEW ---    
Severity: blocking CC: feidegg
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 6.0.0-rc6 Subsystem:
Regression: No Bisected commit-id:

Description Manuel C. 2022-09-25 19:01:56 UTC
I've been testing multiple drivers for Realtek 8821CE wireless chipset without success. The two DKMS ones (tomaspinho and Launchpad one) are definitely not working, but following some conversations, I've found that rtw88_8821ce has integrated some patches in order to solve certain BIOS energy issues.

Here is my dmesg log:

  291.346534] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  291.346889] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  291.347659] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[  291.419302] rtw_8821ce 0000:01:00.0: Firmware version 24.11.0, H2C version 12
[  291.426221] rtw_8821ce 0000:01:00.0: mac power on failed
[  291.426235] rtw_8821ce 0000:01:00.0: failed to power on mac
[  291.426238] rtw_8821ce 0000:01:00.0: failed to setup chip efuse info
[  291.426241] rtw_8821ce 0000:01:00.0: failed to setup chip information
[  291.466757] rtw_8821ce: probe of 0000:01:00.0 failed with error -114

I have compiled for this purpose Linux 6.0.0-rc6 just be 100% sure that I have all the latest patches for this driver, still wlan card doesn't go up.

I have to say that lwfinger/rtw88 (https://github.com/lwfinger/rtw88 ) driver has reported me some degree of success (although it drops with "failed to power on mac" now and then. But I've been able to use it more extensively. 

My target is to make rtw88_8821ce functional if possible. If any further information for debugging to provide is necessary, please contact me.
Comment 1 Manuel C. 2022-09-26 18:47:38 UTC
Doing further research on this issue, today I've found that under this protocol the wlan chipset works 100% of the time (and fails 100% of the times).

1. First, I have to turn down the computer without the power cord
2. Then after the OS has fully loaded I have to plug the power cord and reload the module (modprobe -r rtw_8821ce && modprobe rtw_8221ce)

As soon as I unplug the power cord, the connection drops.

If I check dmesg after I unplug the power cord here is the log:

[  196.003957] rtw_8821ce 0000:01:00.0: failed to send h2c command
[  196.007063] rtw_8821ce 0000:01:00.0: failed to send h2c command
[  197.645024] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  197.645262] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  197.645487] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  197.645712] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  197.645934] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  197.646157] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  197.649266] rtw_8821ce 0000:01:00.0: failed to send h2c command
[  197.649884] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  197.650140] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  197.650357] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  197.650577] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  197.650799] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  197.651020] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  199.651183] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[  199.661449] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  199.661675] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  199.661907] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  199.662121] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  199.662329] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  199.662546] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  201.762292] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[  201.762319] rtw_8821ce 0000:01:00.0: mac power on failed
[  201.762325] rtw_8821ce 0000:01:00.0: failed to power on mac
[  201.762331] rtw_8821ce 0000:01:00.0: leave idle state failed
[  201.762521] rtw_8821ce 0000:01:00.0: failed to leave ips state
[  201.762531] rtw_8821ce 0000:01:00.0: failed to leave idle state
[  201.762796] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  201.763026] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  201.763233] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  201.763441] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  201.763696] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  201.763915] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  201.764147] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  201.764367] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  201.764586] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  201.764850] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  201.765071] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  201.765290] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  201.957272] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[  201.957511] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[  201.957732] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[  201.957952] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[  201.958186] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[  201.958405] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[  203.958496] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
Comment 2 Q. Chen 2023-01-08 16:24:40 UTC
I tested three laptops with rtl8821ce card with my same system copy:


first one works well with /etc/tlp.conf with PCIE_ASPM_ON_AC(BAT)=powersupersave and RUNTIME_PM_ON_AC(BAT)=auto
both kernel's rtw88_8821ce and rtl8821dce(from github tomaspinho) can work.
------------------------------------------------------------------------------

second one works well with /etc/tlp.conf with PCIE_ASPM_ON_AC(BAT)=powersupersave and RUNTIME_PM_ON_AC(BAT)=auto, but need RUNTIME_PM_DENYLIST="01:00.0" or both RUNTIME_PM_DISABLE="01:00.0"

if without DENYLIST or DISABLE pcice address, dmesg will report this:
https://bbs.archlinux.org/viewtopic.php?id=281984

both kernel's rtw88_8821ce and rtl8821dce(from github tomaspinho).
------------------------------------------------------------------------------

recently, third one i tested, it is so weird, it can not work, 

[    5.689085] rtw_8821ce 0000:01:00.0: Firmware version 24.11.0, H2C version 12
[    5.690922] rtw_8821ce 0000:01:00.0: enabling device (0000 -> 0003)
[    5.711347] rtw_8821ce 0000:01:00.0: mac power on failed
[    5.711357] rtw_8821ce 0000:01:00.0: failed to power on mac
[    5.711359] rtw_8821ce 0000:01:00.0: failed to setup chip efuse info
[    5.711361] rtw_8821ce 0000:01:00.0: failed to setup chip information
[    5.741419] rtw_8821ce: probe of 0000:01:00.0 failed with error -114

but sometimes randomly work after bios removed battery(totally remove bios power), or comment(uncomment) PCIE_ASPM_ON_AC(BAT)= line and RUNTIME_PM_ON_AC(BAT)= line in /etc/tlp.conf and totally power off, wait a while, then reboot. comment or uncomment lines I don't know, just try it.

finally, the third one I found a situation that 8821ce can work steadily,  just need reload the rtw88_8821ce driver module, then it work.

for further, i add script to systemd boot progress:

#! /bin/bash
sleep 3s && modprobe -r rtw88_8821ce && modprobe rtw88_8821ce 

it need 'sleep 3s' to wait some second to reload it. if without the seconds, driver can not work properly.(only rtw88_8821ce work, 8821ce from tomaspinho not work)
=======================================================================

so, it is so weird. I think maybe it's because the non-standard bios or different revision of rtl8821ce hardware.

just write these stuff here and maybe give some help to someone need it or the developers to improve these drivers. if need more log or test, please contact me.
Comment 3 Q. Chen 2023-01-09 03:19:08 UTC
after system suspend or hibernate, rtw88_8821ce will also fail, demsg log seems a little different:

[ 5935.093536] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 5937.094767] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 5937.094789] rtw_8821ce 0000:01:00.0: mac power on failed
[ 5937.094793] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 5939.097290] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 5939.097312] rtw_8821ce 0000:01:00.0: mac power on failed
[ 5939.097315] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 5941.097890] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 5941.097909] rtw_8821ce 0000:01:00.0: mac power on failed
[ 5941.097911] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 5953.017304] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 5953.017323] rtw_8821ce 0000:01:00.0: mac power on failed
[ 5953.017326] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 7213.014959] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 7213.014981] rtw_8821ce 0000:01:00.0: mac power on failed
[ 7213.014984] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 7213.014987] rtw_8821ce 0000:01:00.0: leave idle state failed
[ 7213.018229] rtw_8821ce 0000:01:00.0: failed to send h2c command
[ 7213.018239] rtw_8821ce 0000:01:00.0: failed to leave ips state
[ 7213.018241] rtw_8821ce 0000:01:00.0: failed to leave idle state
[ 7213.018513] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[ 7213.018738] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[ 7213.018978] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[ 7213.019202] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[ 7213.019422] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[ 7213.019647] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[ 7213.019888] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[ 7213.020112] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[ 7213.020337] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[ 7213.020556] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[ 7213.020780] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[ 7213.021007] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[ 7214.095401] rtw_8821ce 0000:01:00.0: failed to send h2c command
[ 7216.949096] rtw_8821ce 0000:01:00.0: failed to send h2c command
[ 7216.952193] rtw_8821ce 0000:01:00.0: failed to send h2c command
[ 7216.952434] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[ 7216.952660] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[ 7216.952885] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[ 7216.953109] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[ 7216.953334] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[ 7216.953558] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[ 7218.953741] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 7220.953975] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 7220.953997] rtw_8821ce 0000:01:00.0: mac power on failed
[ 7220.954000] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 7220.954003] rtw_8821ce 0000:01:00.0: leave idle state failed
[ 7220.954154] rtw_8821ce 0000:01:00.0: failed to leave ips state
[ 7220.954156] rtw_8821ce 0000:01:00.0: failed to leave idle state
[ 7231.526302] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[0]
[ 7231.526532] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[1]
[ 7231.526753] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[2]
[ 7231.526973] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[3]
[ 7231.527193] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[5]
[ 7231.527409] rtw_8821ce 0000:01:00.0: timed out to flush pci tx ring[6]
[ 7233.527566] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 7235.628431] rtw_8821ce 0000:01:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[ 7235.628447] rtw_8821ce 0000:01:00.0: mac power on failed
[ 7235.628450] rtw_8821ce 0000:01:00.0: failed to power on mac
[ 7235.628453] rtw_8821ce 0000:01:00.0: leave idle state failed
[ 7235.628603] rtw_8821ce 0000:01:00.0: failed to leave ips state
[ 7235.628606] rtw_8821ce 0000:01:00.0: failed to leave idle state

---------------------------------------------------

do reload the driver module will bring the wifi back:
# sleep 3s && modprobe -r rtw88_8821ce && modprobe rtw88_8821ce