Microcode SW error with an Intel 8265 / 8275 (rev 78) wireless card

The issue:

Multiple times an hour my wireless connection would drop out for a couple of seconds, then come back up. If this happened while streaming media, most often it would not be noticable because the media buffer would handle the hiccup, but during regular surfing this would lead to disconnects or unreachable pages.

Looking through the dmesg output I found plenty of tracebacks similar to this (MAC address of my router removed):

[   22.603623] iwlwifi 0000:04:00.0: Microcode SW error detected.  Restarting 0x2000000.
[   22.605114] iwlwifi 0000:04:00.0: Start IWL Error Log Dump:
[   22.606304] iwlwifi 0000:04:00.0: Status: 0x00000040, count: 6
[   22.607576] iwlwifi 0000:04:00.0: Loaded firmware version: 36.77d01142.0
[   22.608704] iwlwifi 0000:04:00.0: 0x000014FD | ADVANCED_SYSASSERT          
[   22.609791] iwlwifi 0000:04:00.0: 0x000002F0 | trm_hw_status0
[   22.610872] iwlwifi 0000:04:00.0: 0x00000000 | trm_hw_status1
[   22.611968] iwlwifi 0000:04:00.0: 0x000248EC | branchlink2
[   22.613058] iwlwifi 0000:04:00.0: 0x0003A862 | interruptlink1
[   22.614170] iwlwifi 0000:04:00.0: 0x00000000 | interruptlink2
[   22.615272] iwlwifi 0000:04:00.0: 0x00000082 | data1
[   22.616343] iwlwifi 0000:04:00.0: 0xDEADBEEF | data2
[   22.617448] iwlwifi 0000:04:00.0: 0xDEADBEEF | data3
[   22.618475] iwlwifi 0000:04:00.0: 0x0009505C | beacon time
[   22.619232] iwlwifi 0000:04:00.0: 0x00378063 | tsf low
[   22.620219] iwlwifi 0000:04:00.0: 0x00000000 | tsf hi
[   22.621186] iwlwifi 0000:04:00.0: 0x00000000 | time gp1
[   22.622329] iwlwifi 0000:04:00.0: 0x00378064 | time gp2
[   22.623512] iwlwifi 0000:04:00.0: 0x00000001 | uCode revision type
[   22.624557] iwlwifi 0000:04:00.0: 0x00000024 | uCode version major
[   22.625464] iwlwifi 0000:04:00.0: 0x77D01142 | uCode version minor
[   22.626252] iwlwifi 0000:04:00.0: 0x00000230 | hw version
[   22.626792] iwlwifi 0000:04:00.0: 0x00C89000 | board version
[   22.627331] iwlwifi 0000:04:00.0: 0x003D0108 | hcmd
[   22.627883] iwlwifi 0000:04:00.0: 0x00022080 | isr0
[   22.628434] iwlwifi 0000:04:00.0: 0x00000000 | isr1
[   22.628989] iwlwifi 0000:04:00.0: 0x08201802 | isr2
[   22.629538] iwlwifi 0000:04:00.0: 0x00400080 | isr3
[   22.630588] iwlwifi 0000:04:00.0: 0x00000000 | isr4
[   22.631341] iwlwifi 0000:04:00.0: 0x003C019F | last cmd Id
[   22.631846] iwlwifi 0000:04:00.0: 0x00000000 | wait_event
[   22.632347] iwlwifi 0000:04:00.0: 0x0000D5E7 | l2p_control
[   22.632844] iwlwifi 0000:04:00.0: 0x00000000 | l2p_duration
[   22.633334] iwlwifi 0000:04:00.0: 0x00000000 | l2p_mhvalid
[   22.633835] iwlwifi 0000:04:00.0: 0x00000000 | l2p_addr_match
[   22.634745] iwlwifi 0000:04:00.0: 0x0000008F | lmpm_pmg_sel
[   22.635664] iwlwifi 0000:04:00.0: 0x08081421 | timestamp
[   22.636676] iwlwifi 0000:04:00.0: 0x00004050 | flow_handler
[   22.637518] iwlwifi 0000:04:00.0: Start IWL Error Log Dump:
[   22.638372] iwlwifi 0000:04:00.0: Status: 0x00000040, count: 7
[   22.638861] iwlwifi 0000:04:00.0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
[   22.639341] iwlwifi 0000:04:00.0: 0x00000000 | umac branchlink1
[   22.639813] iwlwifi 0000:04:00.0: 0xC0086948 | umac branchlink2
[   22.640278] iwlwifi 0000:04:00.0: 0xC0083B0C | umac interruptlink1
[   22.640745] iwlwifi 0000:04:00.0: 0xC0083B0C | umac interruptlink2
[   22.641211] iwlwifi 0000:04:00.0: 0x00000800 | umac data1
[   22.641693] iwlwifi 0000:04:00.0: 0xC0083B0C | umac data2
[   22.642655] iwlwifi 0000:04:00.0: 0xDEADBEEF | umac data3
[   22.643476] iwlwifi 0000:04:00.0: 0x00000024 | umac major
[   22.644376] iwlwifi 0000:04:00.0: 0x77D01142 | umac minor
[   22.645316] iwlwifi 0000:04:00.0: 0xC088628C | frame pointer
[   22.646226] iwlwifi 0000:04:00.0: 0xC088628C | stack pointer
[   22.647072] iwlwifi 0000:04:00.0: 0x003D0108 | last host cmd
[   22.647786] iwlwifi 0000:04:00.0: 0x00000000 | isr status reg
[   22.648611] iwlwifi 0000:04:00.0: Fseq Registers:
[   22.649236] iwlwifi 0000:04:00.0: 0xE5A33CD7 | FSEQ_ERROR_CODE
[   22.649769] iwlwifi 0000:04:00.0: 0x356D75C8 | FSEQ_TOP_INIT_VERSION
[   22.650294] iwlwifi 0000:04:00.0: 0x2408A24F | FSEQ_CNVIO_INIT_VERSION
[   22.650818] iwlwifi 0000:04:00.0: 0x0000A10B | FSEQ_OTP_VERSION
[   22.651341] iwlwifi 0000:04:00.0: 0x7D82B21C | FSEQ_TOP_CONTENT_VERSION
[   22.651867] iwlwifi 0000:04:00.0: 0xBADED74E | FSEQ_ALIVE_TOKEN
[   22.652391] iwlwifi 0000:04:00.0: 0x21AF7C59 | FSEQ_CNVI_ID
[   22.652914] iwlwifi 0000:04:00.0: 0x32D8E512 | FSEQ_CNVR_ID
[   22.653434] iwlwifi 0000:04:00.0: 0x00000010 | CNVI_AUX_MISC_CHIP
[   22.653957] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
[   22.654477] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
[   22.654998] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
[   22.655522] iwlwifi 0000:04:00.0: Collecting data: trigger 2 fired.
[   22.655526] ieee80211 phy0: Hardware restart was requested
[   22.655589] iwlwifi 0000:04:00.0: iwlwifi transaction failed, dumping registers
[   22.656168] iwlwifi 0000:04:00.0: iwlwifi device config registers:
[   22.657016] iwlwifi 0000:04:00.0: 00000000: 24fd8086 00100406 02800078 00000000 dc000004 00000000 00000000 00000000
[   22.657511] iwlwifi 0000:04:00.0: 00000020: 00000000 00000000 00000000 10108086 00000000 000000c8 00000000 000001ff
[   22.658012] iwlwifi 0000:04:00.0: 00000040: 00020010 10008ec0 00190c10 0045e811 10110142 00000000 00000000 00000000
[   22.658509] iwlwifi 0000:04:00.0: 00000060: 00000000 00080812 00000405 00000000 00010001 00000000 00000000 00000000
[   22.659021] iwlwifi 0000:04:00.0: 00000080: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.659511] iwlwifi 0000:04:00.0: 000000a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.659999] iwlwifi 0000:04:00.0: 000000c0: 00000000 00000000 c823d001 0d000000 00814005 fee00318 00000000 00000000
[   22.660490] iwlwifi 0000:04:00.0: 000000e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.660984] iwlwifi 0000:04:00.0: 00000100: 14010001 00000000 00000000 00462031 00000000 00002000 00000000 00000000
[   22.661487] iwlwifi 0000:04:00.0: 00000120: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.661988] iwlwifi 0000:04:00.0: 00000140: 14c10003 ff77ed1d 00e18cff 15410018 10031003 0001001e 00481e1f 40a0000f
[   22.662500] iwlwifi 0000:04:00.0: iwlwifi device memory mapped registers:
[   22.663171] iwlwifi 0000:04:00.0: 00000000: 00c89000 00000040 00000000 ba00008b 00000000 00000000 00000010 00000000
[   22.663712] iwlwifi 0000:04:00.0: 00000020: 00000000 08040005 00000230 d55555d5 d55555d5 d55555d5 80008040 041f0042
[   22.664380] iwlwifi 0000:04:00.0: iwlwifi device AER capability structure:
[   22.665072] iwlwifi 0000:04:00.0: 00000000: 14010001 00000000 00000000 00462031 00000000 00002000 00000000 00000000
[   22.665660] iwlwifi 0000:04:00.0: 00000020: 00000000 00000000 00000000
[   22.666231] iwlwifi 0000:04:00.0: iwlwifi parent port (0000:00:1c.6) config registers:
[   22.666902] iwlwifi 0000:00:1c.6: 00000000: 9d168086 00100407 060400f1 00810000 00000000 00000000 00040400 200000f0
///
[   22.677074] iwlwifi 0000:00:1c.6: 00000200: 2201001e 00b0281f 40a0280f
[   22.677731] iwlwifi 0000:04:00.0: iwlwifi root port (0000:00:1c.6) AER cap structure:
[   22.678391] iwlwifi 0000:00:1c.6: 00000000: 14010001 00000000 00010000 00060011 00000000 00002000 00000000 00000000
[   22.679058] iwlwifi 0000:00:1c.6: 00000020: 00000000 00000000 00000000 00000000 00000000 00000000
[   22.679724] iwlwifi 0000:04:00.0: FW error in SYNC CMD PHY_CONTEXT_CMD
[   22.680398] CPU: 2 PID: 1328 Comm: wpa_supplicant Tainted: G           OE     5.4.0-89-generic #100-Ubuntu
[   22.680399] Hardware name: LENOVO 20H9CT01WW/20H9CT01WW, BIOS N1VET56W (1.46 ) 05/17/2021
[   22.680400] Call Trace:
[   22.680405]  dump_stack+0x6d/0x8b
[   22.680415]  iwl_pcie_send_hcmd_sync+0x382/0x390 [iwlwifi]
[   22.680418]  ? wait_woken+0x80/0x80
[   22.680424]  iwl_trans_pcie_send_hcmd+0x34/0xf0 [iwlwifi]
[   22.680430]  iwl_trans_send_cmd+0x55/0xc0 [iwlwifi]
[   22.680438]  iwl_mvm_send_cmd+0x1f/0x40 [iwlmvm]
[   22.680443]  iwl_mvm_send_cmd_pdu+0x51/0x70 [iwlmvm]
[   22.680448]  iwl_mvm_phy_ctxt_apply.constprop.0+0x173/0x240 [iwlmvm]
[   22.680453]  iwl_mvm_phy_ctxt_changed+0x58/0xb0 [iwlmvm]
[   22.680458]  iwl_mvm_change_chanctx+0x10a/0x140 [iwlmvm]
[   22.680477]  ieee80211_recalc_chanctx_min_def+0x1ee/0x340 [mac80211]
[   22.680490]  ieee80211_assign_vif_chanctx+0x21c/0x420 [mac80211]
[   22.680502]  ieee80211_vif_use_channel+0x17b/0x290 [mac80211]
[   22.680514]  ieee80211_prep_channel+0x2be/0x500 [mac80211]
[   22.680524]  ieee80211_prep_connection+0x25f/0x430 [mac80211]
[   22.680536]  ieee80211_mgd_auth+0x19d/0x3d0 [mac80211]
[   22.680548]  ieee80211_auth+0x18/0x20 [mac80211]  Restarting 0x2000000.
[   22.680567]  cfg80211_mlme_auth+0x104/0x210 [cfg80211]
[   22.680579]  nl80211_authenticate+0x284/0x2e0 [cfg80211]
[   22.680582]  genl_family_rcv_msg+0x1b9/0x470
[   22.680584]  ? try_to_wake_up+0x224/0x6a0
[   22.680585]  genl_rcv_msg+0x4c/0xa0
[   22.680587]  ? _cond_resched+0x19/0x30
[   22.680588]  ? genl_family_rcv_msg+0x470/0x470
[   22.680590]  netlink_rcv_skb+0x50/0x120
[   22.680591]  genl_rcv+0x29/0x40
[   22.680592]  netlink_unicast+0x187/0x220
[   22.680593]  netlink_sendmsg+0x222/0x3e0
[   22.680596]  sock_sendmsg+0x65/0x70
[   22.680597]  ____sys_sendmsg+0x212/0x280
[   22.680599]  ___sys_sendmsg+0x88/0xd0
[   22.680600]  ? sock_do_ioctl+0x47/0x140
[   22.680602]  ? __check_object_size+0x4d/0x150
[   22.680605]  ? _copy_to_user+0x2c/0x30
[   22.680606]  ? sock_ioctl+0x24f/0x3c0
[   22.680607]  ? __sys_sendto+0x113/0x190
[   22.680609]  ? __cgroup_bpf_run_filter_setsockopt+0xae/0x2d0
[   22.680611]  ? _cond_resched+0x19/0x30
[   22.680613]  ? aa_sk_perm+0x43/0x170
[   22.680614]  __sys_sendmsg+0x5c/0xa0
[   22.680615]  __x64_sys_sendmsg+0x1f/0x30
[   22.680617]  do_syscall_64+0x57/0x190
[   22.680619]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   22.680620] RIP: 0033:0x7fe9e8042747
[   22.680622] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
[   22.680623] RSP: 002b:00007ffd6dbe3fe8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[   22.680624] RAX: ffffffffffffffda RBX: 0000558a3dd79700 RCX: 00007fe9e8042747
[   22.680624] RDX: 0000000000000000 RSI: 00007ffd6dbe4020 RDI: 0000000000000006
[   22.680625] RBP: 0000558a3ddcb680 R08: 0000000000000004 R09: 00007fe9e810ab80
[   22.680626] R10: 00007ffd6dbe40f4 R11: 0000000000000246 R12: 0000558a3dd79610
[   22.680626] R13: 00007ffd6dbe4020 R14: 00007ffd6dbe40f4 R15: 0000558a3ddca1b0
[   22.680629] iwlwifi 0000:04:00.0: PHY ctxt cmd error. ret=-5
[   23.196499] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.197142] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.198713] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.199797] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.200775] wlp4s0: failed to insert STA entry for the AP (error -5)
[   23.200778] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.201753] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.203618] iwlwifi 0000:04:00.0: Failed to send quota: -5
[   23.204815] iwlwifi 0000:04:00.0: Failed to send binding (action:3): -5
[   23.206750] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.207986] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.209208] iwlwifi 0000:04:00.0: PHY ctxt cmd error. ret=-5
[   23.230555] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   23.362536] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   23.428963] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   23.559711] wlp4s0: authenticate with [[edited]]
[   23.564136] wlp4s0: send auth to [[edited]] (try 1/3)
[   23.569273] wlp4s0: authenticated
[   23.573418] wlp4s0: associate with [[edited]] (try 1/3)
[   23.575706] wlp4s0: RX AssocResp from [[edited]] (capab=0x431 status=0 aid=1)
[   23.577894] wlp4s0: associated
[   23.651524] IPv6: ADDRCONF(NETDEV_CHANGE): wlp4s0: link becomes ready

