All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David E. Box" <david.e.box@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: bhelgaas@google.com, mika.westerberg@linux.intel.com,
	 sathyanarayanan.kuppuswamy@linux.intel.com, vidyas@nvidia.com,
	 rafael.j.wysocki@intel.com, kai.heng.feng@canonical.com,
	 tasev.stefanoska@skynet.be, enriquezmark36@gmail.com,
	kernel@witt.link,  koba.ko@canonical.com,
	wse@tuxedocomputers.com, ilpo.jarvinen@linux.intel.com,
	 ricky_wu@realtek.com, linux-pci@vger.kernel.org,
	Michael Schaller <michael@5challer.de>
Subject: Re: [PATCH v5] PCI/ASPM: Add back L1 PM Substate save and restore
Date: Wed, 10 Jan 2024 07:24:31 -0800	[thread overview]
Message-ID: <f95657a40a596c7f9ba0bad413fcd414514cf2b7.camel@linux.intel.com> (raw)
In-Reply-To: <20231229003045.GA1561509@bhelgaas>

On Thu, 2023-12-28 at 18:30 -0600, Bjorn Helgaas wrote:
> [+cc Michael]
> 
> On Thu, Dec 28, 2023 at 04:31:12PM -0600, Bjorn Helgaas wrote:
> > On Wed, Dec 20, 2023 at 05:12:50PM -0800, David E. Box wrote:
> > ...
> 
> > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > > index 55bc3576a985..3c4b2647b4ca 100644
> > > --- a/drivers/pci/pci.c
> > > +++ b/drivers/pci/pci.c
> 
> > > @@ -1579,7 +1579,7 @@ static void pci_restore_pcie_state(struct pci_dev
> > > *dev)
> > >  {
> > > ...
> 
> > > +        So we restore here only the
> > > +	 * LNKCTL register with the ASPM control field clear. ASPM will
> > > +	 * be restored in pci_restore_aspm_state().
> > > +	 */
> > > +	val = cap[i++] & ~PCI_EXP_LNKCTL_ASPMC;
> > > +	pcie_capability_write_word(dev, PCI_EXP_LNKCTL, val);
> > 
> > When CONFIG_PCIEASPM is not set, we will clear ASPMC here and never
> > restore it.  I don't know if this ever happens.  Do we need to worry
> > about this?  Might firmware restore ASPMC itself before we get here?
> > What do we want to happen in this case?

I just checked this. L1 does get disabled which we don't want. We need to save
and restore the BIOS ASPM configuration even when CONFIG_PCIEASPM is not set.

> > 
> > Since ASPM is intertwined with the PCIe Capability, can we call
> > pci_restore_aspm_state() from here instead of from
> > pci_restore_state()?
> > 
> > Calling it here would make it easier to see the required ordering
> > (LNKCTL with ASPMC cleared, restore ASPM L1SS, restore ASPMC) and
> > it would be obvious that none of the other stuff in
> > pci_restore_state() is relevant (PASID, PRI, ATS, VC, etc).
> > 
> > If that could be done, I think it would make sense to do the same with
> > pci_save_aspm_state() even though it's a little more independent.
> 

Makes sense

> The lspci output in Michael's report at
> https://lore.kernel.org/r/76c61361-b8b4-435f-a9f1-32b716763d62@5challer.de
> reminded me that LTR is important for L1.2, and we currently have
> this:
> 
>   pci_restore_state
>     pci_restore_ltr_state
>     pci_restore_pcie_state
> 
> I wonder if pci_restore_ltr_state() should be called from
> pci_restore_pcie_state() as well?  It's intimately connected to ASPM,
> and that connection isn't very clear in the current code.

Make sense too since LTR is a required capability for L1.2. I'll send updated
patches after the merge window.

David

  reply	other threads:[~2024-01-10 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  1:12 [PATCH v5] PCI/ASPM: Add back L1 PM Substate save and restore David E. Box
2023-12-21 10:43 ` Mika Westerberg
2023-12-28 22:31 ` Bjorn Helgaas
2023-12-29  0:30   ` Bjorn Helgaas
2024-01-10 15:24     ` David E. Box [this message]
2024-01-10 18:46       ` Bjorn Helgaas
2024-01-11 12:28         ` Ilpo Järvinen
2024-01-13  0:36           ` David E. Box

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f95657a40a596c7f9ba0bad413fcd414514cf2b7.camel@linux.intel.com \
    --to=david.e.box@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=enriquezmark36@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kernel@witt.link \
    --cc=koba.ko@canonical.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=michael@5challer.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ricky_wu@realtek.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tasev.stefanoska@skynet.be \
    --cc=vidyas@nvidia.com \
    --cc=wse@tuxedocomputers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.