rpms/kernel/F-9 linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch, NONE, 1.1 linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch, NONE, 1.1 linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch, NONE, 1.1 kernel.spec, 1.771, 1.772

Chuck Ebbert cebbert at fedoraproject.org
Sat Sep 20 07:05:14 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30993

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch 
	linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch 
	linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch 
Log Message:
pci: three patches to disable PCIe ASPM on old devices/systems (#462210)

linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch:

--- NEW FILE linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch ---
From: Shaohua Li <shaohua.li at intel.com>
Date: Wed, 23 Jul 2008 02:32:42 +0000 (+0800)
Subject: PCI: add an option to allow ASPM enabled forcibly
X-Git-Tag: v2.6.27-rc1~3^2~4
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=d6d385743463f38a0da899cd4607e526ad9a049f

PCI: add an option to allow ASPM enabled forcibly

A new option, pcie_aspm=force, will force ASPM to be enabled, even on system
with PCIe 1.0 devices.

Signed-off-by: Shaohua Li <shaohua.li at intel.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 7046052..9a7c9e1 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -55,7 +55,7 @@ struct pcie_link_state {
 	struct endpoint_state endpoints[8];
 };
 
-static int aspm_disabled;
+static int aspm_disabled, aspm_force;
 static DEFINE_MUTEX(aspm_lock);
 static LIST_HEAD(link_list);
 
@@ -527,9 +527,10 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 		 */
 		pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
 			&reg32);
-		if (!(reg32 & PCI_EXP_DEVCAP_RBER)) {
+		if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) {
 			printk("Pre-1.1 PCIe device detected, "
-				"disable ASPM for %s\n", pci_name(pdev));
+				"disable ASPM for %s. It can be enabled forcedly"
+				" with 'pcie_aspm=force'\n", pci_name(pdev));
 			return -EINVAL;
 		}
 	}
@@ -815,15 +816,22 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
 
 static int __init pcie_aspm_disable(char *str)
 {
-	aspm_disabled = 1;
+	if (!strcmp(str, "off")) {
+		aspm_disabled = 1;
+		printk(KERN_INFO "PCIe ASPM is disabled\n");
+	} else if (!strcmp(str, "force")) {
+		aspm_force = 1;
+		printk(KERN_INFO "PCIe ASPM is forcedly enabled\n");
+	}
 	return 1;
 }
 
-__setup("pcie_noaspm", pcie_aspm_disable);
+__setup("pcie_aspm=", pcie_aspm_disable);
 
 void pcie_no_aspm(void)
 {
-	aspm_disabled = 1;
+	if (!aspm_force)
+		aspm_disabled = 1;
 }
 
 #ifdef CONFIG_ACPI

linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch:

--- NEW FILE linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch ---
From: Shaohua Li <shaohua.li at intel.com>
Date: Wed, 23 Jul 2008 02:32:31 +0000 (+0800)
Subject: PCI: disable ASPM on pre-1.1 PCIe devices
X-Git-Tag: v2.6.27-rc1~3^2~5
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=149e16372a2066c5474d8a8db9b252afd57eb427

PCI: disable ASPM on pre-1.1 PCIe devices

Disable ASPM on pre-1.1 PCIe devices, as many of them don't implement it
correctly.

Tested-by: Jack Howarth <howarth at bromo.msbb.uc.edu>
Signed-off-by: Shaohua Li <shaohua.li at intel.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 759c51a..7046052 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -510,6 +510,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 {
 	struct pci_dev *child_dev;
 	int child_pos;
+	u32 reg32;
 
 	/*
 	 * Some functions in a slot might not all be PCIE functions, very
@@ -519,6 +520,18 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 		child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
 		if (!child_pos)
 			return -EINVAL;
+
+		/*
+		 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
+		 * RBER bit to determine if a function is 1.1 version device
+		 */
+		pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
+			&reg32);
+		if (!(reg32 & PCI_EXP_DEVCAP_RBER)) {
+			printk("Pre-1.1 PCIe device detected, "
+				"disable ASPM for %s\n", pci_name(pdev));
+			return -EINVAL;
+		}
 	}
 	return 0;
 }
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2036300..7098dfb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1057,7 +1057,8 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
 		}
 	}
 
-	if (bus->self)
+	/* only one slot has pcie device */
+	if (bus->self && nr)
 		pcie_aspm_init_link_state(bus->self);
 
 	return nr;
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 19958b9..450684f 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -374,6 +374,7 @@
 #define  PCI_EXP_DEVCAP_ATN_BUT	0x1000	/* Attention Button Present */
 #define  PCI_EXP_DEVCAP_ATN_IND	0x2000	/* Attention Indicator Present */
 #define  PCI_EXP_DEVCAP_PWR_IND	0x4000	/* Power Indicator Present */
