* [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
` (2 more replies)
0 siblings, 3 replies; 6+ 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 [flat|nested] 6+ 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
2026-11-22 20:01 ` Maciej S. Szmigiero
2026-11-23 5:48 ` netdev-bot+sashiko
2 siblings, 1 reply; 6+ 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] 6+ 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; 6+ 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] 6+ 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 20:01 ` Maciej S. Szmigiero
2026-11-23 3:05 ` David Westen
2026-11-23 5:48 ` netdev-bot+sashiko
2 siblings, 1 reply; 6+ messages in thread
From: Maciej S. Szmigiero @ 2026-11-22 20:01 UTC (permalink / raw)
To: David Westen
Cc: loic.poulain, ryazanov.s.a, netdev, johannes, andrew+netdev,
davem, edumazet, kuba, pabeni, m.chetan.kumar, linux-kernel,
stable
On 22.11.2026 06:00, David Westen 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.
I have mixed feelings about this.
Your platform specifies D0L1.2 as the target state so I presume that
is the state that the platform expects the modem to be put into?
The reverted commit f4dd5174e273 on the other hand always put the modem
into D0, which was incorrect in a different way - as, for example, my
platform explicitly requests D3.
Could you try the reverted commit to see if D0 actually works for your
platform?
> 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;
> }
Thanks,
Maciej
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: wwan: iosm: always send the host sleep message on suspend
2026-11-22 20:01 ` Maciej S. Szmigiero
@ 2026-11-23 3:05 ` David Westen
0 siblings, 0 replies; 6+ messages in thread
From: David Westen @ 2026-11-23 3:05 UTC (permalink / raw)
To: Maciej S. Szmigiero
Cc: loic.poulain, ryazanov.s.a, netdev, johannes, andrew+netdev,
davem, edumazet, kuba, pabeni, m.chetan.kumar, linux-kernel,
stable
Hi Maciej,
Thanks for taking a look!
On 11/22/26 12:01 PM, Maciej S. Szmigiero wrote:
> On 22.11.2026 06:00, David Westen wrote:
>> 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.
>
> I have mixed feelings about this.
>
> Your platform specifies D0L1.2 as the target state so I presume that
> is the state that the platform expects the modem to be put into?
It turns out it doesn't specify anything: the WWAN _DSM function 3
returns no result here (BIOS 1.56 and the latest 1.68), so D0L12 is
only the driver's default.
> The reverted commit f4dd5174e273 on the other hand always put the modem
> into D0, which was incorrect in a different way - as, for example, my
> platform explicitly requests D3.
Agreed. How does yours request it, through the _DSM returning 3?
> Could you try the reverted commit to see if D0 actually works for your
> platform?
I tried f4dd5174e273 on 7.2.15. With it, the modem is no longer put
into D3hot, but it still crashes during suspend-to-idle: when the
resume callback runs, the modem already reports CD_READY, the same as
without the commit. So it seems it's the FORCE_SLEEP doorbell that the
modem doesn't survive, whether it stays in D0 or goes to D3hot.
David
^ permalink raw reply [flat|nested] 6+ 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 20:01 ` Maciej S. Szmigiero
@ 2026-11-23 5:48 ` netdev-bot+sashiko
2 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-11-23 5:48 UTC (permalink / raw)
To: davidlwesten
Cc: netdev, loic.poulain, ryazanov.s.a, johannes, andrew+netdev,
davem, edumazet, kuba, pabeni, m.chetan.kumar, mail,
linux-kernel, stable
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 4
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] This patch sends every platform through ipc_pcie_suspend() ->
ipc_imem_pm_suspend() -> ipc_protocol_suspend().
- [Medium] With this patch, every system suspend on D0L12 platforms
relies on ipc_pm_wait_for_device_active().
- [Low] SIMPLE_DEV_PM_OPS(iosm_ipc_pm, ipc_pcie_suspend_cb,
ipc_pcie_resume_cb) expands to SYSTEM_SLEEP_PM_OPS.
- [Low] The patch removes the only callers of the s2idle path but leaves
its pieces behind, and one of them changes behaviour.
- [Low] The new comment in ipc_pcie_suspend_cb() says "The PCI core puts
the device into D3 whatever the BIOS RTD3 setting says".
- [Low] net: wwan: iosm: wrong commit cited in Fixes: trailer
--
net: wwan: iosm: always send the host sleep message on suspend
This patch makes the iosm suspend and resume callbacks always use the
ENTER_SLEEP/EXIT_SLEEP host sleep message path (ipc_pcie_suspend() and
ipc_pcie_resume()). Before, the D0L12 doorbell-only s2idle path was chosen
from the BIOS RTD3 _DSM setting. The goal is to keep an XMM7360 usable
after suspend-to-idle when the PCI core puts it into D3hot.
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> index 49052eb511baa..dd7cfe3747efc 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;
> - }
[Severity: Low]
This removes the only callers of ipc_pcie_suspend_s2idle() and
ipc_pcie_resume_s2idle(). They are __maybe_unused, so a W=1 build won't
warn. ipc_imem_pm_s2idle_sleep(), ipc_protocol_s2idle_sleep() and
ipc_pm_set_s2idle_sleep() become dead code along with them.
ipc_pcie->d3l2_support is also still filled from the ACPI _DSM in
ipc_pcie_probe(), but nothing reads it any more. Should these be removed
too?
There is also a behaviour change. ipc_pcie_suspend_s2idle() was the only
code that set bit 0 of ipc_pcie->suspend, and that bit gates IRQ
processing:
drivers/net/wwan/iosm/iosm_ipc_irq.c:ipc_msi_interrupt() {
...
if (!test_bit(0, &ipc_pcie->suspend))
ipc_imem_irq_process(ipc_pcie->imem, instance);
...
}
On D0L12 platforms, MSIs that arrived between the suspend and resume
callbacks used to be dropped. Now they go to ipc_imem_irq_process() and
the tasklet. Was this intended?
The commit message doesn't mention it. The referenced commit f4dd5174e273
dealt with spurious XMM7560 wakeups on this same s2idle path.
> + /* 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.
> + */
[Severity: Low]
Is this comment true in general? For platform-manageable devices,
pci_target_state() returns whatever the firmware chooses:
drivers/pci/pci.c:pci_target_state() {
if (platform_pci_power_manageable(dev)) {
pci_power_t state = platform_pci_choose_state(dev);
switch (state) {
case PCI_POWER_ERROR:
case PCI_UNKNOWN:
return PCI_D3hot;
case PCI_D1:
case PCI_D2:
if (pci_no_d1d2(dev))
return PCI_D3hot;
}
return state;
}
...
}
So firmware can choose PCI_D0. The commit message describes this as
platform-specific ("here chooses D3hot"). The comment turns it into a
general rule and uses it to justify ignoring d3l2_support.
Where firmware keeps the WWAN function in D0 for s2idle, the modem would
now get the ENTER_SLEEP/EXIT_SLEEP handshake while it stays in D0/L1.2.
The notes say that case was not tested, and neither were the XMM7560 or
platforms where the doorbells work.
> + ipc_pcie_suspend(ipc_pcie);
[Severity: Low]
The Fixes: tag points at be8c936e540f ("net: iosm: power management").
That commit only added iosm_ipc_pm.c and iosm_ipc_pm.h.
The code this patch changes lives in iosm_ipc_pcie.c. That covers
ipc_pcie_suspend_cb() and ipc_pcie_resume_cb(), including the switch
on ipc_pcie->d3l2_support that picked between the s2idle doorbell path
and the host sleep message path. As far as I can tell, all of it came
in with 7e98d785ae61 ("net: iosm: entry point").
Should the tag be this instead?
Fixes: 7e98d785ae61 ("net: iosm: entry point")
There is no runtime effect. But the stable tooling and anyone bisecting
later rely on the tag to find the commit that introduced the behaviour
being changed, so it is worth pointing at the right one.
[Severity: Medium]
Every platform now goes through
ipc_pcie_suspend()->ipc_imem_pm_suspend()->ipc_protocol_suspend(). That
includes D0L12 platforms and platforms without the _DSM. What happens when
the handshake fails?
ipc_pm_prepare_host_sleep() sets host_pm_state to
IPC_MEM_HOST_PM_SLEEP_WAIT_D3. If the wake ack times out, nothing sets it
back:
drivers/net/wwan/iosm/iosm_ipc_protocol.c:ipc_protocol_suspend() {
if (!ipc_pm_prepare_host_sleep(&ipc_protocol->pm))
goto err;
...
if (!ipc_pm_wait_for_device_active(&ipc_protocol->pm)) {
ipc_uevent_send(ipc_protocol->pcie->dev, UEVENT_MDM_TIMEOUT);
goto err;
}
...
err:
return false;
}
Only the branch where sending ENTER_SLEEP fails resets host_pm_state to
ACTIVE.
On resume, ipc_pm_prepare_host_active() rejects any state other than
IPC_MEM_HOST_PM_SLEEP. EXIT_SLEEP is then never sent and
ipc_imem_phase_update_check() is skipped. Every later suspend also fails in
ipc_pm_prepare_host_sleep(), which requires ACTIVE.
Meanwhile ipc_pm_signal_hpda_doorbell() holds doorbells back:
if (host_slp_check && ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE &&
ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE_WAIT) {
ipc_pm->pending_hpda_update = true;
...
return;
}
ipc_pm_on_link_wake() only flushes pending_hpda_update in ACTIVE, and only
ipc_pm_init() resets host_pm_state. Would the DL_PROCESS, UL_WRITE_TD and
TD_UPD_TMR doorbells then stay held back until the driver is rebound?
A message timeout has a similar effect. When wait_for_completion_timeout()
returns 0, ipc_protocol_msg_send() logs "msg timeout" and still returns 0.
An ENTER_SLEEP the modem never acknowledged still moves host_pm_state to
SLEEP.
The failure result is also dropped. ipc_protocol_suspend() returns false
when the suspend must be aborted, but ipc_imem_pm_suspend() returns void.
ipc_pcie_suspend() and ipc_pcie_suspend_cb() always return 0.
When the handshake fails, the PCI core then puts the modem into D3hot with
no notice at all, not even the FORCE_SLEEP doorbell the old D0L12 path
rang. Isn't that the condition the commit message says leaves the modem
unusable?
Could host_pm_state be rolled back on failure, and then either fall back
to the doorbells or fail the suspend?
[Severity: Medium]
Every system suspend now depends on ipc_pm_wait_for_device_active(). Can
it lose the wake ack?
drivers/net/wwan/iosm/iosm_ipc_pm.c:ipc_pm_wait_for_device_active() {
if (ipc_pm->ap_state != IPC_MEM_DEV_PM_ACTIVE) {
smp_mb__before_atomic();
set_bit(0, &ipc_pm->host_sleep_pend);
smp_mb__after_atomic();
if (!wait_for_completion_interruptible_timeout
(&ipc_pm->host_sleep_complete,
msecs_to_jiffies(IPC_PM_ACTIVE_TIMEOUT_MS))) {
...
}
ap_state is checked before set_bit() and not checked again. The modem
answers the WAKEUP doorbell from ipc_protocol_tq_wakeup_dev_slp()
asynchronously:
MSI -> tasklet
ipc_protocol_pm_dev_sleep_handle()
ipc_pm_dev_slp_notification()
ipc_pm_trigger(IPC_PM_UNIT_LINK, true)
ipc_pm_on_link_wake(ack=true)
ipc_pm->ap_state = IPC_MEM_DEV_PM_ACTIVE;
if (test_bit(CONSUME_STATE, &ipc_pm->host_sleep_pend))
complete(&ipc_pm->host_sleep_complete);
The tasklet can run between the waiter's ap_state check and its
set_bit(), on another CPU or on the same CPU. In that case complete() is
skipped and the waiter times out after 500 ms. ipc_protocol_suspend() then
leaves host_pm_state at IPC_MEM_HOST_PM_SLEEP_WAIT_D3, as described above.
There is also a signal case. With a signal pending,
wait_for_completion_interruptible_timeout() returns -ERESTARTSYS, and the
!ret test treats that as success. ENTER_SLEEP is then sent while the link
is still waking:
- its doorbell is held back as pending_hpda_update
- ipc_pm_on_link_wake() won't flush it in SLEEP_WAIT_D3
- the message times out and ipc_protocol_msg_send() returns 0
- host_pm_state becomes SLEEP without the modem being told
This needs the callback to run in a task with a signal pending, for
example with pm_async=0.
host_sleep_complete is also never reset with reinit_completion(). A stale
complete() after a timeout mostly can't reach a later wait, though,
because ipc_pm_prepare_host_sleep() fails first.
>
> 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);
[Severity: Low]
SIMPLE_DEV_PM_OPS(iosm_ipc_pm, ipc_pcie_suspend_cb, ipc_pcie_resume_cb)
binds these callbacks to .freeze/.thaw/.poweroff/.restore as well as
.suspend/.resume. On D0L12 platforms, hibernation therefore also moves from
the doorbells to the ENTER_SLEEP/EXIT_SLEEP handshake. Is that intended?
The commit message only covers system suspend and suspend-to-idle testing.
The new D3 comment in ipc_pcie_suspend_cb() doesn't hold for freeze/thaw,
where the PCI core leaves the device in D0.
On restore, the restored driver has host_pm_state ==
IPC_MEM_HOST_PM_SLEEP from the snapshot. It sends EXIT_SLEEP to a modem
that the boot kernel re-initialized. If that message fails,
ipc_protocol_resume() sets host_pm_state back to SLEEP and the HPDA
doorbells are held back.
S3 on D0L12 platforms changes too. According to the notes, S3 was tested
only on top of the separate S3 series, which a stable backport will
usually lack.
The coverage caveats (not tested on XMM7560 or on platforms where the
doorbells work) are below the --- line, so they won't reach the git log.
Could the commit message mention hibernation, S3 and these caveats?
>
> return 0;
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122050039.861287-1-davidlwesten%40gmail.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-23 5:48 UTC | newest]
Thread overview: 6+ 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
2026-11-22 20:01 ` Maciej S. Szmigiero
2026-11-23 3:05 ` David Westen
2026-11-23 5:48 ` netdev-bot+sashiko
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®