Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Arina Kharlamova <Arina.Kharlamova@mbzuai.ac.ae>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Philipp Stanner" <phasta@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH net] net: stmmac: intel: Do not call pcim_enable_device() on resume
Date: Thu, 3 Dec 2026 13:06:15 +0100	[thread overview]
Message-ID: <0ddc4d46-571d-4983-a23d-883bba494f7b@bootlin.com> (raw)
In-Reply-To: <4031B36D-2B34-407A-80F6-DB4463A58C6C@mbzuai.ac.ae>

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 <maxime.chevallier@bootlin.com> 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 <arina.kharlamova@mbzuai.ac.ae>
>>>
>>> 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 <arina.kharlamova@mbzuai.ac.ae>
>>> ---
>>> 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 <arina.kharlamova@mbzuai.ac.ae>
>>
>>
>>
> 



  reply	other threads:[~2026-12-03 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 19:14 [PATCH net] net: stmmac: intel: Do not call pcim_enable_device() on resume Arina Kharlamova via B4 Relay
2026-12-02 18:50 ` Maxime Chevallier
2026-12-03 11:20   ` Arina Kharlamova
2026-12-03 12:06     ` Maxime Chevallier [this message]
2026-12-03 12:07 ` Maxime Chevallier

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=0ddc4d46-571d-4983-a23d-883bba494f7b@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=Arina.Kharlamova@mbzuai.ac.ae \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phasta@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