From: Ajay Agarwal <ajayagarwal@google.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"David E. Box" <david.e.box@linux.intel.com>,
"Johan Hovold" <johan+linaro@kernel.org>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Manu Gautam" <manugautam@google.com>,
"Sajid Dalvi" <sdalvi@google.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Vidya Sagar" <vidyas@nvidia.com>,
"Shuai Xue" <xueshuai@linux.alibaba.com>
Cc: linux-pci@vger.kernel.org, Ajay Agarwal <ajayagarwal@google.com>
Subject: [PATCH] PCI/ASPM: Save downstream port L1ss control when saving for upstream
Date: Wed, 27 Nov 2024 09:07:58 +0530 [thread overview]
Message-ID: <20241127033758.3974931-1-ajayagarwal@google.com> (raw)
It is possible that the downstream port's L1ss registers were not
saved after the initial configuration performed in the function
aspm_calc_l12_info() during the child bus probe. If the upstream
port config space is saved-restored due to some reason, the
downstream port L1ss registers will be overwritten with stale
configuration due to the logic present in
pci_restore_aspm_l1ss_state(). So, attempt to save the downstream
port L1ss registers when we are at the upstream component.
Signed-off-by: Ajay Agarwal <ajayagarwal@google.com>
---
drivers/pci/pcie/aspm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index cee2365e54b8..769a305fad63 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -99,6 +99,19 @@ void pci_save_aspm_l1ss_state(struct pci_dev *pdev)
cap = &save_state->cap.data[0];
pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL2, cap++);
pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, cap++);
+
+ /*
+ * It is possible that the downstream port's L1ss registers were not
+ * saved after the initial configuration performed in the function
+ * aspm_calc_l12_info() during the child bus probe. If the upstream port
+ * config space is saved-restored due to some reason, the downstream
+ * port L1ss registers will be overwritten with stale configuration due
+ * to the logic present in pci_restore_aspm_l1ss_state(). So, attempt to
+ * save the downstream port L1ss registers when we are at the upstream
+ * component.
+ */
+ if (!pcie_downstream_port(pdev))
+ pci_save_aspm_l1ss_state(pdev->bus->self);
}
void pci_restore_aspm_l1ss_state(struct pci_dev *pdev)
--
2.47.0.338.g60cca15819-goog
next reply other threads:[~2024-11-27 3:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 3:37 Ajay Agarwal [this message]
2024-11-27 10:54 ` [PATCH] PCI/ASPM: Save downstream port L1ss control when saving for upstream Ilpo Järvinen
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=20241127033758.3974931-1-ajayagarwal@google.com \
--to=ajayagarwal@google.com \
--cc=bhelgaas@google.com \
--cc=david.e.box@linux.intel.com \
--cc=hkallweit1@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=johan+linaro@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=manugautam@google.com \
--cc=sdalvi@google.com \
--cc=vidyas@nvidia.com \
--cc=xueshuai@linux.alibaba.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