Clearly there is an issue with the combination of settings, microcode and hardware that needs to be fixed.

Hardware/firmware

I’m running 5.4.0-89-generic on a Thinkpad T570 with an Intel 8265 / 8275 rev 78 and microcode 36.77d01142.0

lspci -k shows:

04:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)
	Subsystem: Intel Corporation Dual Band Wireless-AC 8265
	Kernel driver in use: iwlwifi
	Kernel modules: iwlwifi

dmesg | grep firmware returns:

[    5.011501] iwlwifi 0000:04:00.0: loaded firmware version 36.77d01142.0 op_mode iwlmvm
[    5.120851] iwlwifi 0000:04:00.0: Allocated 0x00400000 bytes for firmware monitor.

Solution

Reading through forums, one notices this is not uncommon with the Intel iwlwifi modules.

I found a lot of options to handle this, including:

  • Reverting to older microcode by moving the current out of /usr/lib/firmware/ and reverting to an older version. For me this would be going back to v34, then v31 and so on until the issue was gone (not ideal)
  • Going through the upstream and see if newer versions where available upstream (not the case atm)
  • Sending a polite email to linuxwifi@intel.com hoping to get some support (not likely)
  • Get another card (limited to the hw options that Lenovo permits with my default BIOS, and *that* card might also have issues)
  • Changing the module parameters hoping to get improvement.

I opted to go through the last option, and try to limit the amount of changes to what was strictly necessary.

I started by following a recommendation from the Archlinux forum, I created /etc/modprobe.d/iwlwifi.conf (can be any name, as long as it ends in .conf) with the following contents:

options iwlwifi 11n_disable=1 swcrypto=0 bt_coex_active=0 power_save=0
options iwlmvm power_scheme=1 
options iwlwifi d0i3_disable=1 
options iwlwifi uapsd_disable=1 
options iwlwifi lar_disable=1

After a reboot, the issue did not reappear.

However going over dmesg, I found that one of the options (d0i3_disable=1) was not valid, and I set out to reduce the options to the ones (or combination) required to solve the issue.

The current (working) contents of my .conf file:

options iwlwifi 11n_disable=1 swcrypto=0 bt_coex_active=0 power_save=0

Hope this saves someone some time.