FAILED: patch "[PATCH] wifi: rtw89: pci: add .shutdown callback to stop rfkill" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 667c12782aaf8dd3cb2213e528fe63a73cb63345
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090433-armed-frequent-d9dc@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 667c12782aaf8dd3cb2213e528fe63a73cb63345 Mon Sep 17 00:00:00 2001
From: "Yuhang.chen" <[email protected]>
Date: Wed, 29 Jul 2026 09:41:42 +0800
Subject: [PATCH] wifi: rtw89: pci: add .shutdown callback to stop rfkill
polling on reboot
Since the hardware rfkill polling was introduced, arm64 platforms can panic with an asynchronous SError during warm reboot:
SError Interrupt on CPU8, code 0x00000000be000011 -- SError
Workqueue: events_power_efficient rfkill_poll [rfkill]
rtw89_pci_ops_read8+0x94/0x160 [rtw89_pci]
rtw89_core_rfkill_poll+0x50/0x1e0 [rtw89_core]
rtw89_ops_rfkill_poll+0x40/0x68 [rtw89_core]
ieee80211_rfkill_poll+0x3c/0x70 [mac80211]
cfg80211_rfkill_poll+0x40/0x2a0 [cfg80211]
rfkill_poll+0x30/0x88 [rfkill]
Kernel panic - not syncing: Asynchronous SError InterruptOn the reboot path the kernel only runs device_shutdown(), which calls each driver's .shutdown callback; .remove is not invoked. The rtw89 PCI driver had no .shutdown callback, so nothing stopped the rfkill polling work while the platform was tearing the PCIe link down. Once the link is gone, the next MMIO read from the poll handler targets a non-responding device and is reported as a fatal asynchronous SError on arm64.
Add rtw89_pci_shutdown(), wired to all rtw89 PCI device drivers, which sets a new RTW89_FLAG_SHUTDOWN flag (mirroring the USB RTW89_FLAG_UNPLUGGED pattern). When the flag is set, rtw89_ops_rfkill_poll() returns early, so no MMIO read is issued to the chip after shutdown begins and the SError no longer occurs.
This does not call the full .remove path from .shutdown, to keep the shutdown handler minimal and avoid running the non-idempotent teardown twice.
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -6453,6 +6453,7 @@ enum rtw89_flags {RTW89_FLAG_CHANGING_INTERFACE ,RTW89_FLAG_HW_RFKILL_STATE ,RTW89_FLAG_UNPLUGGED , +RTW89_FLAG_SHUTDOWN , NUM_OF_RTW89_FLAGS, };
drivers/net/wireless/realtek/rtw89/mac80211.c +2 -1
@@ -2004,7 +2004,8 @@ static void rtw89_ops_rfkill_poll(struct ieee80211_hw *hw)lockdep_assert_wiphy (hw->wiphy);/* wl_disable GPIO get floating when entering LPS */ -if (test_bit (RTW89_FLAG_RUNNING , rtwdev->flags)) +if (test_bit (RTW89_FLAG_RUNNING , rtwdev->flags) || +test_bit (RTW89_FLAG_SHUTDOWN , rtwdev->flags))return ;rtw89_core_rfkill_poll (rtwdev, false);
drivers/net/wireless/realtek/rtw89/pci.c +13 -0
@@ -4878,6 +4878,19 @@ void rtw89_pci_remove(struct pci_dev *pdev) }EXPORT_SYMBOL (rtw89_pci_remove); +void rtw89_pci_shutdown (struct pci_dev *pdev) +{ +struct ieee80211_hw *hw =pci_get_drvdata (pdev); +struct rtw89_dev *rtwdev; + +if (!hw) +return ; + + rtwdev = hw->priv; +set_bit (RTW89_FLAG_SHUTDOWN , rtwdev->flags); +} +EXPORT_SYMBOL (rtw89_pci_shutdown); +MODULE_AUTHOR ("Realtek Corporation" );MODULE_DESCRIPTION ("Realtek PCI 802.11ax wireless driver" );MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/realtek/rtw89/pci.h +1 -0
@@ -1752,6 +1752,7 @@ struct pci_device_id;int rtw89_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id);void rtw89_pci_remove (struct pci_dev *pdev); +void rtw89_pci_shutdown (struct pci_dev *pdev);void rtw89_pci_basic_cfg (struct rtw89_dev *rtwdev,bool resume);void rtw89_pci_ops_reset (struct rtw89_dev *rtwdev);int rtw89_pci_ltr_set (struct rtw89_dev *rtwdev,bool en);
drivers/net/wireless/realtek/rtw89/rtw8851be.c +1 -0
@@ -94,6 +94,7 @@ static struct pci_driver rtw89_8851be_driver = { .id_table = rtw89_8851be_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8852ae.c +1 -0
@@ -96,6 +96,7 @@ static struct pci_driver rtw89_8852ae_driver = { .id_table = rtw89_8852ae_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8852be.c +1 -0
@@ -98,6 +98,7 @@ static struct pci_driver rtw89_8852be_driver = { .id_table = rtw89_8852be_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8852bte.c +1 -0
@@ -100,6 +100,7 @@ static struct pci_driver rtw89_8852bte_driver = { .id_table = rtw89_8852bte_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8852ce.c +1 -0
@@ -123,6 +123,7 @@ static struct pci_driver rtw89_8852ce_driver = { .id_table = rtw89_8852ce_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8922ae.c +1 -0
@@ -113,6 +113,7 @@ static struct pci_driver rtw89_8922ae_driver = { .id_table = rtw89_8922ae_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops_be, .err_handler = &rtw89_pci_err_handler, };
drivers/net/wireless/realtek/rtw89/rtw8922de.c +1 -0
@@ -113,6 +113,7 @@ static struct pci_driver rtw89_8922de_driver = { .id_table = rtw89_8922de_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops_be, .err_handler = &rtw89_pci_err_handler, };
Sasha Levin
maintainerPATCH 1/3 wifi: rtw89: cleanup unused rtwdev::roc_work
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit c281bdb8821461047d3e74206afbff190d1f7846 ]
The needed one was moved to rtwvif::roc_work. And, rtwdev::roc_work is unused. So, remove it.
Stable-dep-of: 667c12782aaf ("wifi: rtw89: pci: add .shutdown callback to stop rfkill polling on reboot")
--- drivers/net/wireless/realtek/rtw89/core.h | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.h +0 -1
@@ -5604,7 +5604,6 @@ struct rtw89_dev {struct delayed_work coex_rfk_chk_work;struct delayed_work cfo_track_work;struct delayed_work forbid_ba_work; -struct delayed_work roc_work;struct delayed_work antdiv_work;struct rtw89_ppdu_sts_info ppdu_sts;u8 total_sta_assoc;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 wifi: rtw89: Hide some errors when the device is unplugged
From: Bitterblue Smith <[email protected]>
[ Upstream commit 0740c6beefae03066a562e3047959528d8893709 ]
A few unnecessary error messages are printed when the device is unplugged. "read swsi busy" in particular can appear ~1000 times when RTL8851BU is unplugged.
Add a new flag RTW89_FLAG_UNPLUGGED and print some error messages only when this flag is not set. The new USB driver will set the flag when the device is unplugged.
Stable-dep-of: 667c12782aaf ("wifi: rtw89: pci: add .shutdown callback to stop rfkill polling on reboot")
--- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/mac.c | 13 ++++++++----- drivers/net/wireless/realtek/rtw89/phy.c | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -4724,6 +4724,7 @@ enum rtw89_flags {RTW89_FLAG_FORBIDDEN_TRACK_WROK ,RTW89_FLAG_CHANGING_INTERFACE ,RTW89_FLAG_HW_RFKILL_STATE , +RTW89_FLAG_UNPLUGGED , NUM_OF_RTW89_FLAGS, };
drivers/net/wireless/realtek/rtw89/mac.c +8 -5
@@ -88,7 +88,7 @@ int rtw89_mac_write_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 val) ret =read_poll_timeout (rtw89_read8, lte_ctrl, (lte_ctrl &BIT (5 )) !=0 ,50 ,50000 , false, rtwdev,R_AX_LTE_CTRL +3 ); -if (ret) +if (ret && !test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags))rtw89_err (rtwdev,"[ERR]lte not ready(W)\n" );rtw89_write32 (rtwdev,R_AX_LTE_WDATA , val);
@@ -104,7 +104,7 @@ int rtw89_mac_read_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 *val) ret =read_poll_timeout (rtw89_read8, lte_ctrl, (lte_ctrl &BIT (5 )) !=0 ,50 ,50000 , false, rtwdev,R_AX_LTE_CTRL +3 ); -if (ret) +if (ret && !test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags))rtw89_err (rtwdev,"[ERR]lte not ready(W)\n" );rtw89_write32 (rtwdev,R_AX_LTE_CTRL ,0x800F0000 | offset);
@@ -5666,13 +5666,15 @@ int rtw89_mac_coex_init(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex ret =rtw89_mac_read_lte (rtwdev,R_AX_LTE_SW_CFG_2 , &val32);if (ret) { -rtw89_err (rtwdev,"Read R_AX_LTE_SW_CFG_2 fail!\n" ); +if (!test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) +rtw89_err (rtwdev,"Read R_AX_LTE_SW_CFG_2 fail!\n" );return ret; } val32 = val32 &B_AX_WL_RX_CTRL ; ret =rtw89_mac_write_lte (rtwdev,R_AX_LTE_SW_CFG_2 , val32);if (ret) { -rtw89_err (rtwdev,"Write R_AX_LTE_SW_CFG_2 fail!\n" ); +if (!test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) +rtw89_err (rtwdev,"Write R_AX_LTE_SW_CFG_2 fail!\n" );return ret; }
@@ -5796,7 +5798,8 @@ int rtw89_mac_cfg_gnt(struct rtw89_dev *rtwdev, ret =rtw89_mac_write_lte (rtwdev,R_AX_LTE_SW_CFG_1 , val);if (ret) { -rtw89_err (rtwdev,"Write LTE fail!\n" ); +if (!test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) +rtw89_err (rtwdev,"Write LTE fail!\n" );return ret; }
drivers/net/wireless/realtek/rtw89/phy.c +2 -1
@@ -881,7 +881,8 @@ static u32 rtw89_phy_read_rf_a(struct rtw89_dev *rtwdev,30 , false, rtwdev,R_SWSI_V1 , B_SWSI_R_DATA_DONE_V1);if (ret) { -rtw89_err (rtwdev,"read swsi busy\n" ); +if (!test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) +rtw89_err (rtwdev,"read swsi busy\n" );return INV_RF_DATA ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 wifi: rtw89: pci: add .shutdown callback to stop rfkill polling on reboot
In reply to Sasha LevinFrom: "Yuhang.chen" <[email protected]>
[ Upstream commit 667c12782aaf8dd3cb2213e528fe63a73cb63345 ]
Since the hardware rfkill polling was introduced, arm64 platforms can panic with an asynchronous SError during warm reboot:
SError Interrupt on CPU8, code 0x00000000be000011 -- SError
Workqueue: events_power_efficient rfkill_poll [rfkill]
rtw89_pci_ops_read8+0x94/0x160 [rtw89_pci]
rtw89_core_rfkill_poll+0x50/0x1e0 [rtw89_core]
rtw89_ops_rfkill_poll+0x40/0x68 [rtw89_core]
ieee80211_rfkill_poll+0x3c/0x70 [mac80211]
cfg80211_rfkill_poll+0x40/0x2a0 [cfg80211]
rfkill_poll+0x30/0x88 [rfkill]
Kernel panic - not syncing: Asynchronous SError InterruptOn the reboot path the kernel only runs device_shutdown(), which calls each driver's .shutdown callback; .remove is not invoked. The rtw89 PCI driver had no .shutdown callback, so nothing stopped the rfkill polling work while the platform was tearing the PCIe link down. Once the link is gone, the next MMIO read from the poll handler targets a non-responding device and is reported as a fatal asynchronous SError on arm64.
Add rtw89_pci_shutdown(), wired to all rtw89 PCI device drivers, which sets a new RTW89_FLAG_SHUTDOWN flag (mirroring the USB RTW89_FLAG_UNPLUGGED pattern). When the flag is set, rtw89_ops_rfkill_poll() returns early, so no MMIO read is issued to the chip after shutdown begins and the SError no longer occurs.
This does not call the full .remove path from .shutdown, to keep the shutdown handler minimal and avoid running the non-idempotent teardown twice.
--- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/mac80211.c | 3 ++- drivers/net/wireless/realtek/rtw89/pci.c | 13 +++++++++++++ drivers/net/wireless/realtek/rtw89/pci.h | 1 + drivers/net/wireless/realtek/rtw89/rtw8851be.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852ae.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852be.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852bte.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852ce.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8922ae.c | 1 + 10 files changed, 23 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -4725,6 +4725,7 @@ enum rtw89_flags {RTW89_FLAG_CHANGING_INTERFACE ,RTW89_FLAG_HW_RFKILL_STATE ,RTW89_FLAG_UNPLUGGED , +RTW89_FLAG_SHUTDOWN , NUM_OF_RTW89_FLAGS, };
drivers/net/wireless/realtek/rtw89/mac80211.c +2 -1
@@ -1550,7 +1550,8 @@ static void rtw89_ops_rfkill_poll(struct ieee80211_hw *hw)mutex_lock (&rtwdev->mutex);/* wl_disable GPIO get floating when entering LPS */ -if (test_bit (RTW89_FLAG_RUNNING , rtwdev->flags)) +if (test_bit (RTW89_FLAG_RUNNING , rtwdev->flags) || +test_bit (RTW89_FLAG_SHUTDOWN , rtwdev->flags)) goto out;rtw89_core_rfkill_poll (rtwdev, false);
drivers/net/wireless/realtek/rtw89/pci.c +13 -0
@@ -4451,6 +4451,19 @@ void rtw89_pci_remove(struct pci_dev *pdev) }EXPORT_SYMBOL (rtw89_pci_remove); +void rtw89_pci_shutdown (struct pci_dev *pdev) +{ +struct ieee80211_hw *hw =pci_get_drvdata (pdev); +struct rtw89_dev *rtwdev; + +if (!hw) +return ; + + rtwdev = hw->priv; +set_bit (RTW89_FLAG_SHUTDOWN , rtwdev->flags); +} +EXPORT_SYMBOL (rtw89_pci_shutdown); +MODULE_AUTHOR ("Realtek Corporation" );MODULE_DESCRIPTION ("Realtek PCI 802.11ax wireless driver" );MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/realtek/rtw89/pci.h +1 -0
@@ -1602,6 +1602,7 @@ struct pci_device_id;int rtw89_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id);void rtw89_pci_remove (struct pci_dev *pdev); +void rtw89_pci_shutdown (struct pci_dev *pdev);void rtw89_pci_ops_reset (struct rtw89_dev *rtwdev);int rtw89_pci_ltr_set (struct rtw89_dev *rtwdev,bool en);int rtw89_pci_ltr_set_v1 (struct rtw89_dev *rtwdev,bool en);
drivers/net/wireless/realtek/rtw89/rtw8851be.c +1 -0
@@ -84,6 +84,7 @@ static struct pci_driver rtw89_8851be_driver = { .id_table = rtw89_8851be_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, };module_pci_driver (rtw89_8851be_driver);
drivers/net/wireless/realtek/rtw89/rtw8852ae.c +1 -0
@@ -86,6 +86,7 @@ static struct pci_driver rtw89_8852ae_driver = { .id_table = rtw89_8852ae_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, };module_pci_driver (rtw89_8852ae_driver);
drivers/net/wireless/realtek/rtw89/rtw8852be.c +1 -0
@@ -88,6 +88,7 @@ static struct pci_driver rtw89_8852be_driver = { .id_table = rtw89_8852be_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, };module_pci_driver (rtw89_8852be_driver);
drivers/net/wireless/realtek/rtw89/rtw8852bte.c +1 -0
@@ -84,6 +84,7 @@ static struct pci_driver rtw89_8852bte_driver = { .id_table = rtw89_8852bte_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, };module_pci_driver (rtw89_8852bte_driver);
drivers/net/wireless/realtek/rtw89/rtw8852ce.c +1 -0
@@ -113,6 +113,7 @@ static struct pci_driver rtw89_8852ce_driver = { .id_table = rtw89_8852ce_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops, };module_pci_driver (rtw89_8852ce_driver);
drivers/net/wireless/realtek/rtw89/rtw8922ae.c +1 -0
@@ -82,6 +82,7 @@ static struct pci_driver rtw89_8922ae_driver = { .id_table = rtw89_8922ae_id_table, .probe = rtw89_pci_probe, .remove = rtw89_pci_remove, + .shutdown = rtw89_pci_shutdown, .driver.pm = &rtw89_pm_ops_be, };module_pci_driver (rtw89_8922ae_driver);
Signature · 1 line
2.53.0