From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
To: jjohnson@kernel.org
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
linux-kernel@vger.kernel.org,
Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Subject: [PATCH] wifi: ath12k: fix crash on unbind when board data is not found
Date: Mon, 16 Nov 2026 09:04:04 +0100 [thread overview]
Message-ID: <20261116080404.93529-1-jtornosm@redhat.com> (raw)
When QCN9274 boots without the required board data in board-2.bin
(e.g. board ID not supported in the default linux-firmware package),
the QMI firmware initialization fails during board data loading:
ath12k_wifi7_pci 0000:07:00.0: failed to fetch board data for
bus=pci,qmi-chip-id=0,qmi-board-id=4102 from
ath12k/QCN9274/hw2.0/board-2.bin
Without this fix, unbinding the device crashes with a page fault in
mhi_queue and duplicate sysfs entries, and the only recovery is a
reboot:
sysfs: cannot create duplicate filename '/bus/mhi/devices/mhi0_IPCR'
Workqueue: mhi_hiprio_wq mhi_pm_st_worker [mhi]
Call Trace:
sysfs_warn_dup.cold+0x17/0x23
sysfs_do_create_link_sd+0xe3/0xf0
bus_add_device+0x9a/0x200
device_add+0x3d4/0x750
mhi_create_devices+0x15f/0x270 [mhi]
mhi_pm_mission_mode_transition.isra.0+0x20f/0x2b0 [mhi]
mhi_pm_st_worker+0x26a/0x2d0 [mhi]
Fix by:
- Setting ATH12K_FLAG_QMI_FAIL when firmware_ready() fails in the
FW_READY event handler.
- Using ATH12K_MHI_FORCE_POWER_OFF when QMI_FAIL is set, to skip
the MHI_STATE_RESET that triggers QCN9274 firmware auto-restart.
- Replacing ath12k_pci_power_down() in the QMI_FAIL cleanup path
with a direct ath12k_mhi_stop() (guarded by MHI_POWER_ON state)
followed by ath12k_pci_sw_reset() for clean firmware state on
re-bind.
With this fix, the user can install the correct board-2.bin from the
manufacturer, unbind and bind the device, and it initializes
successfully without rebooting.
Tested on QCN9274 hw2.0 with unsupported board ID (0x1006) in
default board-2.bin.
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
---
drivers/net/wireless/ath/ath12k/mhi.c | 2 ++
drivers/net/wireless/ath/ath12k/pci.c | 4 +++-
drivers/net/wireless/ath/ath12k/qmi.c | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c
index ee87f00bc5de..4290a4540351 100644
--- a/drivers/net/wireless/ath/ath12k/mhi.c
+++ b/drivers/net/wireless/ath/ath12k/mhi.c
@@ -507,6 +507,8 @@ void ath12k_mhi_stop(struct ath12k_pci *ab_pci, bool is_suspend)
*/
if (is_suspend)
ath12k_mhi_set_state(ab_pci, ATH12K_MHI_POWER_OFF_KEEP_DEV);
+ else if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab_pci->ab->dev_flags))
+ ath12k_mhi_set_state(ab_pci, ATH12K_MHI_FORCE_POWER_OFF);
else
ath12k_mhi_set_state(ab_pci, ATH12K_MHI_POWER_OFF);
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index dbd960f88d38..bbd1f868295d 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -1741,7 +1741,9 @@ static void ath12k_pci_remove(struct pci_dev *pdev)
ath12k_pci_set_irq_affinity_hint(ab_pci, NULL);
if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) {
- ath12k_pci_power_down(ab, false);
+ if (test_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state))
+ ath12k_mhi_stop(ab_pci, false);
+ ath12k_pci_sw_reset(ab_pci->ab, false);
goto qmi_fail;
}
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 817bd820623d..5fc4ce4bae6f 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -4095,6 +4095,9 @@ static void ath12k_qmi_driver_event_work(struct work_struct *work)
if (!ret)
set_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE,
&ab->dev_flags);
+ else
+ set_bit(ATH12K_FLAG_QMI_FAIL,
+ &ab->dev_flags);
break;
case ATH12K_QMI_EVENT_HOST_CAP:
--
2.56.0
reply other threads:[~2026-11-16 8:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116080404.93529-1-jtornosm@redhat.com \
--to=jtornosm@redhat.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®