public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Crudup <kenny@panix.com>
To: david.e.box@linux.intel.com, rafael@kernel.org,
	Bjorn Helgaas <helgaas@kernel.org>,
	Nirmal Patel <nirmal.patel@linux.ntel.com>,
	Kenneth Crudup <kenny@panix.com>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Vidya Sagar <vidyas@nvidia.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Andrea Righi <andrea.righi@canonical.com>,
	You-Sheng Yang <vicamo.yang@canonical.com>,
	linux-pm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: My AlderLake Dell (XPS-9320) needs these patches to get full standby/low-power modes
Date: Thu, 19 Dec 2024 12:37:56 -0800	[thread overview]
Message-ID: <7ad6b642-b31e-438c-97fb-840542740499@panix.com> (raw)
In-Reply-To: <2ed90445e8e39a76e58a37712ca75ba40d121c15.camel@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]


Or, just use (some version of) the attached patch (against Linus' recent 
master) that enables VMD ASPM this for us "automatically" if there's a 
detected VMD ?

I'd prefer a scalpel to a bludgeon (and have been trying to get some 
version of these fixes into mainline for a while).

-Kenny

On 12/19/24 11:52, David E. Box wrote:

> If you want to override this behavior, you can try setting pcie_aspm=force on
> the kernel command line.

-- 
Kenneth R. Crudup / Sr. SW Engineer, Scott County Consulting, Orange 
County CA

[-- Attachment #2: aspm-enable-take-2 --]
[-- Type: text/plain, Size: 1557 bytes --]

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 28567d457613..a5df6230cf3c 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -768,6 +768,31 @@ static void aspm_l1ss_init(struct pcie_link_state *link)
 		aspm_calc_l12_info(link, parent_l1ss_cap, child_l1ss_cap);
 }
 
+/*
+ * BIOS may not be able to access config space of devices under VMD domain, so
+ * it relies on software to enable ASPM for links under VMD.
+ */
+static bool pci_fixup_vmd_bridge_enable_aspm(struct pci_dev *pdev)
+{
+       struct pci_bus *bus = pdev->bus;
+       struct device *dev;
+       struct pci_driver *pdrv;
+
+       if (!pci_is_root_bus(bus))
+               return false;
+
+       dev = bus->bridge->parent;
+       if (dev == NULL)
+               return false;
+
+       pdrv = pci_dev_driver(to_pci_dev(dev));
+       if (pdrv == NULL || strcmp("vmd", pdrv->name))
+               return false;
+
+       pci_info(pdev, "enable ASPM for pci bridge behind vmd");
+       return true;
+}
+
 static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 {
 	struct pci_dev *child = link->downstream, *parent = link->pdev;
@@ -846,7 +871,8 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 	}
 
 	/* Save default state */
-	link->aspm_default = link->aspm_enabled;
+	link->aspm_default = pci_fixup_vmd_bridge_enable_aspm(parent) ?
+		PCIE_LINK_STATE_ASPM_ALL : link->aspm_enabled;
 
 	/* Setup initial capable state. Will be updated later */
 	link->aspm_capable = link->aspm_support;

  reply	other threads:[~2024-12-19 20:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <402b2e32-3b54-4e80-92fd-9237549ffa14@panix.com>
2024-12-13 16:43 ` My AlderLake Dell (XPS-9320) needs these patches to get full standby/low-power modes Bjorn Helgaas
2024-12-13 19:48   ` Kenneth Crudup
2024-12-13 20:27     ` Kenneth Crudup
2024-12-13 22:26       ` Kenneth Crudup
2024-12-13 22:33         ` Kenneth Crudup
2024-12-13 23:02         ` Bjorn Helgaas
2024-12-19 16:25           ` David E. Box
2024-12-19 18:17             ` Kenneth Crudup
2024-12-19 19:52               ` David E. Box
2024-12-19 20:37                 ` Kenneth Crudup [this message]
     [not found] <218aa81f-9c6-5929-578d-8dc15f83dd48@panix.com>
2023-11-06 18:11 ` Bjorn Helgaas
2023-11-07 11:15   ` Mika Westerberg
2023-11-16 20:10     ` David E. Box
2023-11-16 23:18       ` Bjorn Helgaas
2023-11-16 23:27         ` Matthew Garrett
2023-11-18  0:21         ` David E. Box
2023-12-21  1:19           ` David E. Box
2023-12-27  0:03             ` Bjorn Helgaas
2024-05-13  5:23               ` Kenneth R. Crudup
2023-11-08 15:44   ` Kenneth R. Crudup

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=7ad6b642-b31e-438c-97fb-840542740499@panix.com \
    --to=kenny@panix.com \
    --cc=andrea.righi@canonical.com \
    --cc=bhelgaas@google.com \
    --cc=david.e.box@linux.intel.com \
    --cc=helgaas@kernel.org \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nirmal.patel@linux.ntel.com \
    --cc=rafael@kernel.org \
    --cc=vicamo.yang@canonical.com \
    --cc=vidyas@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox