Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

We need to distinguish the situation in which ASPM support is
disabled from the command line or through .config from the situation
in which it is disabled, because the hardware or BIOS can't handle
it. In the former case we should not report ASPM support to the BIOS
through ACPI _OSC, but in the latter case we should do that.

Introduce pcie_aspm_support_enabled() that can be used by
acpi_pci_root_add() to determine whether or not it should report ASPM
support to the BIOS through _OSC.

Cc: stable@kernel.org
References: https://bugzilla.kernel.org/show_bug.cgi?id=29722
References: https://bugzilla.kernel.org/show_bug.cgi?id=20232
Reported-and-tested-by: Ortwin Glück <odi@odi.ch>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by

Rafael J. Wysocki and committed by
Jesse Barnes
8b8bae90 a44f99c7

+11 -5
+1 -1
drivers/acpi/pci_root.c
··· 564 564 /* Indicate support for various _OSC capabilities. */ 565 565 if (pci_ext_cfg_avail(root->bus->self)) 566 566 flags |= OSC_EXT_PCI_CONFIG_SUPPORT; 567 - if (pcie_aspm_enabled()) 567 + if (pcie_aspm_support_enabled()) 568 568 flags |= OSC_ACTIVE_STATE_PWR_SUPPORT | 569 569 OSC_CLOCK_PWR_CAPABILITY_SUPPORT; 570 570 if (pci_msi_enabled())
+7
drivers/pci/pcie/aspm.c
··· 69 69 }; 70 70 71 71 static int aspm_disabled, aspm_force, aspm_clear_state; 72 + static bool aspm_support_enabled = true; 72 73 static DEFINE_MUTEX(aspm_lock); 73 74 static LIST_HEAD(link_list); 74 75 ··· 897 896 { 898 897 if (!strcmp(str, "off")) { 899 898 aspm_disabled = 1; 899 + aspm_support_enabled = false; 900 900 printk(KERN_INFO "PCIe ASPM is disabled\n"); 901 901 } else if (!strcmp(str, "force")) { 902 902 aspm_force = 1; ··· 932 930 } 933 931 EXPORT_SYMBOL(pcie_aspm_enabled); 934 932 933 + bool pcie_aspm_support_enabled(void) 934 + { 935 + return aspm_support_enabled; 936 + } 937 + EXPORT_SYMBOL(pcie_aspm_support_enabled);
+3 -4
include/linux/pci.h
··· 1002 1002 #endif 1003 1003 1004 1004 #ifndef CONFIG_PCIEASPM 1005 - static inline int pcie_aspm_enabled(void) 1006 - { 1007 - return 0; 1008 - } 1005 + static inline int pcie_aspm_enabled(void) { return 0; } 1006 + static inline bool pcie_aspm_support_enabled(void) { return false; } 1009 1007 #else 1010 1008 extern int pcie_aspm_enabled(void); 1009 + extern bool pcie_aspm_support_enabled(void); 1011 1010 #endif 1012 1011 1013 1012 #ifdef CONFIG_PCIEAER