Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anthony Pighin" <anthony.pighin@nokia.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net] igb: Retry the D0 write of the i210 PLL workaround
Date: Fri, 06 Nov 2026 20:53:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-202258@kernel.org> (raw)
In-Reply-To: <20261105205325.2624892-1-anthony.pighin@nokia.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] igb: MMIO access while in D3hot after igb_set_d0_i210() fails
- [Low] igb: __bitwise pci_power_t type mismatch in igb_set_d0_i210()
--

commit f07d2c21ba2a41d9be32c940436c29816e2eedd2
Author: Anthony Pighin <anthony.pighin@nokia.com>

igb: Retry the D0 write of the i210 PLL workaround

This commit adds igb_set_d0_i210() to retry transitioning the device from
D3hot back to D0 during the i210 PLL errata workaround if the config write is
rejected while the root port reports link training.

> diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
> index 784f9a7bcbed0..fad7cdfea197f 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_i210.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
[ ... ]
> @@ -812,6 +814,33 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw)
>  	return 0;
>  }
>  
> +static bool igb_set_d0_i210(struct e1000_hw *hw, u16 pci_word)
> +{
> +	struct igb_adapter *adapter = hw->back;
> +	u16 pmcsr;
> +	int i;
> +
> +	pci_word &= ~PCI_PM_CTRL_STATE_MASK;
> +	pci_word |= PCI_D0;
> +
> +	/* Some host controller drivers refuse config accesses while the root
> +	 * port reports link training. The root port can report link training
> +	 * while the device is in D3hot, so the write that requests D0 can be
> +	 * refused.
> +	 */
> +	for (i = 0; i < 1000; i++) {
> +		igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
> +		igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pmcsr);
> +		if (!PCI_POSSIBLE_ERROR(pmcsr) &&
> +		    (pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D0)
> +			return true;

[Severity: Low]
Does mixing PCI_D0 with u16 pci_word and (pmcsr & PCI_PM_CTRL_STATE_MASK)
trigger Sparse warnings?  PCI_D0 is a restricted __bitwise pci_power_t token
rather than a raw PMCSR register value, so both the bitwise OR and the
comparison degrade pci_power_t to an integer under Sparse.

[ ... ]

> @@ -866,8 +895,8 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
>  		pci_word |= E1000_PCI_PMCSR_D3;
>  		igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
>  		usleep_range(1000, 2000);
> -		pci_word &= ~E1000_PCI_PMCSR_D3;
> -		igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
> +		if (!igb_set_d0_i210(hw, pci_word))
> +			break;

[Severity: Medium]
If igb_set_d0_i210() fails, does breaking out of the loop still perform MMIO
accesses while the device is stuck in D3hot?

After the loop, igb_pll_workaround_i210() runs:

drivers/net/ethernet/intel/igb/e1000_i210.c:igb_pll_workaround_i210() {
    ...
	igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
	/* restore MDICNFG setting */
	wr32(E1000_MDICNFG, mdicnfg);
	return ret_val;
}

igb_write_phy_reg_82580() acquires the PHY semaphore and reads E1000_SWSM via
igb_rd32(), and igb_reset() also continues issuing MMIO accesses after
init_hw() fails.  Because the device is still in D3hot, readl() returns
0xffffffff, causing igb_rd32() to clear hw->hw_addr, report "PCIe link lost",
and trigger a WARN().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261105205325.2624892-1-anthony.pighin@nokia.com?part=1

      reply	other threads:[~2026-11-06 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 20:53 [PATCH iwl-net] igb: Retry the D0 write of the i210 PLL workaround Anthony Pighin
2026-11-06 20:53 ` sashiko-bot [this message]

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=sashiko-outbox-202258@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anthony.pighin@nokia.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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