mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 20:30:26 -04:00
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 Interrupt
On 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.
Fixes: 0b38e6277a ("wifi: rtw89: add support for hardware rfkill")
Cc: stable@vger.kernel.org
Suggested-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yuhang.chen <yhchen312@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260729014142.2746777-1-yhchen312@gmail.com
This commit is contained in:
committed by
Ping-Ke Shih
parent
9f29480107
commit
667c12782a
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user