public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: ASPM: Allow OS to configure ASPM where BIOS is incapable of
@ 2024-05-30  8:52 Kai-Heng Feng
  2024-05-30  8:52 ` [PATCH 2/2] PCI: vmd: Let OS control ASPM for devices under VMD domain Kai-Heng Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kai-Heng Feng @ 2024-05-30  8:52 UTC (permalink / raw)
  To: bhelgaas
  Cc: linux-pci, linux-kernel, nirmal.patel, jonathan.derrick,
	ilpo.jarvinen, david.e.box, Kai-Heng Feng

Since commit f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM
and LTR"), ASPM is configured for NVMe devices enabled in VMD domain.

However, that doesn't cover the case when FADT has ACPI_FADT_NO_ASPM
set.

So add a new attribute to bypass aspm_disabled so OS can configure ASPM.

Fixes: f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR")
Link: https://lore.kernel.org/linux-pm/218aa81f-9c6-5929-578d-8dc15f83dd48@panix.com/
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/pci/pcie/aspm.c | 8 ++++++--
 include/linux/pci.h     | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index cee2365e54b8..e719605857b1 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1416,8 +1416,12 @@ static int __pci_enable_link_state(struct pci_dev *pdev, int state, bool locked)
 	 * the _OSC method), we can't honor that request.
 	 */
 	if (aspm_disabled) {
-		pci_warn(pdev, "can't override BIOS ASPM; OS doesn't have ASPM control\n");
-		return -EPERM;
+		if (aspm_support_enabled && pdev->aspm_os_control)
+			pci_info(pdev, "BIOS can't program ASPM, let OS control it\n");
+		else {
+			pci_warn(pdev, "can't override BIOS ASPM; OS doesn't have ASPM control\n");
+			return -EPERM;
+		}
 	}
 
 	if (!locked)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb004fd4e889..58cbd4bea320 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -467,6 +467,7 @@ struct pci_dev {
 	unsigned int	no_command_memory:1;	/* No PCI_COMMAND_MEMORY */
 	unsigned int	rom_bar_overlap:1;	/* ROM BAR disable broken */
 	unsigned int	rom_attr_enabled:1;	/* Display of ROM attribute enabled? */
+	unsigned int	aspm_os_control:1;	/* Display of ROM attribute enabled? */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-08-19  5:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-30  8:52 [PATCH 1/2] PCI: ASPM: Allow OS to configure ASPM where BIOS is incapable of Kai-Heng Feng
2024-05-30  8:52 ` [PATCH 2/2] PCI: vmd: Let OS control ASPM for devices under VMD domain Kai-Heng Feng
2024-08-02  0:04   ` Bjorn Helgaas
2024-08-02  1:04     ` Kai-Heng Feng
2024-08-16  6:17       ` Kai-Heng Feng
2024-07-26  7:22 ` [PATCH 1/2] PCI: ASPM: Allow OS to configure ASPM where BIOS is incapable of Hui Wang
2024-08-16 22:28 ` Bjorn Helgaas
2024-08-19  5:31   ` Kai-Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox