Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Jian-Hong Pan <jhp@endlessos.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Niklāvs Koļesņikovs" <pinkflames.linux@gmail.com>
Subject: [PATCH 1/1] PCI/ASPM: Fix L1SS saving
Date: Fri, 31 Jan 2025 17:29:13 +0200	[thread overview]
Message-ID: <20250131152913.2507-1-ilpo.jarvinen@linux.intel.com> (raw)

The commit 1db806ec06b7 ("PCI/ASPM: Save parent L1SS config in
pci_save_aspm_l1ss_state()") aimed to perform L1SS config save for both
the Upstream Port and its upstream bridge when handling an Upstream
Port, which matches what the L1SS restore side does. However,
parent->state_saved can be set true at an earlier time when the
upstream bridge saved other parts of its state. Then later when
attempting to save the L1SS config while handling the Upstream Port,
parent->state_saved is true in pci_save_aspm_l1ss_state() resulting in
early return and skipping saving bridge's L1SS config because it is
assumed to be already saved. Later on restore, junk is written into
L1SS config which causes issues with some devices.

Remove parent->state_saved check and unconditionally save L1SS config
also for the upstream bridge from an Upstream Port which ought to be
harmless from correctness point of view. With the Upstream Port check
now present, saving the L1SS config more than once for the bridge is no
longer a problem (unlike when the parent->state_saved check got
introduced into the fix during its development).

Fixes: 1db806ec06b7 ("PCI/ASPM: Save parent L1SS config in pci_save_aspm_l1ss_state()")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219731
Reported-by: Niklāvs Koļesņikovs <pinkflames.linux@gmail.com>
Tested-by: Niklāvs Koļesņikovs <pinkflames.linux@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/pcie/aspm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index e0bc90597dca..da3e7edcf49d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -108,9 +108,6 @@ void pci_save_aspm_l1ss_state(struct pci_dev *pdev)
 	pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL2, cap++);
 	pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL1, cap++);
 
-	if (parent->state_saved)
-		return;
-
 	/*
 	 * Save parent's L1 substate configuration so we have it for
 	 * pci_restore_aspm_l1ss_state(pdev) to restore.

base-commit: 72deda0abee6e705ae71a93f69f55e33be5bca5c
-- 
2.39.5


             reply	other threads:[~2025-01-31 15:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31 15:29 Ilpo Järvinen [this message]
2025-02-04 20:39 ` [PATCH 1/1] PCI/ASPM: Fix L1SS saving Bjorn Helgaas
2025-02-04 20:55   ` Niklāvs Koļesņikovs
2025-02-05  8:38   ` Ilpo Järvinen
2025-02-05 13:37     ` Bjorn Helgaas
2025-02-07  9:56       ` Jian-Hong Pan

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=20250131152913.2507-1-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=jhp@endlessos.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pinkflames.linux@gmail.com \
    /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