openwrt / mt76

mac80211 driver for MediaTek MT76x0e, MT76x2e, MT7603, MT7615, MT7628 and MT7688
747 stars 342 forks source link

mt7921e: probe of 0000:02:00.0 failed with error -5 #548

Open Roman- opened 3 years ago

Roman- commented 3 years ago

Running Ubuntu 21.04 on my ASUS ROG Zephyrus G14. Kernel version: 5.12.10. In the network settings, it says No Wi-Fi Adapter Found.

rfkill list all

0: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

lshw -C network

*-network UNCLAIMED       
       description: Network controller
       product: MEDIATEK Corp.
       vendor: MEDIATEK Corp.
       physical id: 0
       bus info: pci@0000:02:00.0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm cap_list
       configuration: latency=0
       resources: iomemory:fe0-fdf iomemory:fe0-fdf iomemory:fe0-fdf memory:fe20300000-fe203fffff memory:fe20400000-fe20403fff memory:fe20404000-fe20404fff

/var/log/syslog

Jun 12 19:13:29 rog-laptop kernel: [    3.190487] Error: Driver 'asus' is already registered, aborting...
Jun 12 19:13:29 rog-laptop kernel: [    3.190685] usbcore: registered new interface driver btusb
Jun 12 19:13:29 rog-laptop kernel: [    3.202090] mt7921e 0000:02:00.0: enabling device (0000 -> 0002)
Jun 12 19:13:29 rog-laptop kernel: [    3.202805] mt7921e 0000:02:00.0: disabling ASPM  L1
Jun 12 19:13:29 rog-laptop kernel: [    3.203087] mt7921e 0000:02:00.0: ASIC revision: 79610010
...
Jun 12 19:13:29 rog-laptop kernel: [    3.205066] mt7921e: probe of 0000:02:00.0 failed with error -5
Jun 12 19:13:29 rog-laptop kernel: [    3.206692] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
Jun 12 19:13:29 rog-laptop kernel: [    3.209335] kvm: Nested Virtualization enabled
Jun 12 19:13:29 rog-laptop kernel: [    3.209358] SVM: kvm: Nested Paging enabled
...

I have Windows 10 insalled on this PC as well, and Wi-Fi works fine there. Fast boot is disabled. Secure boot disabled.

Any suggestions?

aelzenaar commented 2 years ago

@rnestler

I am now on 5.15.18 and still having wifi problems, it now works on boot but after a random period of time it just stops - for instance if I run ping 8.8.8.8 it displays no output for 2min or so before failing with "destination host unreadable", and if I try to use the plasma network manager to disconnect and reconnect from the wifi it hangs and the fan spins up to full. After this, poweroff hangs with a stop job waiting for dhcpcd and NetworkManager and on reboot I need to reset the firmware again before wifi will start working again. No problem with the GPU so far as I can see though, but I don't use standby mode that often.

benat12 commented 2 years ago

I have an Asus Vivobook pro 15, with mediatek WiFi ( mt7921e driver). With kernel 5.15.13, WiFi and Bluetooth work perfect but after suspend WiFi not working. Bluetooth continue to work as expected after suspend. Also if I try to shutdown, not work and I need to press power button for few seconds to force shutdown. I tried to install version 5.16 but failed to start with it. I have dual boot with win10, I try it with fast boot disabled and enabled, no difference. Only solution for moment is to disable suspend and hibernate.

Hi! I actually have the same problem on the same computer. I've tried different solutions and used newer kernels, but as I am just starting with Ubuntu many of the fixes in this issue are beyond my understanding. If you've (or any other) found a way to solving this, please write back as I'm currently forced to be plugged in via ethernet or switching off and on the computer every time I want it to suspend.

aelzenaar commented 2 years ago

@benat12 Try downgrading to 5.14, that should fix it.

benat12 commented 2 years ago

@aelzenaar Thanks for the help, but either I'm doing something wrong as I install the kernels (I'm using ubuntu mainline) or the problem arises from another place. I've recently seen that not only does the wifi not work, but when I suspend the device it slows down heavily, I can't do any sudo commands and generaly the only option is a complete shut off by pressing the power button, as the power off option in ubuntu needs a long time to shut things off.

