From: "David E. Box" <david.e.box@linux.intel.com>
To: rafael@kernel.org, bhelgaas@google.com,
vicamo.yang@canonical.com, kenny@panix.com,
nirmal.patel@linux.intel.com
Cc: "David E. Box" <david.e.box@linux.intel.com>,
linux-pm@vger.kernel.org, linux-pci@vger.kernel.org,
ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: [RFC 1/2] PCI/ASPM: Allow drivers to provide ASPM link state via pci_bus
Date: Wed, 16 Jul 2025 17:40:25 -0700 [thread overview]
Message-ID: <20250717004034.2998443-2-david.e.box@linux.intel.com> (raw)
In-Reply-To: <20250717004034.2998443-1-david.e.box@linux.intel.com>
Synthetic PCIe hierarchies such as those created by Intel VMD are not
enumerated or configured by firmware, and therefore do not receive
BIOS-provided ASPM defaults. This leaves devices behind such domains with
ASPM effectively disabled, despite platform intent.
Introduce a mechanism to allow the bus owner (e.g. a controller driver) to
supply a default ASPM policy via a new aspm_bus_link_state field in
pci_bus. A new bus flag, PCI_BUS_FLAGS_ASPM_DEFAULT_OVERRIDE, indicates
that the core should use this value instead of the BIOS default when
initializing link state.
This avoids the need for controller-specific logic in ASPM core and allows
for proper power savings in these otherwise unsupported hierarchies.
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
drivers/pci/pcie/aspm.c | 5 ++++-
include/linux/pci.h | 12 ++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 29fcb0689a91..2ad1852ac9b2 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -866,7 +866,10 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
}
/* Save default state */
- link->aspm_default = link->aspm_enabled;
+ if (parent->bus->bus_flags & PCI_BUS_FLAGS_NO_ASPM_DEFAULT)
+ link->aspm_default = parent->bus->aspm_bus_link_state;
+ else
+ link->aspm_default = link->aspm_enabled;
/* Setup initial capable state. Will be updated later */
link->aspm_capable = link->aspm_support;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 05e68f35f392..7e1c305c419c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -256,10 +256,11 @@ enum pci_irq_reroute_variant {
typedef unsigned short __bitwise pci_bus_flags_t;
enum pci_bus_flags {
- PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
- PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
- PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4,
- PCI_BUS_FLAGS_NO_EXTCFG = (__force pci_bus_flags_t) 8,
+ PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
+ PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
+ PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4,
+ PCI_BUS_FLAGS_NO_EXTCFG = (__force pci_bus_flags_t) 8,
+ PCI_BUS_FLAGS_NO_ASPM_DEFAULT = (__force pci_bus_flags_t) 16,
};
/* Values from Link Status register, PCIe r3.1, sec 7.8.8 */
@@ -665,6 +666,9 @@ struct pci_bus {
void *sysdata; /* Hook for sys-specific extension */
struct proc_dir_entry *procdir; /* Directory entry in /proc/bus/pci */
+#ifdef CONFIG_PCIEASPM
+ unsigned int aspm_bus_link_state; /* Bus owner provided link state */
+#endif
unsigned char number; /* Bus number */
unsigned char primary; /* Number of primary bridge */
unsigned char max_bus_speed; /* enum pci_bus_speed */
--
2.43.0
next prev parent reply other threads:[~2025-07-17 0:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 0:40 [RFC 0/2] PCI/ASPM: Allow controller-defined default link state David E. Box
2025-07-17 0:40 ` David E. Box [this message]
2025-07-17 10:00 ` [RFC 1/2] PCI/ASPM: Allow drivers to provide ASPM link state via pci_bus Rafael J. Wysocki
2025-07-17 0:40 ` [RFC 2/2] PCI: vmd: Provide default ASPM link state for synthetic hierarchy David E. Box
2025-07-17 6:12 ` [RFC 0/2] PCI/ASPM: Allow controller-defined default link state Kenneth R. Crudup
2025-07-17 6:57 ` Manivannan Sadhasivam
2025-07-17 14:03 ` David Box
2025-07-17 6:55 ` Manivannan Sadhasivam
2025-07-17 10:03 ` Rafael J. Wysocki
2025-07-17 14:13 ` David Box
2025-07-17 15:37 ` Rafael J. Wysocki
2025-07-17 17:49 ` David 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=20250717004034.2998443-2-david.e.box@linux.intel.com \
--to=david.e.box@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kenny@panix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nirmal.patel@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=vicamo.yang@canonical.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;
as well as URLs for NNTP newsgroup(s).