Skip to contentSkip to conversation

PCI: qcom: Implement shutdown() to avoid SMMU/NoC errors on reboot

PATCH New Krishna Chaitanya Chundru 2 participants 6 messages Nov 26

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

v10 cover PCI: qcom: Implement shutdown() to avoid SMMU/NoC errors on reboot

During system shutdown/reboot, power/clocks to the PCIe controller get removed regardless of link state. If the link is still up when that happens, it can trigger SMMU or NoC errors.

This series adds a shutdown() callback to the Qualcomm PCIe host driver that forces the link into L2/D3cold before shutdown proceeds, reusing the existing suspend_noirq() path.

Patch 1 fixes pci_host_common_d3cold_possible()'s underlying bus walk, which aborts as soon as it finds a device outside D3hot and can therefore miss a later PME-capable device -- something that becomes common once patch 4 starts forcing D3cold entry during shutdown while endpoints may still be in D0.

Patch 2 adds a force parameter to dw_pcie_suspend_noirq() so that the shutdown/reboot path can force L2 entry, skipping the D3cold capability check that can otherwise leave the link up if any endpoint hasn't suspended yet.

Patch 3 adds dw_pcie_mask_msi() to mask the chained MSI parent IRQ(s) without tearing down the MSI domain, for use by the shutdown path.

Patch 4 adds qcom_pcie_shutdown() and wires it up as .shutdown.

---
Changes in v10:
- rockchip (and the other callers') force argument — the build-break fix (Sashiko).
- dw_pcie_mask_msi() using irq_set_chained_handler_and_data() instead of disable_irq() (Sashiko).
- Fixes: tag added to the host-common patch (Sashiko).
- Link to v9: https://patch.msgid.link/[email protected]

Changes in v9:
- Use uniform structure in shutdown covering firmware managed one also (Konrad).
- Link to v8: https://patch.msgid.link/[email protected]

Changes in v8:
- initialize 'pcie' to NULL to fix uninitialized
use in firmware-managed mode (reported by kernel test robot & Sashiko).
- Added new patch "PCI: dwc: Add dw_pcie_mask_msi()" providing the helper used above.
- use new dw_pcie_mask_msi() instead of dw_pcie_free_msi() so the
MSI IRQ domain and downstream MSI mappings are not torn down while
PCI devices are still present (Sashiko).
- skip dw_pcie_suspend_noirq() when the controller is already suspended (Sashiko).
- Link to v7: https://patch.msgid.link/[email protected]

Changes in v7:
- rebased on pci.
- Link to v6: https://patch.msgid.link/[email protected]

Changes in v6:
- remove return 0 in d3cold_possible() (konrad)
- use force as a paramter instead of the element (Mani)
- couple of nits (Konrad)
- call pm_runtime calls for firmware managed one also as we are enabling pm_runtime_enable and get for that also.
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- use a flag/parameter Instead of poking the system states (Mani)
- Fix pme_wakeup issue by walking through entire bus (Sashiko)
- Fix Irq free issue by using dwc free msi API (Sashiko)
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- removed goto d3cold, (Konrad & Sashiko for PME error)
- Disabling MSI IRQ's (Sashiko)
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Added null point check and use pm_runtime_put_sync (Sashiko).
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
1) don't remove the endpoint pci dev's only keep link in D3cold.
Link to v1: https://lore.kernel.org/all/[email protected]/

---
Krishna Chaitanya Chundru (3):
PCI: host-common: Fix early bus-walk exit in d3cold_possible()
PCI: dwc: Force L2 link entry on shutdown/reboot without D3cold check
PCI: dwc: Add dw_pcie_mask_msi() to mask chained MSI without freeing domain