aelzenaar commented 2 years ago

@benat12 As you see above this is a known problem with this hardware and recent kernels, if the problem persists after downgrading I suggest you open a post on e.g. the Ubuntu forums and provide your dmesg output & other logs there.

JuanuSt commented 2 years ago

System Information Manufacturer: ASUSTeK COMPUTER INC. Product Name: ASUS TUF Gaming A17 FA706QM_FA706QM

Kernel Linux 5.12.15-051215-generic #202107080949-Ubuntu

Error dmesg: mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin failed with error -2

Solution Download 3 files from https://anduin.linuxfromscratch.org/sources/linux-firmware/mediatek/ and copy to firmware directory

cd /lib/firmware/mediatek/ wget https://anduin.linuxfromscratch.org/sources/linux-firmware/mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin wget https://anduin.linuxfromscratch.org/sources/linux-firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin wget https://anduin.linuxfromscratch.org/sources/linux-firmware/mediatek/WIFI_RAM_CODE_MT7961_1.bin

One year ago I resolved the wifi problem with the steps described above. This dirty hack works fine with wifi (still you have to shutdown/start to make the wifi works) but not with bluetooth.

It looks like is loaded, but not:

[ 10.387820] Bluetooth: Core ver 2.22 [ 10.387854] NET: Registered protocol family 31 [ 10.387855] Bluetooth: HCI device and connection manager initialized [ 10.387860] Bluetooth: HCI socket layer initialized [ 10.387863] Bluetooth: L2CAP socket layer initialized [ 10.387867] Bluetooth: SCO socket layer initialized [ 10.400462] loop6: detected capacity change from 0 to 113680 [ 10.400581] loop7: detected capacity change from 0 to 333552 ... [ 10.449316] mt7921e 0000:03:00.0: enabling device (0000 -> 0002) [ 10.449812] mt7921e 0000:03:00.0: disabling ASPM L1 [ 10.449882] mt7921e 0000:03:00.0: ASIC revision: 79610010 [ 10.459479] MCE: In-kernel MCE decoding enabled. [ 10.459965] mt7921e 0000:03:00.0: HW/SW Version: 0x8a108a10, Build Time: 20211014150838a

vlad2005 commented 2 years ago

I tested the kernel version 5.15.20. The problem remained the same. Wifi does not work if I suspend my laptop. Otherwise, wifi and bluetooth work properly.

pythys commented 2 years ago

I did not do any testing yet, but it seems some fix has been made to 5.16. I don't know if we'll see the light at the end of the tunnel but it might be worth testing for anyone with free time.

chabad360 commented 2 years ago