+#define  PCI_EXP_DEVCAP_RBER	0x8000	/* Role-Based Error Reporting */
 #define  PCI_EXP_DEVCAP_PWR_VAL	0x3fc0000 /* Slot Power Limit Value */
 #define  PCI_EXP_DEVCAP_PWR_SCL	0xc000000 /* Slot Power Limit Scale */
 #define PCI_EXP_DEVCTL		8	/* Device Control */

linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch:

--- NEW FILE linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch ---
From: Shaohua Li <shaohua.li at intel.com>
Date: Wed, 23 Jul 2008 02:32:24 +0000 (+0800)
Subject: PCI: disable ASPM per ACPI FADT setting
X-Git-Tag: v2.6.27-rc1~3^2~6
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5fde244d39b88625ac578d83e6625138714de031

PCI: disable ASPM per ACPI FADT setting

The ACPI FADT table includes an ASPM control bit. If the bit is set, do
not enable ASPM since it may indicate that the platform doesn't actually
support the feature.

Tested-by: Jack Howarth <howarth at bromo.msbb.uc.edu>
Signed-off-by: Shaohua Li <shaohua.li at intel.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 7764768..89a2f0f 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/module.h>
+#include <linux/pci-aspm.h>
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acresrc.h>
@@ -372,6 +373,12 @@ static int __init acpi_pci_init(void)
 		printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n");
 		pci_no_msi();
 	}
+
+	if (acpi_gbl_FADT.boot_flags & BAF_PCIE_ASPM_CONTROL) {
+		printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n");
+		pcie_no_aspm();
+	}
+
 	ret = register_acpi_bus_type(&acpi_pci_bus);
 	if (ret)
 		return 0;
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index f824955..759c51a 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -808,6 +808,11 @@ static int __init pcie_aspm_disable(char *str)
 
 __setup("pcie_noaspm", pcie_aspm_disable);
 
+void pcie_no_aspm(void)
+{
+	aspm_disabled = 1;
+}
+
 #ifdef CONFIG_ACPI
 #include <acpi/acpi_bus.h>
 #include <linux/pci-acpi.h>
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 1ebbe88..13a3d9a 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -277,6 +277,7 @@ enum acpi_prefered_pm_profiles {
 #define BAF_LEGACY_DEVICES              0x0001
 #define BAF_8042_KEYBOARD_CONTROLLER    0x0002
 #define BAF_MSI_NOT_SUPPORTED           0x0008
+#define BAF_PCIE_ASPM_CONTROL           0x0010
 
 #define FADT2_REVISION_ID               3
 #define FADT2_MINUS_REVISION_ID         2
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index a1a1e61..91ba0b3 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
 extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
 extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
 extern void pci_disable_link_state(struct pci_dev *pdev, int state);
+extern void pcie_no_aspm(void);
 #else
 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
 {
@@ -40,6 +41,10 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
 static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
 {
 }
+
+static inline void pcie_no_aspm(void)
+{
+}
 #endif
 
 #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.771
retrieving revision 1.772
diff -u -r1.771 -r1.772
--- kernel.spec	19 Sep 2008 22:03:41 -0000	1.771
+++ kernel.spec	20 Sep 2008 07:04:43 -0000	1.772
@@ -595,6 +595,10 @@
 Patch98: linux-2.6-x86-fix-memmap-exactmap-boot-argument.patch
 Patch100: linux-2.6-x86-pci-detect-end_bus_number.patch
 
+Patch120: linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch
+Patch121: linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch
+Patch122: linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch
+
 # ppc
 Patch140: linux-2.6-ps3-ehci-iso.patch
 Patch141: linux-2.6-ps3-storage-alias.patch
@@ -1072,6 +1076,11 @@
 # fix e820 reservation checking
 ApplyPatch linux-2.6-x86-pci-detect-end_bus_number.patch
 
+# disable ASPM on devices that don't support it
+ApplyPatch linux-2.6-pci-disable-aspm-per-acpi-fadt-setting.patch
+ApplyPatch linux-2.6-pci-disable-aspm-on-pre-1.1-devices.patch
+ApplyPatch linux-2.6-pci-add-an-option-to-allow-aspm-enabled-forcibly.patch
+
 #
 # PowerPC
 #
@@ -1873,6 +1882,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Fri Sep 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-45
+- pci: three patches to disable PCIe ASPM on old devices/systems (#462210)
+
 * Fri Sep 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-44
 - x86: pci: detect end_bus_number according to acpi/e820 reserved, v2 (#462210)
 




More information about the fedora-extras-commits mailing list