Manivannan Sadhasivam (1):
PCI: qcom: Implement shutdown() callback

 drivers/pci/controller/dwc/pci-imx6.c             |  2 +-
 drivers/pci/controller/dwc/pci-layerscape.c       |  2 +-
 drivers/pci/controller/dwc/pcie-designware-host.c | 26 +++++++++++++-----
 drivers/pci/controller/dwc/pcie-designware.h      |  8 ++++--
 drivers/pci/controller/dwc/pcie-dw-rockchip.c     |  2 +-
 drivers/pci/controller/dwc/pcie-eswin.c           |  2 +-
 drivers/pci/controller/dwc/pcie-nxp-s32g.c        |  2 +-
 drivers/pci/controller/dwc/pcie-qcom.c            | 32 ++++++++++++++++++++++-
 drivers/pci/controller/dwc/pcie-rcar-gen4.c       |  2 +-
 drivers/pci/controller/dwc/pcie-stm32.c           |  2 +-
 drivers/pci/controller/dwc/pcie-ultrarisc.c       |  2 +-
 drivers/pci/controller/pci-host-common.c          | 13 +++------
 12 files changed, 69 insertions(+), 26 deletions(-)

---
base-commit: 647e1e846730c6aad27e9b858df292f5d4377f63
change-id: 20260822-shutdown-fe8139dff2b7

Best regards,

Signature · 1 line
Krishna Chaitanya Chundru <[email protected]>
#1 lore raw

PATCH v10 1/4 PCI: host-common: Fix early bus-walk exit in d3cold_possible()

__pci_host_common_d3cold_possible() returns -EOPNOTSUPP for the first downstream device it finds outside PCI_D3hot, and pci_walk_bus() aborts the walk as soon as its callback returns nonzero. Any device enumerated after the disqualifying one -- including a wakeup-enabled, PME-from-D3cold capable endpoint -- is then never visited, so pme_capable can come back false even though such a device exists on the bus.

Since pci_host_common_d3cold_possible() already returns false whenever any device disqualifies D3cold, aborting the walk buys nothing for the plain suspend path: the overall bool result is unaffected. But it silently drops pme_capable detection for any device ordered after the disqualifying one.

This matters for the upcoming shutdown path in particular: unlike plain suspend, shutdown forces the link into L2/D3cold regardless of whether pci_host_common_d3cold_possible() itself allows it (see the following "force_d3cold" changes), so at shutdown time it's common for an endpoint to still be in D0 and disqualify D3cold while a later, PME-capable device is never visited. dw_pcie_suspend_noirq() still uses "pme_capable" to set pci->pp.skip_pwrctrl_off, so an inaccurate result here can cause Vaux/wakeup support to be dropped for a device that actually supports PME from D3cold.

Fixes 1d2a29ccd3a1 ("PCI: host-common: Add pci_host_common_d3cold_possible() helper")
---
 drivers/pci/controller/pci-host-common.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/pci/controller/pci-host-common.c +4 -9
