🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20500

Re: [PATCH net v2 2/2] net: wwan: iosm: fix S3 resume by re-binding the driver around it

#20500
From: "Maciej S. Szmigiero"
Date: Sun, 22 Nov 2026 20:01
99 lines
15214 bytes
On 19.11.2026 05:27, David Westen wrote:
> 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.

I think this re-binding should never happen on s2idle, even though S3
might be the default mem sleep method.

It looks to me that the only remaining case here is the "opportunistic
sleep" code which does not use mem_sleep_current (so won't be covered by
pm_suspend_default_s2idle()) - but uses autosleep_state instead.

> - 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.

Are there any such pm_suspend(PM_SUSPEND_MEM) calls in the kernel (outside
some test code)?

> 
> 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;
>   

Thanks,
Maciej
Technical Details
Message-ID: <5651d569-d291-48e1-b38d-8cbdb2c2f0a8@maciej.szmigiero.name>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368799-linux-kernel-netdev=dewy.ru
References: <20261119042714.505405-1-davidlwesten@gmail.com> <20261119042714.505405-2-davidlwesten@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368799-linux-kernel-netdev=dewy.ru
From: mail@maciej.szmigiero.name ("Maciej S. Szmigiero")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 2/2] net: wwan: iosm: fix S3 resume by re-binding
 the driver around it
Date: Sun, 22 Nov 2026 21:01:13 +0100
Organization: Usenet Network
Sender: mhej@vps-ovh.mhejs.net
Message-ID: <5651d569-d291-48e1-b38d-8cbdb2c2f0a8@maciej.szmigiero.name>
References: <20261119042714.505405-1-davidlwesten@gmail.com>
 <20261119042714.505405-2-davidlwesten@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3712824"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:GUMnShPo6YzOjdWnXxVZrXXC23M= sha256:MS645yTSZ83hmrfdEz56sIpZGqbgmrv7gG72JofGfnw=
	sha1:uXffsoSOR9vK5kY7LsrSSdc/Oso= sha256:jc86OhhoDTVgctROFBRNvRBq91ziM4c03l16vbxmYJI=
Content-Language: en-US, pl-PL
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E6687125D84; Sun, 22 Nov 2026 23:01:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id xWhrCcj1lt32;
	Sun, 22 Nov 2026 23:01:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-368799-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=maciej.szmigiero.name
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id B4E41125D82; Sun, 22 Nov 2026 23:01:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id B50CA6038E2; Sun, 22 Nov 2026 20:01:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795377692;
	b=a75+pw2TPS4cXHf/50CZGw7VmYHc9Lt/Q2rgIE3EKpDNXw70OloFu83d9k0Bye8SxR4+
	 T11VftvzJtQyz2saT+GtSsumEbPCHEuHrulb5y8ep/rX9z9JMJLSNEbR5YDPtFsZBX7U9
	 DK4HAax/IrysjU/azSQwTPkErwZ9YYEmLnwT+7M9liM9/JP7ZUXYR9MEC4WxGNROwTpJj
	 mB09JcKrgAsLtfQdLpEhOUekInm34SNXjjbPKP3vHT5UgbxEJYLyS1j0gIDhTI2Npi76L
	 mDrdwOIKafgKX7KrzLLN7iu78f7O7YNEZGGXE0TpCvYwZncbHUA2sa1F1z6LxS5BlUQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795377692;
	h=X-Original-To:Received:DMARC-Filter:Received:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:Content-Language:Autocrypt:
	 Disposition-Notification-To:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding:Sender;
	bh=+FkGnM2fnU0IKINvnoMfZCIIgvS7HvGvB/+EcCAgPi4=;
	b=qsbffEhBFS98JpR6Xwf/X99oPdcCcdLS/pCrQ1zyO4arjh/nqAT+l8GEZAzh9K/cg1WZ
	 Igq4G8ssOoxa7T+SzSE17pvz5g4R0ZBqhS6OFbXBMHIBDdB6OxGe/MwllObCbt/ujn/5u
	 bQRqdCGQzMunYX0G/ZzDPZsUTkXHH3bo2Iibr/SOTEYyklSdsg6jkPHPqxBkwX6DGufW1
	 Fjx6JtmOc3FPkQG38/eL7xVcGqp8SfFifUDtxgXZOxcKwmhBsXdFlEqcxvdEDDkGSdM+D
	 r9hAIyKlUOUZhmzKx+xZgpR6QocEitkT1wQ0ABC2RlLxa4nWvmFgqfxqUx5JnLp8lnA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=maciej.szmigiero.name;
	spf=pass smtp.mailfrom=vps-ovh.mhejs.net;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E1A38606A68F;
	Sun, 22 Nov 2026 20:01:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=145.239.82.108
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795377687;
	b=IEAFmaC7c0CE+4QLcArsQzhcGT2XdcBnhwTdzdro+H5QHd8XxL1mBNMkn2Fx30XMjBI2
	 nukvqVkLLsn7oK0vt/sB1y2ib0X/m035pJ2E7EorOrjjOl1j1LzEdDLN1LwWf3aGAC/mu
	 Z+hQKVxPBYLGhufFTl5liqxZ1+kEFiiKVtoMPX2UNoH0A3SmNrvyw3vtZgE2UltKLI3zV
	 ggl3tfkBTCflLfdyXQq1lznoG5OvkIdN5mjZembxw0SgC+68uc2Nt2+lMjvZA+9gaIil2
	 KJUNSF2I+vY1ZxBYSkQPOzNBOSnQSNJdcc+3CMEwOhxRtxUgw/WG4naz3taY2VGxayQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795377687;
	h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:Content-Language:Autocrypt:
	 Disposition-Notification-To:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding:Sender;
	bh=+FkGnM2fnU0IKINvnoMfZCIIgvS7HvGvB/+EcCAgPi4=;
	b=Iiw8vLApl2xwVGHSaM8MOurVq9jy7a+O4O517oKIMaDW2EEnwaqID3O2T6wLOxSXf4L4
	 Il8oXZ7+oY0ijQ/ByuhK7/bOFNywGRXKYRAglcxi1qcAkoCsyfFLryyOzOrLyS+YmLZo/
	 aRv+fH76vJId+auHHtNpv9DaZwjWADB9tZvQHPIi14MFnLDtMEjQYYtT0lCFI7WKn9Rv2
	 xBm4q6Q4Iu3yrdo2tSk2h9PFntHW8TX9LEN81oszYcJJomahitZsUKGLahznxikMJbhGS
	 hol3RSXhSQJe6SeXLlttZqAOwRVJDboIJeJCxLqwvRKBEf+ljTyPooge7SJxUchESug==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=maciej.szmigiero.name;
	spf=pass smtp.mailfrom=vps-ovh.mhejs.net;
	arc=none smtp.remote-ip=145.239.82.108
