On Thu, Jun 26, 2025 at 08:15:05PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> > > The PCI bus type does not expect its runtime PM callbacks, > pci_pm_runtime_suspend() and pci_pm_runtime_resume(), to be invoked at > any point during system-wide suspend and resume, so make it express > that expectation by setting power.strict_midlayer for all PCI devices > in pci_pm_prepare() and clear it in pci_pm_complete(). > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> Previous PM-related patches in drivers/pci/ use a subject line like: PCI/PM: ... Would be cool if there were hints about what dev_pm_set_strict_midlayer() means. Maybe the comment in get_callback() is enough, but it takes a little work to find it. Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> > --- > > v1 -> v2: > * Set and clear the new flag in "prepare" and "complete" to allow > pm_runtime_force_suspend() invoked from driver remove callbacks to > work. > * Update subject and changelog. > > --- > drivers/pci/pci-driver.c | 4 ++++ > 1 file changed, 4 insertions(+) > > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -708,6 +708,8 @@ > struct pci_dev *pci_dev = to_pci_dev(dev); > const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; > > + dev_pm_set_strict_midlayer(dev, true); > + > if (pm && pm->prepare) { > int error = pm->prepare(dev); > if (error < 0) > @@ -749,6 +751,8 @@ > if (pci_dev->current_state < pre_sleep_state) > pm_request_resume(dev); > } > + > + dev_pm_set_strict_midlayer(dev, false); > } > > #else /* !CONFIG_PM_SLEEP */ > > >