index a23907a875e5..c2c852c64aa8 100644
@@ -275,21 +275,16 @@ static int __pci_host_common_d3cold_possible(struct pci_dev *pdev,
 		return 0;
 
 	if (pdev->current_state != PCI_D3hot)
-		goto exit;
+		*flags &= ~PCI_HOST_D3COLD_ALLOWED;
 
 	if (device_may_wakeup(&pdev->dev)) {
-		if (!pci_pme_capable(pdev, PCI_D3cold))
-			goto exit;
-		else
+		if (pci_pme_capable(pdev, PCI_D3cold))
 			*flags |= PCI_HOST_PME_D3COLD_CAPABLE;
+		else
+			*flags &= ~PCI_HOST_D3COLD_ALLOWED;
 	}
 
 	return 0;
-
-exit:
-	*flags &= ~PCI_HOST_D3COLD_ALLOWED;
-
-	return -EOPNOTSUPP;
 }
 
 /**
Signature · 1 line
2.34.1
#2 lore raw

PATCH v10 2/4 PCI: dwc: Force L2 link entry on shutdown/reboot without D3cold check

In reply to Krishna Chaitanya Chundru

dw_pcie_suspend_noirq() normally calls pci_host_common_d3cold_possible() to check whether every downstream endpoint can be put into D3cold before bothering to move the link to L2. If no endpoint supports it, the function returns early and leaves the link up.

Querying D3cold support during shutdown is actively harmful, not just
slow: pci_host_common_d3cold_possible() requires every active endpoint to already be in PCI_D3hot, and returns false otherwise. If any endpoint is still in D0 -- which is common, since endpoint drivers aren't guaranteed to have suspended by the time the host's shutdown path runs the check fails and dw_pcie_suspend_noirq() returns early without ever moving the link to L2, leaving it up right up to the point where the system cuts power/clocks to the controller.

Add a force parameter to dw_pcie_suspend_noirq() that callers set explicitly to force this behavior, still call pci_host_common_d3cold_possible() unconditionally, since it's also how pme_capable gets set, but ignore its return value and force L2 entry regardless when force is set.

---
 drivers/pci/controller/dwc/pci-imx6.c             | 2 +-
 drivers/pci/controller/dwc/pci-layerscape.c       | 2 +-
 drivers/pci/controller/dwc/pcie-designware-host.c | 9 ++++-----
 drivers/pci/controller/dwc/pcie-designware.h      | 4 ++--
 drivers/pci/controller/dwc/pcie-dw-rockchip.c     | 2 +-
 drivers/pci/controller/dwc/pcie-eswin.c           | 2 +-
 drivers/pci/controller/dwc/pcie-nxp-s32g.c        | 2 +-
 drivers/pci/controller/dwc/pcie-qcom.c            | 2 +-
 drivers/pci/controller/dwc/pcie-rcar-gen4.c       | 2 +-
 drivers/pci/controller/dwc/pcie-stm32.c           | 2 +-
 drivers/pci/controller/dwc/pcie-ultrarisc.c       | 2 +-
 11 files changed, 15 insertions(+), 16 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +1 -1
index 865438ffde87..5a410e89534f 100644
@@ -1788,7 +1788,7 @@ static int imx_pcie_suspend_noirq(struct device *dev)
 		imx_pcie_assert_perst(imx_pcie, true);
 		imx_pcie->drvdata->enable_ref_clk(imx_pcie, false);
 	} else {
-		return dw_pcie_suspend_noirq(imx_pcie->pci);
+		return dw_pcie_suspend_noirq(imx_pcie->pci, false);
 	}
 
 	return 0;
drivers/pci/controller/dwc/pci-layerscape.c +1 -1
index 7c9fb3bef682..8481fe5a0bf0 100644
@@ -370,7 +370,7 @@ static int ls_pcie_suspend_noirq(struct device *dev)
 	if (!pcie->drvdata->pm_support)
 		return 0;
 
-	return dw_pcie_suspend_noirq(pcie->pci);
+	return dw_pcie_suspend_noirq(pcie->pci, false);
 }
 
 static int ls_pcie_resume_noirq(struct device *dev)
drivers/pci/controller/dwc/pcie-designware-host.c +4 -5
index ab343ed53ba5..0837bb9e67e0 100644
@@ -1229,23 +1229,22 @@ static int dw_pcie_pme_turn_off(struct dw_pcie *pci)
 	return 0;
 }
 
-int dw_pcie_suspend_noirq(struct dw_pcie *pci)
+int dw_pcie_suspend_noirq(struct dw_pcie *pci, bool force)
 {
-	bool d3cold, pme_capable = false;
+	bool d3cold_possible, pme_capable = false;
 	int ret = 0;
 	u32 val;
 
 	if (!dw_pcie_link_up(pci))
 		goto stop_link;
 
-	d3cold = pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable);
-
 	/*
 	 * Enter L2 if D3cold is possible, or if the platform loses RC power
 	 * during suspend (in which case L2 entry is required to notify
 	 * endpoints before power loss, regardless of D3cold support).
 	 */
