Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: "Adrià Vilanova Martínez" <me@avm99963.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	"Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	regressions@lists.linux.dev, linux-pci@vger.kernel.org
Subject: Re: [REGRESSION] Intel Wireless adapter is not detected until suspending to RAM and resuming
Date: Wed, 22 Oct 2025 18:19:05 +0200	[thread overview]
Message-ID: <aPkD-cECjlXx3kJP@wunner.de> (raw)
In-Reply-To: <aPj4kUglHgBm4uAt@wunner.de>

On Wed, Oct 22, 2025 at 05:30:25PM +0200, Lukas Wunner wrote:
> Looking at the ASPM configuration in the lspci output you've provided,
> I note that after booting without 4d4c10f763d7, ASPM is disabled on
> the Root Port but L1 is enabled on the Wifi card!
> 
> After resuming from system sleep, ASPM is disabled on both of them
> (with and without 4d4c10f763d7).
> 
> I suspect the incongruence of ASPM settings between Root Port and
> Wifi card is the root cause of the Presence Detect Changed flaps
> as well as the Correctable Errors.  I guess the BIOS set these
> incorrectly.  Looking at the code in:
> 
> pcie_aspm_init_link_state()
>   pcie_aspm_cap_init()
> 
> ... it first disables L0s and L1 to initialize L1 substates,
> then restores the register values as they were set by BIOS.
> This feels wrong.  The safest option is probably to instead
> disable L0s and/or L1 if either of them was only enabled
> on one of the two link partners.

Below is a completely untested patch to force ASPM to the
intersection of the two link partners, thus fixing incongruent
BIOS settings.  Does it help on a kernel with 4d4c10f763d7?
If it does, what's the behavior if applied to a kernel without
4d4c10f763d7?

I tried to find errata on the Intel AC 7265 "Stone Peak" wifi card
and instead found this document which explains that only L1 and
not L0s is supported:

https://fcc.report/FCC-ID/2AVBM-GK5/5728379.pdf

Thanks,

Lukas

-- >8 --

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 7cc8281..7fd3eda 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -830,8 +830,8 @@ static void pcie_aspm_override_default_link_state(struct pcie_link_state *link)
 static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 {
 	struct pci_dev *child = link->downstream, *parent = link->pdev;
+	u16 parent_lnkctl, child_lnkctl, common_lnkctl;
 	u32 parent_lnkcap, child_lnkcap;
-	u16 parent_lnkctl, child_lnkctl;
 	struct pci_bus *linkbus = parent->subordinate;
 
 	if (blacklist) {
@@ -900,6 +900,12 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 	/* Restore L0s/L1 if they were enabled */
 	if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) ||
 	    FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl)) {
+		common_lnkctl = FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) &
+				FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl);
+		parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPMC;
+		parent_lnkctl |= common_lnkctl;
+		child_lnkctl &= ~PCI_EXP_LNKCTL_ASPMC;
+		child_lnkctl |= common_lnkctl;
 		pcie_capability_write_word(parent, PCI_EXP_LNKCTL, parent_lnkctl);
 		pcie_capability_write_word(child, PCI_EXP_LNKCTL, child_lnkctl);
 	}

  reply	other threads:[~2025-10-22 16:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18 22:01 [REGRESSION] Intel Wireless adapter is not detected until suspending to RAM and resuming Adrià Vilanova Martínez
2025-10-19  5:12 ` Mario Limonciello
2025-10-19  9:35   ` Adrià Vilanova Martínez
2025-10-19 11:37     ` Adrià Vilanova Martínez
2025-10-19 18:22       ` Mario Limonciello
2025-10-19 23:08         ` Adrià Vilanova Martínez
2025-10-20  0:25           ` Mario Limonciello
2025-10-20 12:56             ` Adrià Vilanova Martínez
2025-10-20 16:37               ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 17:38                 ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 22:33                   ` Adrià Vilanova Martínez
2025-10-20 23:25                 ` Bjorn Helgaas
2025-10-21  7:37                   ` Lukas Wunner
2025-10-21  8:30                     ` Lukas Wunner
2025-10-21 13:35                     ` Adrià Vilanova Martínez
2025-10-22 15:30                       ` Lukas Wunner
2025-10-22 16:19                         ` Lukas Wunner [this message]
2025-10-27 16:36                           ` Adrià Vilanova Martínez
2025-10-28 14:30                             ` Adrià Vilanova Martínez
2025-10-27 15:49                         ` Adrià Vilanova Martínez

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=aPkD-cECjlXx3kJP@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=me@avm99963.com \
    --cc=regressions@lists.linux.dev \
    --cc=superm1@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