From: Manivannan Sadhasivam via B4 Relay <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>,
Jeff Hugo <jeff.hugo@oss.qualcomm.com>,
Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Abel Vesa <abel.vesa@oss.qualcomm.com>,
Len Brown <len.brown@intel.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
stable@vger.kernel.org
Subject: [PATCH 2/2] bus: mhi: host: pci_generic: Use mhi_pm_suspend_force() for system suspend
Date: Wed, 02 Dec 2026 09:43:57 +0100 [thread overview]
Message-ID: <20261202-mhi-suspend-fix-v1-2-451bdce5733c@oss.qualcomm.com> (raw)
In-Reply-To: <20261202-mhi-suspend-fix-v1-0-451bdce5733c@oss.qualcomm.com>
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
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@intel.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220020
Reported-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Cc: stable@vger.kernel.org
---
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
next prev parent reply other threads:[~2026-12-02 8:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:43 [PATCH 0/2] bus: mhi: host: Do not abort system suspend when the MHI device is busy Manivannan Sadhasivam via B4 Relay
2026-12-02 8:43 ` [PATCH 1/2] bus: mhi: host: Add mhi_pm_suspend_force() API Manivannan Sadhasivam via B4 Relay
2026-12-02 10:15 ` Loic Poulain
2026-12-02 13:19 ` Manivannan Sadhasivam
2026-12-02 13:50 ` Loic Poulain
2026-12-02 8:43 ` Manivannan Sadhasivam via B4 Relay [this message]
2026-12-02 10:19 ` [PATCH 2/2] bus: mhi: host: pci_generic: Use mhi_pm_suspend_force() for system suspend Loic Poulain
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=20261202-mhi-suspend-fix-v1-2-451bdce5733c@oss.qualcomm.com \
--to=devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org \
--cc=abel.vesa@oss.qualcomm.com \
--cc=jeff.hugo@oss.qualcomm.com \
--cc=len.brown@intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=mhi@lists.linux.dev \
--cc=stable@vger.kernel.org \
/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®