public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Falcon, Thomas" <thomas.falcon@intel.com>
To: "ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>
Cc: "david.e.box@linux.intel.com" <david.e.box@linux.intel.com>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"manivannan.sadhasivam@oss.qualcomm.com"
	<manivannan.sadhasivam@oss.qualcomm.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"lukas@wunner.de" <lukas@wunner.de>
Subject: Re: [RFC PATCH 3/4] pcie/aspm: Enable all hardware power-saving states by default
Date: Thu, 30 Apr 2026 22:19:34 +0000	[thread overview]
Message-ID: <fcabed06c2b6fa163954e18972ae70bccdcffbf7.camel@intel.com> (raw)
In-Reply-To: <dfff52bc-06ad-0531-f28a-72804620c072@linux.intel.com>

On Thu, 2026-04-30 at 13:17 +0300, Ilpo Järvinen wrote:
> On Wed, 29 Apr 2026, Thomas Falcon wrote:
> 
> > For systems with a BIOS release date starting in 2025, default
> > ASPM policy to powersupersave if supported in the ACPI FADT.
> > Provide a flag, aspm_user_policy, tracking whether a user has
> > requested a specific power state to give those precedence.
> > Do not enable all states if user has chosen a specific policy
> > or disabled ASPM using the pcie_aspm module parameter.
> > 
> > Suggested-by: David E. Box <david.e.box@linux.intel.com>
> > Signed-off-by: Thomas Falcon <thomas.falcon@intel.com>
> > ---
> >  drivers/pci/pci-acpi.c  |  4 +++-
> >  drivers/pci/pcie/aspm.c | 17 +++++++++++++++++
> >  include/linux/pci.h     |  1 +
> >  3 files changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> > index 4d0f2cb6c695..d849bc6d0c0c 100644
> > --- a/drivers/pci/pci-acpi.c
> > +++ b/drivers/pci/pci-acpi.c
> > @@ -1523,7 +1523,9 @@ static int __init acpi_pci_init(void)
> >  	if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
> >  		pr_info("ACPI FADT declares the system doesn't
> > support PCIe ASPM, so disable it\n");
> >  		pcie_no_aspm();
> > -	}
> > +	} else
> > +		/* If ASPM is supported, configure the default
> > policy here. */
> > +		pcie_aspm_policy_config_init();
> 
> Please balance braces (and with comment this is multiline block
> anyway 
> so you should use braces even because of that).

Thanks, I will fix this in the next version.

> 
> >  
> >  	if (acpi_pci_disabled)
> >  		return 0;
> > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> > index 84d49aa8a5ba..1c81e2f2e589 100644
> > --- a/drivers/pci/pcie/aspm.c
> > +++ b/drivers/pci/pcie/aspm.c
> > @@ -267,6 +267,8 @@ static int aspm_policy =
> > POLICY_POWER_SUPERSAVE;
> >  #else
> >  static int aspm_policy;
> >  #endif
> > +static int aspm_default_policy = POLICY_POWER_SUPERSAVE;
> > +static bool aspm_user_policy;
> >  
> >  static const char *policy_str[] = {
> >  	[POLICY_DEFAULT] = "default",
> > @@ -1609,6 +1611,7 @@ static int pcie_aspm_set_policy(const char
> > *val,
> >  	down_read(&pci_bus_sem);
> >  	mutex_lock(&aspm_lock);
> >  	aspm_policy = i;
> > +	aspm_user_policy = true;
> >  	list_for_each_entry(link, &link_list, sibling) {
> >  		pcie_config_aspm_link(link,
> > policy_to_aspm_state(link));
> >  		pcie_set_clkpm(link, policy_to_clkpm_state(link));
> > @@ -1810,6 +1813,20 @@ static int __init pcie_aspm_disable(char
> > *str)
> >  
> >  __setup("pcie_aspm=", pcie_aspm_disable);
> >  
> > +
> > +
> 
> Extra empty lines.

Oops, I will fix in v2.

> 
> > +void __init pcie_aspm_policy_config_init(void)
> > +{
> > +	/*
> > +	 * Set ASPM policy here, enabling all power-saving states
> > +	 * unless ASPM has been disabled or the user has already
> > +	 * requested a policy or the systems BIOS release date
> > +	 * is before the year 2025. Otherwise use BIOS defaults.
> > +	 */
> > +	if (!aspm_disabled && !aspm_user_policy &&
> > dmi_get_bios_year() >= 2025)
> 
> Is it good to have this 2025 check in two places as literals, should
> there 
> be only one function which is called by both places?

Ok, might be able to use pcie_aspm_legacy_config_check from the
previous patch here. I will fix in v2.

Thanks,
Tom

> 
> > +		aspm_policy = aspm_default_policy;
> > +}
> > +
> >  void pcie_no_aspm(void)
> >  {
> >  	/*
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 2c4454583c11..36fa5579709c 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -1915,6 +1915,7 @@ int pci_disable_link_state_locked(struct
> > pci_dev *pdev, int state);
> >  int pci_enable_link_state(struct pci_dev *pdev, int state);
> >  int pci_enable_link_state_locked(struct pci_dev *pdev, int state);
> >  void pcie_no_aspm(void);
> > +void pcie_aspm_policy_config_init(void);
> >  bool pcie_aspm_support_enabled(void);
> >  bool pcie_aspm_enabled(struct pci_dev *pdev);
> >  #else
> > 
> 


  reply	other threads:[~2026-04-30 22:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 18:06 [RFC PATCH 0/4] pcie/aspm: Enable all advertised ASPM states by default Thomas Falcon
2026-04-29 18:06 ` [RFC PATCH 1/4] pcie/aspm: Add debug logging for aspm policy config Thomas Falcon
2026-04-29 18:06 ` [RFC PATCH 2/4] pcie/aspm: Enable all power-saving states during link state initialization Thomas Falcon
2026-04-29 18:06 ` [RFC PATCH 3/4] pcie/aspm: Enable all hardware power-saving states by default Thomas Falcon
2026-04-30 10:17   ` Ilpo Järvinen
2026-04-30 22:19     ` Falcon, Thomas [this message]
2026-04-29 18:06 ` [RFC PATCH 4/4] pcie/aspm: Remove CONFIG_PCIEASPM_* policy definitions Thomas Falcon

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=fcabed06c2b6fa163954e18972ae70bccdcffbf7.camel@intel.com \
    --to=thomas.falcon@intel.com \
    --cc=bhelgaas@google.com \
    --cc=david.e.box@linux.intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=rafael@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox