All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: bhelgaas@google.com,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PCI: Enable ASPM L1 on TI PCIe-to-PCI bridge
Date: Mon, 4 May 2020 09:15:21 -0500	[thread overview]
Message-ID: <20200504141521.GA265122@bjorn-Precision-5520> (raw)
In-Reply-To: <20200504070259.6034-1-kai.heng.feng@canonical.com>

On Mon, May 04, 2020 at 03:02:59PM +0800, Kai-Heng Feng wrote:
> The TI PCIe-to-PCI bridge prevents the Intel SoC from entering power
> state deeper than PC3, consumes lots of unnecessary power.
> 
> On Windows ASPM L1 is enabled on the device and its upstream bridge,
> so it can make the Intel SoC reach PC8 or PC10 to save lots of power.

Does this work around some kind of hardware or firmware defect?  If
ASPM on this device works correctly, the generic code in aspm.c should
enable L1 automatically as it does for all other devices.

I don't think we should add quirks to set the ASPM configuration
directly for random devices.

> So enable ASPM L1 like Windows does, to save additional power.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207571
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/pci/quirks.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index ca9ed5774eb1..ac7eccf34f87 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -2330,6 +2330,27 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
>  
> +static void quirk_enable_aspm_l1(struct pci_dev *dev)
> +{
> +	struct pci_dev *bridge = pci_upstream_bridge(dev);
> +	u16 lnkctl;
> +
> +	pci_info(dev, "Enabling L1\n");
> +	pcie_capability_read_word(dev, PCI_EXP_LNKCTL, &lnkctl);
> +	if (!(lnkctl & PCI_EXP_LNKCTL_ASPM_L1))
> +		pcie_capability_write_word(dev, PCI_EXP_LNKCTL,
> +					   lnkctl | PCI_EXP_LNKCTL_ASPM_L1);
> +
> +	if (!bridge)
> +		return;
> +
> +	pcie_capability_read_word(bridge, PCI_EXP_LNKCTL, &lnkctl);
> +	if (!(lnkctl & PCI_EXP_LNKCTL_ASPM_L1))
> +		pcie_capability_write_word(bridge, PCI_EXP_LNKCTL,
> +					   lnkctl | PCI_EXP_LNKCTL_ASPM_L1);
> +}
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, 0x8240, quirk_enable_aspm_l1);
> +
>  /*
>   * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
>   * Link bit cleared after starting the link retrain process to allow this
> -- 
> 2.17.1
> 

  reply	other threads:[~2020-05-04 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04  7:02 [PATCH] PCI: Enable ASPM L1 on TI PCIe-to-PCI bridge Kai-Heng Feng
2020-05-04 14:15 ` Bjorn Helgaas [this message]
2020-05-05 12:27 ` [PATCH v2] PCI/ASPM: Enable ASPM for root complex <-> bridge <-> bridge case Kai-Heng Feng
2020-05-05 13:38   ` Bjorn Helgaas
2020-05-05 14:00     ` Kai-Heng Feng
2020-05-05 15:45       ` Bjorn Helgaas
2020-05-05 17:34   ` [PATCH v3] PCI/ASPM: Enable ASPM for bridge-to-bridge link Kai-Heng Feng
2020-05-06  6:14     ` Mika Westerberg
2020-05-06 21:29       ` Bjorn Helgaas
2020-05-07 11:50         ` Mika Westerberg
2020-05-07 22:19     ` Bjorn Helgaas

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=20200504141521.GA265122@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.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 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.