Re: [PATCH 2/2] PCI: Disable Precision Time Measurement during suspend

From: David E. Box
Date: Thu Nov 19 2020 - 14:38:52 EST


On Thu, 2020-11-19 at 19:13 +0100, Rafael J. Wysocki wrote:
> On Thu, Nov 19, 2020 at 6:45 PM David E. Box
> <david.e.box@xxxxxxxxxxxxxxx> wrote:
> > On Thu, 2020-11-19 at 13:01 +0100, Rafael J. Wysocki wrote:
> > > On Thu, Nov 19, 2020 at 1:17 AM David E. Box
> > > <david.e.box@xxxxxxxxxxxxxxx> wrote:

...

> > > >
> > > > + */
> > > > + if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
> > >
> > > AFAICS the target sleep state doesn't matter here, so I'd skip
> > > the
> > > check above, but otherwise it LGTM.
> >
> > The target sleep state doesn't matter so much but that it's
> > suspending
> > does. pci_save_state() is called during probe for the root ports
> > (and
> > many other pci devices - I'm curious as to why).
>
> I tend to forget about this, sorry.
>
> > So without this check the capability gets disabled on boot.
> >
>
> So instead of calling this from here, why don't we invoke the code
> below from pci_prepare_to_sleep() and pci_finish_runtime_suspend(),
> before enabling wakeup (and it needs to be re-done on failures, eg.
> by
> restoring the cap from the saved copy)?

Ok.