From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299596; b=WJ9tf+tmDC98gOosNALUw/1oAPXALeEUZwMycO2RgCMHTzYgUm2sPefmlHcqv+2tGfvG ar1h/khxxL+KX6HqbrHfSdZX68gf9//z9c6Aha/uBKdgeiPSISsJRWIFYJKB9GAEGpzca sXEdKpIJAJJc9PBH8NXWYEfq+9ROZj1LQNZ8S9XyUWW001j484LsZoa8t1ty5dhEvXFjv K+kWjLk//jc460OJJ37WueLNXqMB9EKDw7lcVUThic1qnu/sNC5tyz+XGEucvUIMuyQl0 UgK/wwijuDT3L3gPsMDzKlPcQTve/6SV6cuhAvMOuqxyUcyy4wXl/tadvn6q5v8Nm1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299596; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=2tJYhkLAGNd/rxg1kMHf33Nw7h4wFIqVwTEIarAPu/g=; b=f0BuRn8jvPd5vNTM9pH8j8wXnb0CIRvD7t9NRJeaDe/H54MeyHSlSD28Uz7kC22VQ+9i 0jmzjT+ib4fzHudwqAU1jIJDxr1z5M9CjHTYZd0Qef8g1awthFPXiMX8KxW/BuexDXdB7 f+e695qoRnlq177PY3xJo/YT3d/KpzkEp7QLab7BIdqIp5c2xE5VT6PcsKsxTjrUCckqQ GpArJ/6r9k8wFg1SZxhpjgDUjLvE1S1/0xVV+/cOpjBM/xIcbmYRoUDcL+sFZzsqan2EP A06gXGeGCtGLEws7Y9zlTxXxXJRODDBwcRdUXeEaoevghOctXOXSjHP4RBY/i2SmsnQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=G5dAamLo; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC8AA606A334; Thu, 3 Dec 2026 12:06:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CC8AA606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=G5dAamLo Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E6F44C0133E; Thu, 3 Dec 2026 12:06:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4E04B604ED; Thu, 3 Dec 2026 12:06:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0032311EA1811; Thu, 03 Dec 2026 13:06:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796299586; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=2tJYhkLAGNd/rxg1kMHf33Nw7h4wFIqVwTEIarAPu/g=; b=G5dAamLoWc3iDrxvjqGX2n+ihg2R6UjKNKDIMginXvVmqMW0r1OZkr4oTz5QrYoGasO9vP 8DZ8ArWhUexJnRgoKoIGxN/6a/jEvti8Ze3IwBl0l1dH6XE7myCq8GEeiHLMzGK1rKI9RS puMF4kTpgPl66dv797DPUSc8rfgc4kHHuh3kKfkivvbGrJgFQ5dsnvD7qxE3ppil863qR3 6gJFvtYi6AWcr1j81+d/yMF0XsKry0wrj4Dsxk1vhjo/t4Cwh4NSsEHH6u3CNe5faA/5rt wSm//RQA2YZgaxKARGBWir2uJYqIa4zoSOCJuUuUP8iVebBJVmI9ulCbGjeTBQ== Message-ID: <0ddc4d46-571d-4983-a23d-883bba494f7b@bootlin.com> Date: Thu, 3 Dec 2026 13:06:15 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] net: stmmac: intel: Do not call pcim_enable_device() on resume To: Arina Kharlamova Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Philipp Stanner , "netdev@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-pci@vger.kernel.org" References: <20261201-s2p-d103-v1-1-4304d05f8af8@mbzuai.ac.ae> <84a0c06b-134d-44be-865e-dc7c8d072b4a@bootlin.com> <4031B36D-2B34-407A-80F6-DB4463A58C6C@mbzuai.ac.ae> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <4031B36D-2B34-407A-80F6-DB4463A58C6C@mbzuai.ac.ae> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi, On 12/3/26 12:20, Arina Kharlamova wrote: > Hi Maxime, > >> can you audit as well the stmmac_pci_plat_resume() call ? [0] >> It does the same thing but with pci_enable_device instead of >> pcim_enable_device(), and maybe the right way is to get the generic >> stmmac helper correct and use it in the intel glue ? Just an idea. > > I looked at it. stmmac_pci_plat_suspend() calls pci_disable_device() > and the resume calls pci_enable_device(), so the enable count stays > balanced for its three users and nothing piles up, unlike the intel > resume. So I do not think it needs a fix. Ah ok, thanks a lot for looking this up ! I appreciate :) > > It does undo a pcim_enable_device() by hand for stmmac_pci and > dwmac-motorcomm, which is the pattern Philipp wants to avoid. A > cleanup would keep the device enabled across suspend in the generic > helpers and then let dwmac-intel use stmmac_pci_plat_resume() (its > suspend has to stay, because it puts the device in D3hot itself). That > changes behaviour on the Loongson, Motorcomm and stmmac_pci hardware, > so I would send it to net-next as a separate series once this fix is > in net-next. Does that sound right to you? That sounds good yes, again PCI is not really my comfort zone, feel free to send, I should be able to tests on motorcomm at least. Maxime > Thanks, > Arina > >> On 2 Dec 2026, at 22:50, Maxime Chevallier wrote: >> >> This Message Is From an Untrusted Sender >> You have not previously corresponded with this sender. >> Hi, >> >> On 12/1/26 20:14, Arina Kharlamova via B4 Relay wrote: >>> From: Arina Kharlamova >>> >>> intel_eth_pci_resume() calls pcim_enable_device() although the device >>> is enabled in probe and intel_eth_pci_suspend() does not disable it. >>> Since commit 77f79ac8de0f ("PCI: Remove struct pci_devres.enabled >>> status bit") each call raises the enable count. Since commit >>> f748a07a0b64 ("PCI: Remove legacy pcim_release()") each call also adds >>> a pcim_disable_device() devres action. Both pile up with every >>> suspend and resume until the device is unbound. The call does not >>> touch the hardware, because the enable count is already above zero >>> there. >>> >>> The device stays enabled across suspend, so drop the call. >>> >>> Fixes: 77f79ac8de0f ("PCI: Remove struct pci_devres.enabled status bit") >>> Fixes: f748a07a0b64 ("PCI: Remove legacy pcim_release()") >>> Signed-off-by: Arina Kharlamova >>> --- >>> I found this while checking the other drivers that call >>> pcim_enable_device() again on resume, after the discussion of the t7xx >>> fix: >>> https://urldefense.com/v3/__https://lore.kernel.org/all/20261201-s2p-d64-v1-1-c9147b2eedb0@mbzuai.ac.ae/__;!!J2_iJ0WgAoU!cMaND20Ch0Gl56KPn1arUwuvGvqJWPSIJRC3yD8e5b_uCfx5fVqBulMB70qKgxpBbSpC2-OXTqKFYvAeKqPooqPtpg3tVdA2I5IuZw$ >>> >>> With the help of an AI coding assistant (Claude); I reviewed the >>> analysis and the fix. Not triggered at runtime. Compile-tested only, >>> not tested on hardware. >> >> I _think_ this is correct with my limited PCI knowledge, however can >> you audit as well the stmmac_pci_plat_resume() call ? [0] >> >> It does the same thing but with pci_enable_device instead of >> pcim_enable_device(), and maybe the right way is to get the generic >> stmmac helper correct and use it in the intel glue ? Just an idea. >> >> [0]: https://urldefense.com/v3/__https://elixir.bootlin.com/linux/v7.4-rc2/source/drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.c*L28__;Iw!!J2_iJ0WgAoU!cMaND20Ch0Gl56KPn1arUwuvGvqJWPSIJRC3yD8e5b_uCfx5fVqBulMB70qKgxpBbSpC2-OXTqKFYvAeKqPooqPtpg3tVdAnrWZqkg$ >> >> Maxime >> >>> --- >>> drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 6 ------ >>> 1 file changed, 6 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c >>> index fcd8008545c2..d624f61a35d9 100644 >>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c >>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c >>> @@ -1269,15 +1269,9 @@ static int intel_eth_pci_suspend(struct device *dev, void *bsp_priv) >>> static int intel_eth_pci_resume(struct device *dev, void *bsp_priv) >>> { >>> struct pci_dev *pdev = to_pci_dev(dev); >>> - int ret; >>> >>> pci_restore_state(pdev); >>> pci_set_power_state(pdev, PCI_D0); >>> - >>> - ret = pcim_enable_device(pdev); >>> - if (ret) >>> - return ret; >>> - >>> pci_set_master(pdev); >>> >>> return 0; >>> >>> --- >>> base-commit: c712df600d056cc35ef7621e43c8e12513bae886 >>> change-id: 20261201-s2p-d103-40aa9498b98d >>> >>> Best regards, >>> -- >>> Arina Kharlamova >> >> >> >