On Arch (5.16.7) on an ASUS TUF F15 (FX506HM/TUF506HM), the WiFi works, but if I reboot I get a kernel panic (haven't tested sleep yet), however, I'm not sure it's always consistent (I just got this laptop yesterday).

9prady9 commented 2 years ago

On Arch (5.16.7) on an ASUS TUF F15 (FX506HM/TUF506HM), the WiFi works, but if I reboot I get a kernel panic (haven't tested sleep yet), however, I'm not sure it's always consistent (I just got this laptop yesterday).

Just updated to 5.16.7 , I can confirm similar behavior. It doesn't work on reboot.

EnlightenedBacon commented 2 years ago

I have this problem too on an ASUS Zephyrus S17. I don't know if this helps at all, but I suspect it isn't just an issue with the MediaTek wifi adaptor, but may be related to that adaptor and something with the BIOS in ASUS (and maybe MSI) laptops.

I swapped out my MT7921 for an Intel AX200 and while it worked perfectly while the computer was on in any Kernel version, occasionally it just wouldn't appear on boot and then need a hard reset to appear again.

Both wifi adaptors worked perfectly with Windows 10, so not a hardware issue. Perhaps the reason the bug is so obscure is because it's an interaction with some other specific device, rather than the adaptor on its own that's the problem?

aelzenaar commented 2 years ago

Definitely not a hardware issue, I had no trouble with the mt7921 driver before updating my kernel to the 5.16 series in January.

rnestler commented 2 years ago

Just updated to 5.16.7 , I can confirm similar behavior. It doesn't work on reboot.

I just tested 5.16.7-arch1-1 on my Lenovo P14s and Wifi seems to work, also after a reboot.

EnlightenedBacon commented 2 years ago

Just updated to 5.16.7 , I can confirm similar behavior. It doesn't work on reboot.

I just tested 5.16.7-arch1-1 on my Lenovo P14s and Wifi seems to work, also after a reboot.

I wonder if you being on a Lenovo and others being on an ASUS makes the difference. I know people are having trouble with the Intel AX200 and sometimes even integrated USB ports with ASUS Firmware 310 in particular, though 311 is reported to fix most of those issues.

haykeminyan commented 2 years ago

Asus Vivobook 16X Oled same effect. Now I am using ArchLinux with 5.16.8 kernel. Same effect. After rebooting isn't working. Hope to fix this bug soon in 5.17

aelzenaar commented 2 years ago

Can confirm my laptop is no longer crashing in the mediatek driver on the LTS kernel (5.15.24-1-lts - it was crashing in 5.15.17), I haven't tried the 5.16 line yet though.

vlad2005 commented 2 years ago

Can confirm my laptop is no longer crashing in the mediatek driver on the LTS kernel (5.15.24-1-lts - it was crashing in 5.15.17), I haven't tried the 5.16 line yet though.

But after suspend/resume wifi work ok?

hjpotter92 commented 2 years ago

Can confirm my laptop is no longer crashing in the mediatek driver on the LTS kernel (5.15.24-1-lts - it was crashing in 5.15.17), I haven't tried the 5.16 line yet though.

But after suspend/resume wifi work ok?

hibernate/resume no longer causes issues for 5.16.10 kernel for me

9prady9 commented 2 years ago

Can confirm my laptop is no longer crashing in the mediatek driver on the LTS kernel (5.15.24-1-lts - it was crashing in 5.15.17), I haven't tried the 5.16 line yet though.

But after suspend/resume wifi work ok?

hibernate/resume no longer causes issues for 5.16.10 kernel for me

I can't say the same I think, I did a reboot after kernel update and wifi didn't come up at all

woadey commented 2 years ago

I have an ASUS G15 with the MT7921. I downloaded ubuntu 21.10 which came with kernel 5.13. I read that the driver should be supported, but I was unable to get wifi to work. Things I tried:

I did check to ensure that my wifi driver was up-to-date and contained the patch files ( BT_RAM_CODE_MT7961_1_2_hdr.bin - WIFI_MT7961_patch_mcu_1_2_hdr.bin - and - WIFI_RAM_CODE_MT7961_1.bin) but no luck.

Just updated to 5.16.12 to test if the newer kernel would solve this problem, but still no luck. Bluetooth seems to be working though...

aelzenaar commented 2 years ago

@woadey Try the LTS kernel, I think 5.16 is still broken. 5.15.10 and later has working drivers for my laptop

woadey commented 2 years ago

@woadey Try the LTS kernel, I think 5.16 is still broken. 5.15.10 and later has working drivers for my laptop

After I posted, I saw your earlier comment so I tried 5.15.26 and still no luck. I can try an earlier version of the lts kernel I suppose.

Update: I was able to get the wifi working. I am unsure what the fix was, but here are the things I did:

trietphm commented 2 years ago

@woadey The wifi will work from kernel 5.14. The trick is that you need to shut down your laptop -> unplug your power -> start your laptop -> then you can plug your power again. Also, notice that restart with plugged power will result in no wifi adapter detected, you have to shut it down, unplug then start the laptop again.

pythys commented 2 years ago

In my specific case, the only problem I'm having is no wifi on reboot. Everything else is okay, I don't need to plug / unplug power or do anything. I just need to shutdown + power-up instead of reboot. Bluetooth + Wifi are working fine as long as I power up.

mdfahner commented 2 years ago

I've got the mt7921e wifi+bt on a desktop Asus B550 Tuf Gaming Plus motherboard. I had originally installed Ubuntu 20.04 and found no working wifi but after updating and moving to kernel 5.15.0-22-generic, wifi worked but bluetooth still did not.

I spent some time researching the problem and figured I'd try a new kernel as it seemed that drivers were introduced in later versions so I updated to 22.04 and the latest 5.16 and the latest RC of 5.17 and in each case, bt worked but wifi did not. lsmod showed bt and wifi, but I could not get wifi working.

Reviewing dmesg is what brought me here, I was getting probe of 0000:05:00.0 failed with error -110

I tried a full power off and power based on some of the feedback here to no avail. Being frustrated, I figured I'd rollback to kernel 5.15.0-22-generic as I wanted wifi over bt. Having rolled back, wifi worked so I set my grub settings back to normal, set the bios back to fast boot, and I had bt, no wifi. Lovely....

Back to the mb bios, fast boot off, and now I have wifi+bt on 5.15.0-22-generic (but on not-yet released 22.04 which is fine for how I intend to use this computer) and no error -110

I'm not sure on why disabling the fast boot in the bios resolved the issue, but I've got both bt+wifi going and am happy.

Perhaps this will help others experiencing similar errors.

mdfahner commented 2 years ago

I've got the mt7921e wifi+bt on a desktop Asus B550 Tuf Gaming Plus motherboard. I had originally installed Ubuntu 20.04 and found no working wifi but after updating and moving to kernel 5.15.0-22-generic, wifi worked but bluetooth still did not.

I spent some time researching the problem and figured I'd try a new kernel as it seemed that drivers were introduced in later versions so I updated to 22.04 and the latest 5.16 and the latest RC of 5.17 and in each case, bt worked but wifi did not. lsmod showed bt and wifi, but I could not get wifi working.

Reviewing dmesg is what brought me here, I was getting probe of 0000:05:00.0 failed with error -110

I tried a full power off and power based on some of the feedback here to no avail. Being frustrated, I figured I'd rollback to kernel 5.15.0-22-generic as I wanted wifi over bt. Having rolled back, wifi worked so I set my grub settings back to normal, set the bios back to fast boot, and I had bt, no wifi. Lovely....

Back to the mb bios, fast boot off, and now I have wifi+bt on 5.15.0-22-generic (but on not-yet released 22.04 which is fine for how I intend to use this computer) and no error -110

I'm not sure on why disabling the fast boot in the bios resolved the issue, but I've got both bt+wifi going and am happy.

Perhaps this will help others experiencing similar errors.

I may have prematurely believed the issue to be resolved. While it seemed to correspond to fast boot in the bios being toggled on/off, wifi has since stopped working again while bt works flawlessly. I'm not sure what's causing it at this point. It occurs on cold boots as well as warm boots, with or without accessing grub or the bios. There's something more at play here that I don't fully understand.

Oisangui commented 2 years ago

Thinkpad P14s gen 2 AMD here with same problem. Kernel 5.16.11 still bad. Sometimes there is no wifi upon reboot. Sometimes there is kernel panic on boot. After shutdown it sometimes works, so for now it is not critical, but it is really annoying.

rnestler commented 2 years ago

I just tested 5.16.7-arch1-1 on my Lenovo P14s and Wifi seems to work, also after a reboot.

Guess it regressed somewhere or I was lucky that one time I now see panics again on reboot with a more recent 5.16.x kernel :slightly_frowning_face:

Oisangui commented 2 years ago

I give up. Just ordered an intel AX200 replacement. It is a "solution" if your module is not soldered.

EnlightenedBacon commented 2 years ago

I give up. Just ordered an intel AX200 replacement. It is a "solution" if your module is not soldered.

I'll be curious how that works out. I did the same on my ASUS Zephyrus S17 laptop and found that it had similar problems. Unlike the Mediatek one it never disconnected once it was connected, and never caused any Kernel panics or other problems. But every now and then I'd have to do the full power cycle, unplug cable, plug back in thing to get either Windows or Linux to detect it again.

I'm 99% sure that the issue isn't entirely with the Mediatek chipset, but also some issue with ASUS laptops and how they handle wifi as well. It seems if the laptop would just cut power to the adapter when rebooted rather than leave it on, it would solve every problem.

Oisangui commented 2 years ago

I don't know much about electronics but it sounds like a capacitor gets loaded. When I try to solve the problem rebooting a sudden and short, low freq sound emerges inside the laptop sometimes, but when I power off, then afterwards there is no such sound. Maybe has to do with the power policy of the driver. Well, it could be anything, really, so not very helpful; could even be unrelated and it's just the speakers.

shaksiper commented 2 years ago

I don't know much about electronics but it sounds like a capacitor gets loaded. When I try to solve the problem rebooting a sudden and short, low freq sound emerges inside the laptop sometimes, but when I power off, then afterwards there is no such sound. Maybe has to do with the power policy of the driver. Well, it could be anything, really, so not very helpful; could even be unrelated and it's just the speakers.

This is my experience exactly. When I unplug the PC and wait until that sound stops, it boots up alright. But every other time it panics. I am using Asus Zephyrus G14 2021 model.

EnlightenedBacon commented 2 years ago

It probably is something like that. But somehow the Windows driver with the Mediatek wifi adapter works perfectly (I haven't had a single issue with it ever in Windows). So there must be something in the Windows driver that resets the adapter to a working state, which doesn't exist in the Linux driver. And also that function apparently doesn't work on the AX200, as that can fail in both Linux and Windows.

I suspect an updated BIOS from ASUS could fix it, but that is unlikely given they don't try to support Linux. Otherwise the Linux driver will somehow need to replicate whatever the Windows driver is doing in terms of resetting the adapter every boot.

rnestler commented 2 years ago

Maybe has to do with the power policy of the driver.

@Oisangui Could be. If I look at the bugs that seem related (https://bugzilla.kernel.org/show_bug.cgi?id=215391) they mention that disable_aspm=1 could help (aspm means Active State Power Management as far as I know).

dmanlfc commented 2 years ago

I got it working using this patch...

https://github.com/batocera-linux/batocera.linux/pull/5791/files#diff-248a2cb49570e056d90541f9d87dabae3f7f9d38c54c48512a9cc4df6c812dd6

Note: I'm running v5.17rc8 with March 2022 firmware

mtrp12 commented 2 years ago

In my specific case, the only problem I'm having is no wifi on reboot. Everything else is okay, I don't need to plug / unplug power or do anything. I just need to shutdown + power-up instead of reboot. Bluetooth + Wifi are working fine as long as I power up.

Same for me. Using lenovo legion 5. Needed to poweroff and start instead of reboot on Fedora 35.

TheOddler commented 2 years ago

I give up. Just ordered an intel AX200 replacement. It is a "solution" if your module is not soldered.

I did exactly this too, wifi works flawlessly now and replacing it was very easy (ASUS Vivobook 16X).

Oisangui commented 2 years ago

I report back that replacing the module by AX200 absolutely solved the problem. Now there are no kernel panics.

LeetLeaf commented 2 years ago

I got it working using this patch...

https://github.com/batocera-linux/batocera.linux/pull/5791/files#diff-248a2cb49570e056d90541f9d87dabae3f7f9d38c54c48512a9cc4df6c812dd6

Note: I'm running v5.17rc8 with March 2022 firmware

@dmanlfc How do you apply this patch? Where would I run the patch command for the driver?

chabad360 commented 2 years ago

A patch was submitted to LKML but it doesn't seem like it was actually accepted yet (it seems it's too late to be added to 5.18, but we'll see).

pkit commented 2 years ago

Asus Rog Strix X570-E WIFI II If windows boots and finds wifi - Ubuntu doesn't detect it: failed with error -11 If Ubuntu boots with Wifi - Windows doesn't detect it and fails with: device cannot start -10 It's clearly some sort of firmware war, where each system installs different fw.

EnlightenedBacon commented 2 years ago

Just tried kernel 5.17.1 on Mint and finally it appears to have resolved every problem I've had! Specifically I have an ASUS Zephyrus S17 GX703 and everything Linux has been a nightmare on it since I got it a few months ago. I've tried Kernels 5.4, 5.8 and 5.10-16 all with random different problems. 5.17.1 seems to have resolved everything!

pythys commented 2 years ago

Nope, 5.17.1 on arch linux still suffers from the no-wifi-on-reboot problem.

At this point we need superman for this bug

EnlightenedBacon commented 2 years ago

I've fiddled with my system a bit more after pythus' comment and yep, same for me too. On other firmware versions my wifi problems were much worse. Currently, as long as I shutdown the laptop and then turn it back on, it works perfectly. In the past even when it rarely did work, it would randomly disconnect, or say it's connected but stop transferring data.

This makes me even more convinced the problem isn't specifically the wifi adapter, but some other component interacting with it.

chabad360 commented 2 years ago

Interesting, I only had issues with wifi when I was setting up. Afterwards, I was able to cold boot fine (never had an issue with that), however a reboot would always result in a panic. But after 5.17.1 it seems to be a different but related issue that's causing panics.

PXL_20220403_163838050.MP.jpg

FireBurn commented 2 years ago

I'm not sure if people are just ignoring my comments or not, but the bug fix for the "warm reboot" issue is in 5.18-rc1 anything older than that currently doesn't have the patch

If you know how to patch your kernel you can apply the 5.18 patches on top on 5.17 from this:

https://raw.githubusercontent.com/FireBurn/KernelStuff/master/04-mt76.patch

EnlightenedBacon commented 2 years ago

I'm not sure if people are just ignoring my comments or not, but the bug fix for the "warm reboot" issue is in 5.18-rc1 anything older than that currently doesn't have the patch

If you know how to patch your kernel you can apply the 5.18 patches on top on 5.17 from this:

https://raw.githubusercontent.com/FireBurn/KernelStuff/master/04-mt76.patch

I did notice your comment. I don't know much about how the Linux kernel is developed, but I just assumed if the fix worked, it would be added as a point release to 5.15, 16 or 17 at some point. No idea how to patch the kernel, but 5.17 at least works well enough to use on my new laptop finally, so that will do until 5.18 officially comes out.

EnlightenedBacon commented 2 years ago

If I read this correctly (and there's no guarantee of that), I think the crash on boot is resolved officially in 5.17.2, going to try it out soon:

commit 110c4be3fc8d9d7f28bb83e1dfc212625fd71074 Author: Sean Wang sean.wang@mediatek.com Date: Fri Jan 7 15:30:03 2022 +0800

mt76: mt7921e: fix possible probe failure after reboot

[ Upstream commit 602cc0c9618a819ab00ea3c9400742a0ca318380 ]

It doesn't guarantee the mt7921e gets started with ASPM L0 after each
machine reboot on every platform.

If mt7921e gets started with not ASPM L0, it would be possible that the
driver encounters time to time failure in mt7921_pci_probe, like a
weird chip identifier is read

[  215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000
[  216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110

or failing to init hardware because the driver is not allowed to access the
register until the device is in ASPM L0 state. So, we call
__mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device
to bring back to the L0 state for we can safely access registers in any
case.

In the patch, we move all functions from dma.c to pci.c and register mt76
bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on.

Fixes: bf3747ae2e25 ("mt76: mt7921: enable aspm by default")
Reported-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
EnlightenedBacon commented 2 years ago

So as above, with 5.17.1 everything on my laptop worked great, BUT occasionally I'd get boot issues with my Mediatek Wifi not being detected. I've been using 5.17.2 all day today and rebooted many times to test it, including into and out of Windows. So far no issues at all. Looks like the patch FireBurn mentioned in 5.18 has been implemented in 5.17.2 as I thought in my prior post! Praise the Linux Gods!

FireBurn commented 2 years ago

It's also been ported to 5.16.19 too