Re: [PATCH 1/4] PCI/PTM: Preserve PTM Root Select

From: Bjorn Helgaas
Date: Fri Sep 02 2022 - 19:32:43 EST


On Fri, Sep 02, 2022 at 02:11:12PM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 9/2/22 1:38 PM, Bjorn Helgaas wrote:
> > On Fri, Sep 02, 2022 at 10:24:05AM -0700, Sathyanarayanan Kuppuswamy wrote:
> >> On 9/2/22 7:58 AM, Bjorn Helgaas wrote:
> >>> From: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> >>>
> >>> When disabling PTM, there's no need to clear the Root Select bit. We
> >>> disable PTM during suspend, and we want to re-enable it during resume.
> >>> Clearing Root Select here makes re-enabling more complicated.
> >>
> >> Currently, it looks like we disable PCI_PTM_CTRL_ROOT in pci_disable_ptm(),
> >> but not enable it in pci_enable_ptm(). Do you know this did not trigger an
> >> issue?
> ...

> > Thanks for asking this, because it reminds me why I didn't add
> > pci_enable_ptm() calls in the resume paths! That would make them
> > parallel with the suspend paths, which would definitely be nice. But
> > we would have to rework pci_enable_ptm() to work for Root Ports and
> > Switch Ports as well. I think we *could* do that. What do you think?
>
> IMO, the code will look better if we keep the suspend and resume paths in
> sync. Since we are calling pci_disable_ptm() in suspend path, it makes
> sense to call pci_enable_ptm() in resume path.
>
> Making the pci_enable_ptm() handle root and upstream ports should not
> be very complicated, right?

I took a stab at it. pci_enable_ptm() is getting kind of ugly, but
maybe it's better overall. I'll post it and you can see what you
think.