-	if (!d3cold && !pci->pp.suspend_poweroff)
+	d3cold_possible = pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable);
+	if (!d3cold_possible && !force && !pci->pp.suspend_poweroff)
 		return 0;
 
 	if (pci->pp.ops->pme_turn_off) {
drivers/pci/controller/dwc/pcie-designware.h +2 -2
index 0ece9c433229..f774fc6d2a24 100644
@@ -902,7 +902,7 @@ static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
 const char *dw_pcie_ltssm_status_string(enum dw_pcie_ltssm ltssm);
 
 #ifdef CONFIG_PCIE_DW_HOST
-int dw_pcie_suspend_noirq(struct dw_pcie *pci);
+int dw_pcie_suspend_noirq(struct dw_pcie *pci, bool force);
 int dw_pcie_resume_noirq(struct dw_pcie *pci);
 void dw_handle_msi_irq(struct dw_pcie_rp *pp);
 void dw_pcie_msi_init(struct dw_pcie_rp *pp);
@@ -915,7 +915,7 @@ int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp);
 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
 				       int where);
 #else
-static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci)
+static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci, bool force)
 {
 	return 0;
 }
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1 -1
index 1ce5f700b9cd..10c508f96ec5 100644
@@ -1047,7 +1047,7 @@ static int rockchip_pcie_suspend(struct device *dev)
 	if (rockchip->data->mode == DW_PCIE_EP_TYPE)
 		return 0;
 
-	ret = dw_pcie_suspend_noirq(pci);
+	ret = dw_pcie_suspend_noirq(pci, false);
 	if (ret)
 		return ret;
 
drivers/pci/controller/dwc/pcie-eswin.c +1 -1
index d08277e8cc69..04fe45e137b9 100644
@@ -367,7 +367,7 @@ static int eswin_pcie_suspend_noirq(struct device *dev)
 {
 	struct eswin_pcie *pcie = dev_get_drvdata(dev);
 
-	return dw_pcie_suspend_noirq(&pcie->pci);
+	return dw_pcie_suspend_noirq(&pcie->pci, false);
 }
 
 static int eswin_pcie_resume_noirq(struct device *dev)
drivers/pci/controller/dwc/pcie-nxp-s32g.c +1 -1
index 386e44dd0477..cb9cc9327d85 100644
@@ -365,7 +365,7 @@ static int s32g_pcie_suspend_noirq(struct device *dev)
 	struct s32g_pcie *s32g_pp = dev_get_drvdata(dev);
 	struct dw_pcie *pci = &s32g_pp->pci;
 
-	return dw_pcie_suspend_noirq(pci);
+	return dw_pcie_suspend_noirq(pci, false);
 }
 
 static int s32g_pcie_resume_noirq(struct device *dev)
drivers/pci/controller/dwc/pcie-qcom.c +1 -1
index a6a0e3ecd921..532779295734 100644
@@ -2480,7 +2480,7 @@ static int qcom_pcie_suspend_noirq(struct device *dev)
 	if (!pcie)
 		return 0;
 
-	ret = dw_pcie_suspend_noirq(pcie->pci);
+	ret = dw_pcie_suspend_noirq(pcie->pci, false);
 	if (ret)
 		return ret;
 
drivers/pci/controller/dwc/pcie-rcar-gen4.c +1 -1
index ba8e6b297674..e3807da316c8 100644
@@ -1071,7 +1071,7 @@ static int rcar_gen4_pcie_suspend_noirq(struct device *dev)
 	if (rcar->drvdata->mode != DW_PCIE_RC_TYPE)
 		return 0;
 
-	return dw_pcie_suspend_noirq(&rcar->dw);
+	return dw_pcie_suspend_noirq(&rcar->dw, false);
 }
 
 static int rcar_gen4_pcie_resume_noirq(struct device *dev)
drivers/pci/controller/dwc/pcie-stm32.c +1 -1
index 349618ea5b9c..7b3a8c1b04a4 100644
@@ -78,7 +78,7 @@ static int stm32_pcie_suspend_noirq(struct device *dev)
 	struct stm32_pcie *stm32_pcie = dev_get_drvdata(dev);
 	int ret;
 
-	ret = dw_pcie_suspend_noirq(&stm32_pcie->pci);
+	ret = dw_pcie_suspend_noirq(&stm32_pcie->pci, false);
 	if (ret)
 		return ret;
 
drivers/pci/controller/dwc/pcie-ultrarisc.c +1 -1
index 514e08a12b5a..8cf8b81a0de1 100644
@@ -187,7 +187,7 @@ static int ultrarisc_pcie_suspend_noirq(struct device *dev)
 	if (pci->suspended)
 		return 0;
 
