Skip to contentSkip to conversation

PCI: qcom: Skip system suspend/resume for firmware-managed PCIe

PATCH Applied Mrinmay Sarkar 4 participants 5 messages Aug 31 – Sep 3

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: qcom: Skip system suspend/resume for firmware-managed PCIe

For firmware-managed PCIe controllers, all resources, including clocks, regulators, resets, PHYs and link state, are owned and managed by firmware. The host driver must not attempt to manage these resources during system suspend or resume.

Skip the suspend and resume operations for firmware-managed controllers. The associated power domain transitions are handled independently by the genpd framework through its own system suspend/resume callbacks, so no explicit action is required by the PCIe driver.

---
Hi,

Firmware-managed PCIe controllers rely on firmware for managing PCIe resources such as clocks, regulators, resets, PHYs and link state.
Skip the host-managed suspend/resume operations for such controllers. The associated power-domain transitions are already handled by the generic power-domain framework during system suspend/resume.

Thanks,
Mrinmay

---
 drivers/pci/controller/dwc/pcie-qcom.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +8 -0
index b58a607b713f..56f0d039e36d 100644
@@ -2341,6 +2341,10 @@ static int qcom_pcie_suspend_noirq(struct device *dev)
 {
 	struct qcom_pcie *pcie;
 	int ret = 0;
+	const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(dev);
+
+	if (pcie_cfg && pcie_cfg->firmware_managed)
+		return 0;
 
 	pcie = dev_get_drvdata(dev);
 	if (!pcie)
@@ -2399,6 +2403,10 @@ static int qcom_pcie_resume_noirq(struct device *dev)
 {
 	struct qcom_pcie *pcie;
 	int ret;
+	const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(dev);
+
+	if (pcie_cfg && pcie_cfg->firmware_managed)
+		return 0;
 
 	pcie = dev_get_drvdata(dev);
 	if (!pcie)

---
base-commit: e30626823a406725ce29bc75cb8ec467d3e1e326
change-id: 20260831-skip_suspend-a5bc5b29fb34

Best regards,

Signature · 1 line
Mrinmay Sarkar <[email protected]>
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Redundant OF match lookup in latency-sensitive noirq suspend/resume fastpaths --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Redundant OF match lookup in latency-sensitive noirq suspend/resume fastpaths --

commit c4c9a4ee7ca3ece5a2758b2afa96d34b1ed85c1a
Author: Mrinmay Sarkar <[email protected]>

PCI: qcom: Skip system suspend/resume for firmware-managed PCIe

This commit skips host-managed suspend and resume operations for PCIe controllers that are managed by firmware. It relies on the generic power domain framework to handle the necessary transitions instead.

drivers/pci/controller/dwc/pcie-qcom.c static int qcom_pcie_suspend_noirq(struct device *dev) · line 2347

Quoted 11 lines
drivers/pci/controller/dwc/pcie-qcom.c +4 -0
@@ -2341,6 +2341,10 @@ static int qcom_pcie_suspend_noirq(struct device *dev)
 {
 	struct qcom_pcie *pcie;
 	int ret = 0;
+	const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(dev);
+
+	if (pcie_cfg && pcie_cfg->firmware_managed)
+		return 0;

[Severity: Low]
Is this new OF match lookup redundant?

Since qcom_pcie_probe() bypasses setting drvdata for firmware-managed controllers, dev_get_drvdata() already natively returns NULL for these devices. The pre-existing check just below this addition handles that:

    pcie = dev_get_drvdata(dev);
    if (!pcie)
        return 0;

Because this executes in the noirq phase where local CPU interrupts are disabled and latency is critical, does it make sense to avoid the overhead of of_device_get_match_data() string comparisons and just rely on the existing NULL check?

Quoted 3 lines
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
 	pcie = dev_get_drvdata(dev);
 	if (!pcie)

[ ... ]

drivers/pci/controller/dwc/pcie-qcom.c static int qcom_pcie_resume_noirq(struct device *dev) · line 2409

Quoted 8 lines
drivers/pci/controller/dwc/pcie-qcom.c +4 -0
@@ -2399,6 +2403,10 @@ static int qcom_pcie_resume_noirq(struct device *dev)
 {
 	struct qcom_pcie *pcie;
 	int ret;
+	const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(dev);
+
+	if (pcie_cfg && pcie_cfg->firmware_managed)
+		return 0;

[Severity: Low]
Similarly for the resume path, does this introduce unnecessary overhead in the noirq phase?

The identical dev_get_drvdata() check is present just below this addition, which already safely catches firmware-managed controllers and returns 0.

Quoted 3 lines
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
 	pcie = dev_get_drvdata(dev);
 	if (!pcie)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Mrinmay Sarkar
Quoted 10 lines · Mrinmay Sarkar

For firmware-managed PCIe controllers, all resources, including clocks, regulators, resets, PHYs and link state, are owned and managed by firmware. The host driver must not attempt to manage these resources during system suspend or resume.

Skip the suspend and resume operations for firmware-managed controllers. The associated power domain transitions are handled independently by the genpd framework through its own system suspend/resume callbacks, so no explicit action is required by the PCIe driver.

What about the D3Cold sequence like broadcasting PME_Turn_Off? Is it also handled by the fw?

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#3 lore raw
Quoted 13 lines · Manivannan Sadhasivam
Quoted 10 lines · Mrinmay Sarkar

For firmware-managed PCIe controllers, all resources, including clocks, regulators, resets, PHYs and link state, are owned and managed by firmware. The host driver must not attempt to manage these resources during system suspend or resume.

Skip the suspend and resume operations for firmware-managed controllers. The associated power domain transitions are handled independently by the genpd framework through its own system suspend/resume callbacks, so no explicit action is required by the PCIe driver.

Quoted 4 lines

What about the D3Cold sequence like broadcasting PME_Turn_Off? Is it also handled by the fw?

- Mani

Thanks, Mani for the review.
Yes. The firmware sends PME_Turn_Off as part of its port deinitialization flow and
waits for the link to enter L2/L3 Ready before powering down the controller.

-Mrinmay

Quoted 3 lines

--
மணிவண்ணன் சதாசிவம்

#4 lore raw
In reply to Mrinmay Sarkar
Quoted 11 lines · Mrinmay Sarkar

For firmware-managed PCIe controllers, all resources, including clocks, regulators, resets, PHYs and link state, are owned and managed by firmware. The host driver must not attempt to manage these resources during system suspend or resume.

Skip the suspend and resume operations for firmware-managed controllers. The associated power domain transitions are handled independently by the genpd framework through its own system suspend/resume callbacks, so no explicit action is required by the PCIe driver.

[...]

Applied, thanks!

[1/1] PCI: qcom: Skip system suspend/resume for firmware-managed PCIe

      commit: 89d17a6331087a76aea1a3a6c03dc45a19d306f2

Best regards,

Signature · 1 line
மணிவண்ணன் சதாசிவம்