On Tue, Sep 9, 2025 at 9:16 PM Mario Limonciello (AMD)
<supe...@kernel.org> wrote:
>
> Suspend resume actions will check the state of the device and whether
> bus PM should be skipped.  These same actions make sense during hibernation
> image restore.

Not really (see below).

They kind of would have made sense in the error code path attempting
to roll back the power-off transition, but I'm not sure if this is
worth the hassle because it would require ->restore() to be able to
handle two different cases without knowing which case it is handling.

>  Apply them there as well.
>
> Tested-by: Eric Naim <dn...@cachyos.org>
> Signed-off-by: Mario Limonciello (AMD) <supe...@kernel.org>
> ---
> v7:
>  * Reword title
> v5:
>  * Split out patch
> ---
>  drivers/pci/pci-driver.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 571a3809f163a..fb6f1f60b2f1f 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1246,10 +1246,15 @@ static int pci_pm_restore_noirq(struct device *dev)
>  {
>         struct pci_dev *pci_dev = to_pci_dev(dev);
>         const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> +       pci_power_t prev_state = pci_dev->current_state;

In the hibernation restore case, pci_dev->current_state is irrelevant
because the system has gone through the entire init in the BIOS and
boot loader, and the boot (restore) kernel before the control goes
back to the image kernel which runs the ->restore() callbacks.  It may
have changed three times since it was set during power-off.

> +       bool skip_bus_pm = pci_dev->skip_bus_pm;

This one is irrelevant either in that case.

>
>         pci_pm_default_resume_early(pci_dev);
>         pci_fixup_device(pci_fixup_resume_early, pci_dev);
>
> +       if (!skip_bus_pm && prev_state == PCI_D3cold)
> +               pci_pm_bridge_power_up_actions(pci_dev);
> +
>         if (pci_has_legacy_pm_support(pci_dev))
>                 return 0;
>
> --

Reply via email to