[PATCH 2/2] bus: mhi: host: pci_generic: Use mhi_pm_suspend_force() for system suspend
From: Manivannan Sadhasivam via B4 Relay
Date: Wed Dec 02 2026 - 03:44:28 EST
From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
System suspend reuses the runtime suspend callback, so it inherits the
-EBUSY abort of mhi_pm_suspend() when the device has asserted WAKE or has
packets pending to be transferred. While aborting works fine for runtime
suspend, it is a disaster for system suspend, because a single driver
aborting suspend aborts the entire suspend process. This is what happens on
Qcom Glymur based laptops and Lenovo Thinkpad T16 laptops, where a failed
MHI modem suspend aborts the whole system suspend:
mhi-pci-generic 0006:01:00.0: failed to suspend device: -16
mhi-pci-generic 0006:01:00.0: PM: failed to suspend async: error -16
To fix this issue, make use of the new API mhi_pm_suspend_force() during
system suspend and continue using mhi_pm_suspend() during runtime suspend.
To achieve this, split the common part of the suspend code into
__mhi_pci_suspend() helper with the 'force' argument. And set this argument
to true during system suspend and false during runtime suspend.
If the mhi_pm_suspend_force() API returns an error for any reason, continue
the system suspend as there is nothing more the driver can do. Later during
resume, the device will be recovered if needed.
Reported-by: Len Brown <len.brown@xxxxxxxxx>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220020
Reported-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
drivers/bus/mhi/host/pci_generic.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index b1938c55ffda..9eb7dbb68d2e 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -1694,7 +1694,7 @@ static const struct pci_error_handlers mhi_pci_err_handler = {
.reset_done = mhi_pci_reset_done,
};
-static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev)
+static int __mhi_pci_suspend(struct device *dev, bool force)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev);
@@ -1714,11 +1714,14 @@ static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev)
goto pci_suspend; /* Nothing to do at MHI level */
/* Transition to M3 state */
- err = mhi_pm_suspend(mhi_cntrl);
+ err = force ? mhi_pm_suspend_force(mhi_cntrl) : mhi_pm_suspend(mhi_cntrl);
if (err) {
dev_err(&pdev->dev, "failed to suspend device: %d\n", err);
- clear_bit(MHI_PCI_DEV_SUSPENDED, &mhi_pdev->status);
- return -EBUSY;
+ /* For system suspend, sleep anyway and recover on resume */
+ if (!force) {
+ clear_bit(MHI_PCI_DEV_SUSPENDED, &mhi_pdev->status);
+ return -EBUSY;
+ }
}
pci_suspend:
@@ -1728,6 +1731,11 @@ static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev)
return 0;
}
+static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev)
+{
+ return __mhi_pci_suspend(dev, false);
+}
+
static int __maybe_unused mhi_pci_runtime_resume(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
@@ -1780,7 +1788,7 @@ static int __maybe_unused mhi_pci_runtime_resume(struct device *dev)
static int __maybe_unused mhi_pci_suspend(struct device *dev)
{
pm_runtime_disable(dev);
- return mhi_pci_runtime_suspend(dev);
+ return __mhi_pci_suspend(dev, true);
}
static int __maybe_unused mhi_pci_resume(struct device *dev)
--
2.43.0