Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: wwan: iosm: always send the host sleep message on suspend
@ 2026-11-22  5:00 David Westen
  2026-11-22 15:05 ` Loic Poulain
  0 siblings, 1 reply; 3+ messages in thread
From: David Westen @ 2026-11-22  5:00 UTC (permalink / raw)
  To: netdev
  Cc: loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
	edumazet, kuba, pabeni, m.chetan.kumar, mail, linux-kernel,
	David Westen, stable

Unless the BIOS reports D3L2 for the WWAN slot, the suspend callback
only rings the FORCE_SLEEP doorbell, and resume the FORCE_ACTIVE one.
Neither waits for the modem. The driver doesn't keep the device in
D0, so the PCI core then puts it into D3hot anyway. An XMM7360 in a
ThinkPad X1 Carbon 6th gen doesn't survive that: after
suspend-to-idle its execution stage already reads CD_READY when the
resume callback runs, and the first port open fails:

  iosm 0000:03:00.0: PORT open refused, phase A-CD_READY

The modem then stays unusable until an ACPI reset.

Send the ENTER_SLEEP and EXIT_SLEEP host sleep messages on every
system suspend, as the D3L2 path already does, so the modem knows it
is going to D3 before it gets there.

This ignores the BIOS RTD3 setting for system suspend. The setting
only selects the sleep protocol; the PCI core chooses the power state
without it, and here chooses D3hot, which the doorbell protocol
doesn't survive. Honoring D0L12 literally would mean keeping the
device in D0, as commit f4dd5174e273 ("net: wwan: iosm: Keep device
at D0 for s2idle case") did. That was reverted, D3 being the expected
state.

With this change the modem stays in RUN through 2 and 10 minute
suspend-to-idle cycles, and its data session keeps working. Platforms
that do well with the doorbells now use the messages too.

Fixes: be8c936e540f ("net: iosm: power management")
Cc: stable@vger.kernel.org
Signed-off-by: David Westen <davidlwesten@gmail.com>
---

Notes:
    This is independent of my S3 series ("net: wwan: iosm: fix S3 resume by
    re-binding the driver around it"), which leaves suspend-to-idle to these
    callbacks; it applies with or without it.
    
    Maciej suggested forcing the D3L2 path for suspend-to-idle earlier and it
    helped another XMM7360 user with the same CD_READY symptom:
    https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/992#note_2938256
    
    Tested on an XMM7360 (ThinkPad X1 Carbon 6th gen, BIOS reports D0L12)
    with 7.2.15 and a debug build that forces the D3L2 path, which is what
    this patch does, logging the execution stage and the PCI power state.
    Starting from a fresh ACPI reset, the doorbells left the modem in
    CD_READY by the resume callback after 2 minutes of suspend-to-idle.
    With the host sleep messages it stayed in RUN through four cycles of 2
    and 10 minutes, two of them right after a fresh reset, and ping over
    wwan0 still worked afterwards. The modem and its root port went to
    D3hot in both cases. This patch itself, backported to 7.2.15 on top of
    my S3 series, then passed a 2 and a 10 minute suspend-to-idle cycle with
    ping working after each, and S3 with my series still works. Built with
    W=1 on net/main. Not tested on the XMM7560 or on a platform where the
    doorbells work.
    
    The investigation and the patch were done with an AI coding assistant
    (Claude Opus 5.5). It read the driver and the earlier discussion, and
    added temporary debug logging to record the execution stage, the PCI
    power state and the messages around suspend and resume. We wrote the
    change and the changelog together, and I ran the tests.

 drivers/net/wwan/iosm/iosm_ipc_pcie.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
index 49052eb511ba..dd7cfe3747ef 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
@@ -406,14 +406,10 @@ static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
 
 	ipc_pcie = pci_get_drvdata(pdev);
 
-	switch (ipc_pcie->d3l2_support) {
-	case IPC_PCIE_D0L12:
-		ipc_pcie_suspend_s2idle(ipc_pcie);
-		break;
-	case IPC_PCIE_D3L2:
-		ipc_pcie_suspend(ipc_pcie);
-		break;
-	}
+	/* The PCI core puts the device into D3 whatever the BIOS RTD3 setting
+	 * says, so the modem has to be told with the host sleep message.
+	 */
+	ipc_pcie_suspend(ipc_pcie);
 
 	return 0;
 }
@@ -427,14 +423,7 @@ static int __maybe_unused ipc_pcie_resume_cb(struct device *dev)
 
 	ipc_pcie = pci_get_drvdata(pdev);
 
-	switch (ipc_pcie->d3l2_support) {
-	case IPC_PCIE_D0L12:
-		ipc_pcie_resume_s2idle(ipc_pcie);
-		break;
-	case IPC_PCIE_D3L2:
-		ipc_pcie_resume(ipc_pcie);
-		break;
-	}
+	ipc_pcie_resume(ipc_pcie);
 
 	return 0;
 }
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: wwan: iosm: always send the host sleep message on suspend
  2026-11-22  5:00 [PATCH net] net: wwan: iosm: always send the host sleep message on suspend David Westen
@ 2026-11-22 15:05 ` Loic Poulain
  2026-11-22 16:04   ` David Westen
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2026-11-22 15:05 UTC (permalink / raw)
  To: David Westen
  Cc: netdev, ryazanov.s.a, johannes, andrew+netdev, davem, edumazet,
	kuba, pabeni, m.chetan.kumar, mail, linux-kernel, stable

Hi David,

On Sun, Nov 22, 2026 at 6:01 AM David Westen <davidlwesten@gmail.com> wrote:
>
> Unless the BIOS reports D3L2 for the WWAN slot, the suspend callback
> only rings the FORCE_SLEEP doorbell, and resume the FORCE_ACTIVE one.
> Neither waits for the modem. The driver doesn't keep the device in
> D0, so the PCI core then puts it into D3hot anyway. An XMM7360 in a
> ThinkPad X1 Carbon 6th gen doesn't survive that: after
> suspend-to-idle its execution stage already reads CD_READY when the
> resume callback runs, and the first port open fails:
>
>   iosm 0000:03:00.0: PORT open refused, phase A-CD_READY
>
> The modem then stays unusable until an ACPI reset.
>
> Send the ENTER_SLEEP and EXIT_SLEEP host sleep messages on every
> system suspend, as the D3L2 path already does, so the modem knows it
> is going to D3 before it gets there.
>
> This ignores the BIOS RTD3 setting for system suspend. The setting
> only selects the sleep protocol; the PCI core chooses the power state
> without it, and here chooses D3hot, which the doorbell protocol
> doesn't survive. Honoring D0L12 literally would mean keeping the
> device in D0, as commit f4dd5174e273 ("net: wwan: iosm: Keep device
> at D0 for s2idle case") did. That was reverted, D3 being the expected
> state.
>
> With this change the modem stays in RUN through 2 and 10 minute
> suspend-to-idle cycles, and its data session keeps working. Platforms
> that do well with the doorbells now use the messages too.

I don't find the commit message particularly clear, as I understand
it, this change effectively ignores d3l2_support and always uses the
host sleep message path, so could you please simplify the commit
message and more directly explain the problem, its impact, why the
d3l2_support distinction is no longer valid, and how this change fixes
it?

Also see below inline comment.

>
> Fixes: be8c936e540f ("net: iosm: power management")
> Cc: stable@vger.kernel.org
> Signed-off-by: David Westen <davidlwesten@gmail.com>
> ---
>
> Notes:
>     This is independent of my S3 series ("net: wwan: iosm: fix S3 resume by
>     re-binding the driver around it"), which leaves suspend-to-idle to these
>     callbacks; it applies with or without it.
>
>     Maciej suggested forcing the D3L2 path for suspend-to-idle earlier and it
>     helped another XMM7360 user with the same CD_READY symptom:
>     https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/992#note_2938256
>
>     Tested on an XMM7360 (ThinkPad X1 Carbon 6th gen, BIOS reports D0L12)
>     with 7.2.15 and a debug build that forces the D3L2 path, which is what
>     this patch does, logging the execution stage and the PCI power state.
>     Starting from a fresh ACPI reset, the doorbells left the modem in
>     CD_READY by the resume callback after 2 minutes of suspend-to-idle.
>     With the host sleep messages it stayed in RUN through four cycles of 2
>     and 10 minutes, two of them right after a fresh reset, and ping over
>     wwan0 still worked afterwards. The modem and its root port went to
>     D3hot in both cases. This patch itself, backported to 7.2.15 on top of
>     my S3 series, then passed a 2 and a 10 minute suspend-to-idle cycle with
>     ping working after each, and S3 with my series still works. Built with
>     W=1 on net/main. Not tested on the XMM7560 or on a platform where the
>     doorbells work.
>
>     The investigation and the patch were done with an AI coding assistant
>     (Claude Opus 5.5). It read the driver and the earlier discussion, and
>     added temporary debug logging to record the execution stage, the PCI
>     power state and the messages around suspend and resume. We wrote the
>     change and the changelog together, and I ran the tests.
>
>  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 21 +++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> index 49052eb511ba..dd7cfe3747ef 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> @@ -406,14 +406,10 @@ static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
>
>         ipc_pcie = pci_get_drvdata(pdev);
>
> -       switch (ipc_pcie->d3l2_support) {
> -       case IPC_PCIE_D0L12:
> -               ipc_pcie_suspend_s2idle(ipc_pcie);

So ipc_pcie_resume_s2idle function becomes dead code?

> -               break;
> -       case IPC_PCIE_D3L2:
> -               ipc_pcie_suspend(ipc_pcie);
> -               break;
> -       }
> +       /* The PCI core puts the device into D3 whatever the BIOS RTD3 setting
> +        * says, so the modem has to be told with the host sleep message.
> +        */
> +       ipc_pcie_suspend(ipc_pcie);
>
>         return 0;
>  }
> @@ -427,14 +423,7 @@ static int __maybe_unused ipc_pcie_resume_cb(struct device *dev)
>
>         ipc_pcie = pci_get_drvdata(pdev);
>
> -       switch (ipc_pcie->d3l2_support) {
> -       case IPC_PCIE_D0L12:
> -               ipc_pcie_resume_s2idle(ipc_pcie);
> -               break;
> -       case IPC_PCIE_D3L2:
> -               ipc_pcie_resume(ipc_pcie);
> -               break;
> -       }
> +       ipc_pcie_resume(ipc_pcie);
>
>         return 0;
>  }
> --
> 2.56.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: wwan: iosm: always send the host sleep message on suspend
  2026-11-22 15:05 ` Loic Poulain
