All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] bus: mhi: Address MHI system suspend abort
@ 2026-11-13 15:17 Len Brown
  2026-11-13 15:17 ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Len Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Len Brown @ 2026-11-13 15:17 UTC (permalink / raw)
  To: rafael, Manivannan Sadhasivam, Loic Poulain; +Cc: linux-pm, mhi, linux-kernel

For Upstream:

[PATCH 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend

For Debug of underlying MHI issue:

[RFC 2/2] bus: mhi: host: Add diagnostic print for -EBUSY in mhi_pm_suspend()

thanks,
-Len

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend
  2026-11-13 15:17 [PATCH 0/2] bus: mhi: Address MHI system suspend abort Len Brown
@ 2026-11-13 15:17 ` Len Brown
  2026-11-13 15:18   ` [RFC 2/2] bus: mhi: host: Add diagnostic print for -EBUSY in mhi_pm_suspend() Len Brown
  2026-11-13 15:21   ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Loic Poulain
  0 siblings, 2 replies; 4+ messages in thread
From: Len Brown @ 2026-11-13 15:17 UTC (permalink / raw)
  To: rafael, Manivannan Sadhasivam, Loic Poulain; +Cc: linux-pm, mhi, linux-kernel

From: Len Brown <len.brown@intel.com>

mhi sometimes aborts system suspend on the thinkpad T16 gen3:

mhi-pci-generic 0000:08:00.0:
... failed to suspend device: -16
... PM: pci_pm_suspend(): mhi_pci_suspend [mhi_pci_generic] returns -16
... PM: dpm_run_callback(): pci_pm_suspend returns -16
... PM: pci_pm_suspend returned -16 after 15145 usecs
... PM: failed to suspend async: error -16

Prevent MHI from spreading this device-specific failure
to the rest of the system.  I.e. "Why is a modem that I don't use
preventing me from suspending my laptop?"

This change does not comprehend the internal root cause of the
mhi failure, which should be found and fixed.

There is also a risk that ignoring the MHI error and continuing
to put the device into PCI D3 will leave it in an error state.

Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/bus/mhi/host/pci_generic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 7193a384cca4..343d1046a25e 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -1727,7 +1727,12 @@ 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);
+
+	/* Ignore errors (e.g. -EBUSY); a failed modem suspend must not abort system suspend */
+	mhi_pci_runtime_suspend(dev);
+
+	/* Must return 0 to allow system suspend to continue */
+	return 0;
 }
 
 static int __maybe_unused mhi_pci_resume(struct device *dev)
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC 2/2] bus: mhi: host: Add diagnostic print for -EBUSY in mhi_pm_suspend()
  2026-11-13 15:17 ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Len Brown
@ 2026-11-13 15:18   ` Len Brown
  2026-11-13 15:21   ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Loic Poulain
  1 sibling, 0 replies; 4+ messages in thread
From: Len Brown @ 2026-11-13 15:18 UTC (permalink / raw)
  To: rafael, Manivannan Sadhasivam, Loic Poulain; +Cc: linux-pm, mhi, linux-kernel

From: Len Brown <len.brown@intel.com>

mhi_pm_suspend() sometimes returns -EBUSY, but doesn't tell us why.

Print dev_wake and pending_pkts when it does.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/bus/mhi/host/pm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
index ced83fbb1a51..2eb7344b3b39 100644
--- a/drivers/bus/mhi/host/pm.c
+++ b/drivers/bus/mhi/host/pm.c
@@ -871,8 +871,12 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
 
 	/* Return busy if there are any pending resources */
 	if (atomic_read(&mhi_cntrl->dev_wake) ||
-	    atomic_read(&mhi_cntrl->pending_pkts))
+	    atomic_read(&mhi_cntrl->pending_pkts)) {
+		dev_err(dev, "DEBUG: suspend busy (early): dev_wake: %d pending_pkts: %d\n",
+			atomic_read(&mhi_cntrl->dev_wake),
+			atomic_read(&mhi_cntrl->pending_pkts));
 		return -EBUSY;
+	}
 
 	/* Take MHI out of M2 state */
 	read_lock_bh(&mhi_cntrl->pm_lock);
@@ -900,6 +904,9 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
 	if (atomic_read(&mhi_cntrl->dev_wake) ||
 	    atomic_read(&mhi_cntrl->pending_pkts)) {
 		write_unlock_irq(&mhi_cntrl->pm_lock);
+		dev_err(dev, "DEBUG: suspend busy (recheck): dev_wake: %d pending_pkts: %d\n",
+			atomic_read(&mhi_cntrl->dev_wake),
+			atomic_read(&mhi_cntrl->pending_pkts));
 		return -EBUSY;
 	}
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend
  2026-11-13 15:17 ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Len Brown
  2026-11-13 15:18   ` [RFC 2/2] bus: mhi: host: Add diagnostic print for -EBUSY in mhi_pm_suspend() Len Brown
@ 2026-11-13 15:21   ` Loic Poulain
  1 sibling, 0 replies; 4+ messages in thread
From: Loic Poulain @ 2026-11-13 15:21 UTC (permalink / raw)
  To: Len Brown; +Cc: rafael, Manivannan Sadhasivam, linux-pm, mhi, linux-kernel

On Fri, Nov 13, 2026 at 4:19 PM Len Brown <lenb@kernel.org> wrote:
>
> From: Len Brown <len.brown@intel.com>
>
> mhi sometimes aborts system suspend on the thinkpad T16 gen3:
>
> mhi-pci-generic 0000:08:00.0:
> ... failed to suspend device: -16
> ... PM: pci_pm_suspend(): mhi_pci_suspend [mhi_pci_generic] returns -16
> ... PM: dpm_run_callback(): pci_pm_suspend returns -16
> ... PM: pci_pm_suspend returned -16 after 15145 usecs
> ... PM: failed to suspend async: error -16
>
> Prevent MHI from spreading this device-specific failure
> to the rest of the system.  I.e. "Why is a modem that I don't use
> preventing me from suspending my laptop?"
>
> This change does not comprehend the internal root cause of the
> mhi failure, which should be found and fixed.
>
> There is also a risk that ignoring the MHI error and continuing
> to put the device into PCI D3 will leave it in an error state.
>
> Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
> Signed-off-by: Len Brown <len.brown@intel.com>

Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>

> ---
>  drivers/bus/mhi/host/pci_generic.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 7193a384cca4..343d1046a25e 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -1727,7 +1727,12 @@ 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);
> +
> +       /* Ignore errors (e.g. -EBUSY); a failed modem suspend must not abort system suspend */
> +       mhi_pci_runtime_suspend(dev);
> +
> +       /* Must return 0 to allow system suspend to continue */
> +       return 0;
>  }
>
>  static int __maybe_unused mhi_pci_resume(struct device *dev)
> --
> 2.45.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-13 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 15:17 [PATCH 0/2] bus: mhi: Address MHI system suspend abort Len Brown
2026-11-13 15:17 ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Len Brown
2026-11-13 15:18   ` [RFC 2/2] bus: mhi: host: Add diagnostic print for -EBUSY in mhi_pm_suspend() Len Brown
2026-11-13 15:21   ` [PATCH v2 1/2] bus: mhi: pci_generic: Prevent MHI from aborting system suspend Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.