From: Mrinmay Sarkar <mrinmay.sarkar@oss.qualcomm.com>
To: "Manivannan Sadhasivam" <mani@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Rama Krishna <rama.krishna@oss.qualcomm.com>,
Nitesh Gupta <nitesh.gupta@oss.qualcomm.com>,
Ayiluri Naga Rashmi <ayiluri.rashmi@oss.qualcomm.com>,
Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>,
Shazad Hussain <shazad.hussain@oss.qualcomm.com>,
Mrinmay Sarkar <mrinmay.sarkar@oss.qualcomm.com>
Subject: [PATCH 1/2] PCI: qcom: Implement .reset_root_port() for firmware-managed controllers
Date: Fri, 16 Oct 2026 18:27:19 +0530 [thread overview]
Message-ID: <20261016-pcie-controller-reset-v1-1-51779736cf12@oss.qualcomm.com> (raw)
In-Reply-To: <20261016-pcie-controller-reset-v1-0-51779736cf12@oss.qualcomm.com>
During PCIe recovery events, such as a fatal AER event or other
platform-specific PCIe failures, the controller may enter a state that
requires a full reset before normal link operation can be restored.
On firmware-managed PCIe controllers, Linux does not control the PHY,
clocks, resets, or LTSSM state directly. Instead, these resources are
managed by firmware through the power-domain framework.
Implement the reset_root_port() callback by performing a Runtime PM
power cycle of the controller. This allows firmware to reset and
reinitialize the hardware before bringing the controller back online.
Since controller state is lost across the power cycle, reinitialize the
DWC MSI configuration after resume.
This enables Root Port reset and recovery support for firmware-managed
controllers.
Signed-off-by: Mrinmay Sarkar <mrinmay.sarkar@oss.qualcomm.com>
---
drivers/pci/controller/dwc/pcie-qcom.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index d903f10211c2..744455ae90d4 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1855,6 +1855,35 @@ static int qcom_pcie_set_max_opp(struct device *dev)
return ret;
}
+/*
+ * Reset for firmware-managed controllers: power-cycle via runtime PM and
+ * reprogram DWC MSI registers on resume.
+ */
+static int qcom_pcie_fw_reset_root_port(struct pci_host_bridge *bridge,
+ struct pci_dev *pdev)
+{
+ struct pci_config_window *cfg = bridge->sysdata;
+ struct device *dev = bridge->dev.parent;
+ struct dw_pcie_rp *pp = cfg->priv;
+ int ret;
+
+ ret = pm_runtime_force_suspend(dev);
+ if (ret) {
+ dev_err(dev, "Failed to force runtime suspend for reset: %d\n", ret);
+ return ret;
+ }
+
+ ret = pm_runtime_force_resume(dev);
+ if (ret) {
+ dev_err(dev, "Failed to force runtime resume after reset: %d\n", ret);
+ return ret;
+ }
+
+ dw_pcie_msi_init(pp);
+
+ return 0;
+}
+
/*
* Qcom PCIe controllers only support one Root Port per controller instance. So
* this function ignores the 'pci_dev' associated with the Root Port and just
@@ -2031,6 +2060,8 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg)
dw_pcie_msi_init(pp);
+ cfg->priv = pp;
+
return devm_add_action_or_reset(dev, qcom_pci_free_msi, pp);
}
@@ -2292,6 +2323,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
bridge->sysdata = cfg;
bridge->ops = (struct pci_ops *)&pci_qcom_ecam_ops.pci_ops;
bridge->msi_domain = true;
+ bridge->reset_root_port = qcom_pcie_fw_reset_root_port;
ret = pci_host_probe(bridge);
if (ret)
--
2.43.0
next prev parent reply other threads:[~2026-10-16 12:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 12:57 [PATCH 0/2] PCI: qcom: Add support for firmware-managed PCIe controller recovery Mrinmay Sarkar
2026-10-16 12:57 ` Mrinmay Sarkar [this message]
2026-10-16 12:57 ` [PATCH 2/2] PCI: qcom: Reinitialize MSI on resume for firmware-managed controllers Mrinmay Sarkar
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=20261016-pcie-controller-reset-v1-1-51779736cf12@oss.qualcomm.com \
--to=mrinmay.sarkar@oss.qualcomm.com \
--cc=ayiluri.rashmi@oss.qualcomm.com \
--cc=bhelgaas@google.com \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=nitesh.gupta@oss.qualcomm.com \
--cc=rama.krishna@oss.qualcomm.com \
--cc=shazad.hussain@oss.qualcomm.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
all inboxes | Powered by JetHome®