-	ret = dw_pcie_suspend_noirq(pci);
+	ret = dw_pcie_suspend_noirq(pci, false);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH v10 3/4 PCI: dwc: Add dw_pcie_mask_msi() to mask chained MSI without freeing domain

In reply to Krishna Chaitanya Chundru

dw_pcie_free_msi() detaches the chained MSI handler(s) and then removes the MSI IRQ domain via irq_domain_remove(). That is correct for the dw_pcie_host_deinit() teardown path, where PCI devices have already been removed and no MSI mappings remain.

It is not safe to call from the shutdown()/reboot path. device_shutdown() does not remove PCI devices or tear down their per-device child MSI domains, so endpoint drivers that do not free their MSI vectors in a shutdown callback leave live MSI descriptors parented to the domain. Removing the domain there orphans those descriptors and leaves dangling references to freed memory: during a subsequent kexec CPU teardown, IRQ migration walks irq_data->parent_data and can dereference the freed msi_irq_domain.

Add dw_pcie_mask_msi(), which clears the chained handler on the MSI parent interrupt line(s) via irq_set_chained_handler_and_data(). That masks the line(s) at the irqchip under desc->lock while leaving the IRQ domain and the downstream MSI mappings intact. disable_irq() is not used
here: the parent lines are chained handlers, so the standard flow-handler disabled-check never runs, and on irqchips without .irq_disable (e.g. GIC) a lazy disable would leave the line unmasked and a late MSI could still reach dw_handle_msi_irq() and touch unclocked DBI registers.

dw_pcie_free_msi() now reuses the helper, so it is exactly the shutdown masking plus irq_domain_remove().

---
 drivers/pci/controller/dwc/pcie-designware-host.c | 17 ++++++++++++++++-
 drivers/pci/controller/dwc/pcie-designware.h      |  4 ++++
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-host.c +16 -1
index 0837bb9e67e0..c81424e2f95c 100644
@@ -227,7 +227,16 @@ int dw_pcie_allocate_msi_domains(struct dw_pcie_rp *pp)
 }
 EXPORT_SYMBOL_GPL(dw_pcie_allocate_msi_domains);
 
-void dw_pcie_free_msi(struct dw_pcie_rp *pp)
+/**
+ * dw_pcie_mask_msi - Detach and mask the chained MSI parent interrupt(s)
+ * @pp: DWC PCIe RP private data
+ *
+ * Detach the chained MSI handler(s), which masks the parent IRQ line(s),
+ * while leaving the MSI domain and downstream mappings intact (unlike
+ * dw_pcie_free_msi()). Safe for the shutdown() path, where PCI devices
+ * and their MSI descriptors are not removed.
+ */
+void dw_pcie_mask_msi(struct dw_pcie_rp *pp)
 {
 	u32 ctrl;
 
@@ -235,6 +244,12 @@ void dw_pcie_free_msi(struct dw_pcie_rp *pp)
 		if (pp->msi_irq[ctrl] > 0)
 			irq_set_chained_handler_and_data(pp->msi_irq[ctrl], NULL, NULL);
 	}
+}
+EXPORT_SYMBOL_GPL(dw_pcie_mask_msi);
+
+void dw_pcie_free_msi(struct dw_pcie_rp *pp)
+{
+	dw_pcie_mask_msi(pp);
 
 	irq_domain_remove(pp->msi_irq_domain);
 }
drivers/pci/controller/dwc/pcie-designware.h +4 -0
index f774fc6d2a24..677e5423c5e4 100644
@@ -908,6 +908,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp);
 void dw_pcie_msi_init(struct dw_pcie_rp *pp);
 int dw_pcie_msi_host_init(struct dw_pcie_rp *pp);
 void dw_pcie_free_msi(struct dw_pcie_rp *pp);
+void dw_pcie_mask_msi(struct dw_pcie_rp *pp);
 int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
 int dw_pcie_host_init(struct dw_pcie_rp *pp);
 void dw_pcie_host_deinit(struct dw_pcie_rp *pp);