X-Received: from vps-ovh.mhejs.net (vps-ovh.mhejs.net [145.239.82.108])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55EE5606A320;
	Sun, 22 Nov 2026 20:01:25 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55EE5606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=maciej.szmigiero.name
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vps-ovh.mhejs.net
X-Received: from MUA
	by vps-ovh.mhejs.net with esmtpsa  (TLS1.3) tls TLS_AES_128_GCM_SHA256
	(Exim 4.100.1)
	(envelope-from <mhej@vps-ovh.mhejs.net>)
	id 1xVDkP-000000014eN-1meP;
	Sun, 22 Nov 2026 21:01:13 +0100
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-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,
 linux-kernel@vger.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XFZa8dHnQgCkyjA/gs0ujG
 wD+Gs7dYQxP4i+rLhwBWD3mawJxLxY0vGwkG7k7npqanlsWlATHpOdqBMUiAR22hs02FikAo
 iXNgWTy7ABEBAAHCwXwEGAEIACYCGwwWIQRyeg1N257Z9gOb7O+Ef143kM4JdwUCaZD5YwUJ
 ESzCOAAKCRCEf143kM4Jd4+KEADEBLxVKXGqinMD1nb/QPA0Rj35WluRdPIB2dcDcyTOtiyN
 ErIQQMhr0W4sxZOd741a2nv89VZKjzBNjihOZgbEuHfG/0lhIZ5t6aF7k4gbMctzQT7utzmD
 y5OoV+/VFHguLThwxRvCMkGEieE8Cb4muYdQgaq1s5ipV1IqF3cDYg2iGupnsYSgOfw7ZyvG
 9c7Fxn7jiD/wI9eL3AesCkVFbF0r/9yLbuW6vh3kd/+bORO1GK4snSjrZLi04bnihnDfa33N
 Pik3cmUZZANzo+HkADZjJ1pl3DZn1Qj8STk6YhaTtJhLKH4lteAlSS4xRIeoiw/2hbzbRr4j
 hnu96hf6ukM7E7oC89SfWGXZHbUds77MFyKvBTCMJnkQq+PbmYp1vgTnOl3JO7ARZ3rNPkHE
 IpOWDjHRyDiKVVxt2bKaELZrFGcYYTVXt9pUfY1xFt76G0piVr50+jTezgMmZYr7aZOrqlUi
 WHQjcZZbROLql/+ngphSgdthGIhVWrIMHJu1UxnRiwKc/fzDFUZ9hFL+W4ZLm+52TzMatpta
 oNdcP9rtsQjdYMNLuwysP4keDX8yBXADwJD7eQ+ryIIKh6X1lBMIWxeZG5W0DQ6/4BCUEbCe
 1DqkYRtZyUEzgAbaHliaa5t3dfCtSMz5cAbGqxarXc7bKOjA6P8hCwgP0tEypA==
X-Disposition-Notification-To: "Maciej S. Szmigiero"
 <mail@maciej.szmigiero.name>
X-In-Reply-To: <20261119042714.505405-2-davidlwesten@gmail.com>