Re: [PATCH] bus: mhi: host: pci_generic: Switch to async power up to avoid boot delays

From: Manivannan Sadhasivam

Date: Mon Mar 02 2026 - 08:46:15 EST


On Mon, Mar 02, 2026 at 02:06:56AM -0800, Qiang Yu wrote:
> On Mon, Mar 02, 2026 at 01:37:38PM +0530, Manivannan Sadhasivam wrote:
> > On Thu, Jan 22, 2026 at 12:53:48AM -0800, Qiang Yu wrote:
> > > Some modem devices can take significant time (up to 20 secs for sdx75) to
> > > enter mission mode during initialization. Currently, mhi_sync_power_up()
> > > waits for this entire process to complete, blocking other driver probes
> > > and delaying system boot.
> > >
> > > Switch to mhi_async_power_up() so probe can return immediately while MHI
> > > initialization continues in the background. This eliminates lengthy boot
> > > delays and allows other drivers to probe in parallel, improving overall
> > > system boot performance.
> > >
> >
> > This part is fine.
> >
> > > Add pm_runtime_forbid() in remove path to prevent device suspend during
> > > driver reinstallation. This issue is specific to async power up: with
> > > sync power up, pm_runtime_put_noidle() is called after mission mode is
> > > reached because mhi_sync_power_up() waits for mission mode event. With
> > > async power up, pm_runtime_put_noidle() is called immediately while power
> > > up process continues in background, which can cause the device to
> > > suspend and mhi init fail if pm_runtime_allow() from a previous probe
> > > is still active.
> > >
> >
> > pm_runtime_forbid() should be called at the start of the remove() callback to
> > prevent the device from auto suspending during cleanup and to fix the issue you
> > described above.
> >
> > So do in a separate patch and add a Fixes tag pointing to the commit that added
> > the Runtime PM support.
> >
>
> I can implement this in a separate patch as it also serves as a cleanup to
> call pm_runtime_forbid() in the remove callback, since we call
> pm_runtime_allow() in our driver. However, I cannot call it at the start
> of the remove() callback. Before the remove callback is invoked,
> pci_device_remove() calls pm_runtime_get_sync(dev) first, so we don't need
> to worry about auto-suspend during removal.
>

Three issues here:

1. remove() callback uses pm_runtime_get_noresume(), which wouldn't guarantee
that the driver will be resumed (if suspended) during remove operation. So there
is a good chance that the device access will fail.

2. Moreover, pm_runtime_get_noresume() is called at the end of the remove()
callback, which is also too late.

3. Even if the above two gets fixed, we should make sure that the autosuspend
should be stopped before executing remove() as the autosuspend timer will start
and expire in parallel. This is not causing any issue as of now, but it would be
canolical to fix it.

I've submitted a fix for the first two issues:
https://lore.kernel.org/mhi/20260302134116.18960-1-manivannan.sadhasivam@xxxxxxxxxxxxxxxx

You should fix the third one in a separate patch in this series. Hope this
clarifies!

- Mani

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