@@ -938,6 +939,9 @@ static inline int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)
 static inline void dw_pcie_free_msi(struct dw_pcie_rp *pp)
 { }
 
+static inline void dw_pcie_mask_msi(struct dw_pcie_rp *pp)
+{ }
+
 static inline int dw_pcie_setup_rc(struct dw_pcie_rp *pp)
 {
 	return 0;
Signature · 1 line
2.34.1
#4 lore raw

PATCH v10 4/4 PCI: qcom: Implement shutdown() callback

In reply to Krishna Chaitanya Chundru

From: Manivannan Sadhasivam <[email protected]>

PCIe host controllers should bring the link down cleanly before system shutdown/reboot proceeds to remove power/clocks from the controller. Without this, the link may still be up and endpoints still have transactions in flight when power/clocks are cut, which can trip SMMU translation faults or NoC protocol errors.

Reuse dw_pcie_suspend_noirq() in the shutdown path to force the link into L2, putting it into D3cold.

device_shutdown() runs with interrupts enabled, unlike suspend_noirq(). Mask the chained MSI IRQ(s) and the Global IRQ before tearing down the link and clocks/PHY, since a late/spurious interrupt could otherwise reach a handler that touches now-unclocked PARF/DBI registers. Use dw_pcie_mask_msi() rather than dw_pcie_free_msi() so the MSI IRQ domain and the MSI mappings held by downstream devices (which device_shutdown() does not remove) are left intact.

Stash a struct qcom_pcie in the platform drvdata in both the normal and the firmware-managed (ECAM) probe paths, so shutdown() has a single path and recovers everything it needs (Global IRQ, config, dw_pcie) uniformly via platform_get_drvdata().

---
 drivers/pci/controller/dwc/pcie-qcom.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +30 -0
index 532779295734..0f548c6ce6a8 100644
@@ -2020,9 +2020,14 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg)
 {
 	struct device *dev = cfg->parent;
 	struct dw_pcie_rp *pp;
+	struct qcom_pcie *pcie;
 	struct dw_pcie *pci;
 	int ret;
 
+	pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
+	if (!pcie)
+		return -ENOMEM;
+
 	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
 	if (!pci)
 		return -ENOMEM;
@@ -2032,6 +2037,9 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg)
 	pci->dbi_base = cfg->win;
 	pp->num_vectors = MSI_DEF_NUM_VECTORS;
 
+	pcie->pci = pci;
+	pcie->cfg = of_device_get_match_data(dev);
+
 	/*
 	 * dw_pcie_msi_host_init() is called directly here, bypassing
 	 * dw_pcie_host_init() where pp->lock is normally initialized.
@@ -2047,6 +2055,9 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg)
 
 	dw_pcie_msi_init(pp);
 
+	/* Stash pcie so qcom_pcie_shutdown() can mask the MSI IRQ(s) later */
+	platform_set_drvdata(to_platform_device(dev), pcie);
+
 	return devm_add_action_or_reset(dev, qcom_pci_free_msi, pp);
 }
 
@@ -2467,6 +2478,24 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static void qcom_pcie_shutdown(struct platform_device *pdev)
+{
+	struct qcom_pcie *pcie = platform_get_drvdata(pdev);
+	struct dw_pcie *pci = pcie->pci;
+
+	if (pcie->global_irq)
+		disable_irq(pcie->global_irq);
+
+	if (pci->pp.use_imsi_rx)
+		dw_pcie_mask_msi(&pci->pp);
+
+	if (!pcie->cfg->firmware_managed && !pci->suspended)
+		dw_pcie_suspend_noirq(pci, true);
+
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
+}
+
 static int qcom_pcie_suspend_noirq(struct device *dev)
 {
 	struct qcom_pcie *pcie;
@@ -2658,5 +2687,6 @@ static struct platform_driver qcom_pcie_driver = {
 		.pm = &qcom_pcie_pm_ops,
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
+	.shutdown = qcom_pcie_shutdown,
 };
 builtin_platform_driver(qcom_pcie_driver);
Signature · 1 line
2.34.1