From: David Westen <davidlwesten@gmail.com>
To: netdev@vger.kernel.org
Cc: loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com,
johannes@sipsolutions.net, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, m.chetan.kumar@linux.intel.com,
linux-kernel@vger.kernel.org, mail@maciej.szmigiero.name,
nihaal@cse.iitm.ac.in, David Westen <davidlwesten@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH net v2 2/2] net: wwan: iosm: fix S3 resume by re-binding the driver around it
Date: Wed, 18 Nov 2026 20:27:14 -0800 [thread overview]
Message-ID: <20261119042714.505405-2-davidlwesten@gmail.com> (raw)
In-Reply-To: <20261119042714.505405-1-davidlwesten@gmail.com>
On platforms where S3 cuts power to the WWAN card, the modem boots
again while the system sleeps, but the driver still treats it as
running. After resume its execution stage reads BOOT, and by the
first port open the boot code has crashed into the CD_READY stage:
iosm 0000:03:00.0: PORT open refused, phase A-CD_READY
The modem then stays unusable until an ACPI reset.
Unbind the driver before S3 and bind it again after resume, as
commit 0b6f6593aa8c ("net: wwan: iosm: Fix hibernation by re-binding
the driver around it") already does for hibernation. The driver is
then torn down while the modem still answers, and the modem is probed
again once it has booted.
The target state isn't known yet when the PM notifier runs, so the
default suspend mode decides: the driver is re-bound unless "mem" maps
to suspend-to-idle, which keeps using the suspend/resume callbacks.
This changes behavior in a few cases:
- On platforms that keep the card powered in S3, the modem is now
probed again on resume, which drops data sessions and recreates its
ports.
- Entering suspend-to-idle or standby explicitly while the default is
S3 also re-binds the driver.
- A suspend to S3 that calls pm_suspend(PM_SUSPEND_MEM) directly while
the default is suspend-to-idle is not covered and fails as before.
Fixes: 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
Cc: stable@vger.kernel.org
Signed-off-by: David Westen <davidlwesten@gmail.com>
---
Notes:
Changes in v2:
- New patch before this one: cancel the ADB timer in ipc_imem_cleanup().
- Describe the changes in behavior and the remaining limits in the
changelog, and say in the comment that the modem "may" lose power.
- I also tried detecting the power loss on resume instead; my reply to
the v1 review explains why v2 keeps unbinding before suspend.
- Correction to that reply: the XMM7360 here does use MUX aggregation
(CP capability 0x300), so the ADB timer is armed on it too.
v1: https://lore.kernel.org/r/20261116031148.333990-1-davidlwesten@gmail.com
Tested on an XMM7360 (ThinkPad X1 Carbon 6th gen, deep sleep) with this
series applied to 7.2.15: the driver is unbound before suspend, and
after resume the modem is probed again and comes up without an ACPI
reset. Not tested on the XMM7560.
The investigation and the patches were done with an AI coding assistant
(Claude Opus 5.5). It read the driver and added temporary debug logging
to record the execution stage around suspend and resume. We wrote the
changes and the changelogs together, and I ran the tests.
drivers/net/wwan/iosm/iosm_ipc_pcie.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
index 49052eb511ba..13e81012d818 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
@@ -534,12 +534,17 @@ void ipc_pcie_kfree_skb(struct iosm_pcie *ipc_pcie, struct sk_buff *skb)
static int pm_notify(struct notifier_block *nb, unsigned long mode, void *_unused)
{
- if (mode == PM_HIBERNATION_PREPARE || mode == PM_RESTORE_PREPARE) {
+ /* The modem may lose power in S3 and S4 and boot again on resume,
+ * which the suspend/resume callbacks can't handle, so probe it again.
+ */
+ if (mode == PM_HIBERNATION_PREPARE || mode == PM_RESTORE_PREPARE ||
+ (mode == PM_SUSPEND_PREPARE && !pm_suspend_default_s2idle())) {
if (pci_registered) {
pci_unregister_driver(&iosm_ipc_driver);
pci_registered = false;
}
- } else if (mode == PM_POST_HIBERNATION || mode == PM_POST_RESTORE) {
+ } else if (mode == PM_POST_HIBERNATION || mode == PM_POST_RESTORE ||
+ mode == PM_POST_SUSPEND) {
if (!pci_registered) {
int ret;
--
2.56.0
prev parent reply other threads:[~2026-11-19 4:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 4:27 [PATCH net v2 1/2] net: wwan: iosm: cancel the ADB timer on cleanup David Westen
2026-11-19 4:27 ` David Westen [this message]
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=20261119042714.505405-2-davidlwesten@gmail.com \
--to=davidlwesten@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=m.chetan.kumar@linux.intel.com \
--cc=mail@maciej.szmigiero.name \
--cc=netdev@vger.kernel.org \
--cc=nihaal@cse.iitm.ac.in \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=stable@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®