@ 2026-11-22 16:04   ` David Westen
  0 siblings, 0 replies; 3+ messages in thread
From: David Westen @ 2026-11-22 16:04 UTC (permalink / raw)
  To: Loic Poulain
  Cc: netdev, ryazanov.s.a, johannes, andrew+netdev, davem, edumazet,
	kuba, pabeni, m.chetan.kumar, mail, linux-kernel, stable

Hi Loic,

Thanks for the review.

On 11/22/26 7:05 AM, Loic Poulain wrote:
> I don't find the commit message particularly clear, as I understand
> it, this change effectively ignores d3l2_support and always uses the
> host sleep message path, so could you please simplify the commit
> message and more directly explain the problem, its impact, why the
> d3l2_support distinction is no longer valid, and how this change fixes
> it?
Will do in v2.
> -       switch (ipc_pcie->d3l2_support) {
> -       case IPC_PCIE_D0L12:
> -               ipc_pcie_suspend_s2idle(ipc_pcie);
> So ipc_pcie_resume_s2idle function becomes dead code?
Yes, with this change nothing calls the D0L12 doorbell path any more.
In v2 I'll remove it along with the BIOS RTD3 read, d3l2_support and
the suspend flag only that path used.

I'll wait for the AI review before sending v2.

pw-bot: changes-requested

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-22 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22  5:00 [PATCH net] net: wwan: iosm: always send the host sleep message on suspend David Westen
2026-11-22 15:05 ` Loic Poulain
2026-11-22 16:04   ` David Westen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox