rpms/kernel/devel pci-acpi-disable-aspm-if-no-osc.patch, 1.1, 1.2 pci-aspm-dont-enable-too-early.patch, 1.1, 1.2 kernel.spec, 1.2064, 1.2065

Chuck Ebbert cebbert at fedoraproject.org
Wed Jul 7 09:58:38 UTC 2010


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv11601

Modified Files:
	kernel.spec 
Added Files:
	pci-acpi-disable-aspm-if-no-osc.patch 
	pci-aspm-dont-enable-too-early.patch 
Log Message:
pci-acpi-disable-aspm-if-no-osc.patch, pci-aspm-dont-enable-too-early.patch
  PCI layer fixes for problems with hardware that doesn't support ASPM.

pci-acpi-disable-aspm-if-no-osc.patch:
 pci_root.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: pci-acpi-disable-aspm-if-no-osc.patch
===================================================================
RCS file: pci-acpi-disable-aspm-if-no-osc.patch
diff -N pci-acpi-disable-aspm-if-no-osc.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pci-acpi-disable-aspm-if-no-osc.patch	7 Jul 2010 09:58:38 -0000	1.2
@@ -0,0 +1,57 @@
+From: Matthew Garrett <mjg at redhat.com>
+Date: Tue, 22 Jun 2010 15:25:43 +0000 (-0400)
+Subject: ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjbarnes%2Fpci-2.6.git;a=commitdiff_plain;h=cca74426129c3d33cc606a41539a827d194ba4be
+
+ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe
+
+The PCI SIG documentation for the _OSC OS/firmware handshaking interface
+states:
+
+"If the _OSC control method is absent from the scope of a host bridge
+device, then the operating system must not enable or attempt to use any
+features defined in this section for the hierarchy originated by the host
+bridge."
+
+The obvious interpretation of this is that the OS should not attempt to use
+PCIe hotplug, PME or AER - however, the specification also notes that an
+_OSC method is *required* for PCIe hierarchies, and experimental validation
+with An Alternative OS indicates that it doesn't use any PCIe functionality
+if the _OSC method is missing. That arguably means we shouldn't be using
+MSI or extended config space, but right now our problems seem to be limited
+to vendors being surprised when ASPM gets enabled on machines when other
+OSs refuse to do so. So, for now, let's just disable ASPM if the _OSC
+method doesn't exist or refuses to hand over PCIe capability control.
+
+Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
+Signed-off-by: Matthew Garrett <mjg at redhat.com>
+Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
+---
+
+diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
+index 4eac593..1f67057 100644
+--- a/drivers/acpi/pci_root.c
++++ b/drivers/acpi/pci_root.c
+@@ -33,6 +33,7 @@
+ #include <linux/pm_runtime.h>
+ #include <linux/pci.h>
+ #include <linux/pci-acpi.h>
++#include <linux/pci-aspm.h>
+ #include <linux/acpi.h>
+ #include <linux/slab.h>
+ #include <acpi/acpi_bus.h>
+@@ -543,6 +544,14 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
+ 	if (flags != base_flags)
+ 		acpi_pci_osc_support(root, flags);
+ 
++	status = acpi_pci_osc_control_set(root->device->handle,
++					  OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
++
++	if (ACPI_FAILURE(status)) {
++		printk(KERN_INFO "Unable to assume PCIe control: Disabling ASPM\n");
++		pcie_no_aspm();
++	}
++
+ 	pci_acpi_add_bus_pm_notifier(device, root->bus);
+ 	if (device->wakeup.flags.run_wake)
+ 		device_set_run_wake(root->bus->bridge, true);

pci-aspm-dont-enable-too-early.patch:
 aspm.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Index: pci-aspm-dont-enable-too-early.patch
===================================================================
RCS file: pci-aspm-dont-enable-too-early.patch
diff -N pci-aspm-dont-enable-too-early.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pci-aspm-dont-enable-too-early.patch	7 Jul 2010 09:58:38 -0000	1.2
@@ -0,0 +1,50 @@
+From: Matthew Garrett <mjg at redhat.com>
+Date: Wed, 9 Jun 2010 20:05:07 +0000 (-0400)
+Subject: PCI: Don't enable aspm before drivers have had a chance to veto it
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjbarnes%2Fpci-2.6.git;a=commitdiff_plain;h=8f0b08c29f1df91315e48adce04462eb23671099
+
+PCI: Don't enable aspm before drivers have had a chance to veto it
+
+The aspm code will currently set the configured aspm policy before drivers
+have had an opportunity to indicate that their hardware doesn't support it.
+Unfortunately, putting some hardware in L0 or L1 can result in the hardware
+no longer responding to any requests, even after aspm is disabled. It makes
+more sense to leave aspm policy at the BIOS defaults at initial setup time,
+reconfiguring it after pci_enable_device() is called. This allows the
+driver to blacklist individual devices beforehand.
+
+Reviewed-by: Kenji Kaneshige <kaneshige.kenji at jp.fujitsu.com>
+Signed-off-by: Matthew Garrett <mjg at redhat.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 be53d98..7122281 100644
+--- a/drivers/pci/pcie/aspm.c
++++ b/drivers/pci/pcie/aspm.c
+@@ -588,11 +588,23 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
+ 	 * update through pcie_aspm_cap_init().
+ 	 */
+ 	pcie_aspm_cap_init(link, blacklist);
+-	pcie_config_aspm_path(link);
+ 
+ 	/* Setup initial Clock PM state */
+ 	pcie_clkpm_cap_init(link, blacklist);
+-	pcie_set_clkpm(link, policy_to_clkpm_state(link));
++
++	/*
++	 * At this stage drivers haven't had an opportunity to change the
++	 * link policy setting. Enabling ASPM on broken hardware can cripple
++	 * it even before the driver has had a chance to disable ASPM, so
++	 * default to a safe level right now. If we're enabling ASPM beyond
++	 * the BIOS's expectation, we'll do so once pci_enable_device() is
++	 * called.
++	 */
++	if (aspm_policy != POLICY_POWERSAVE) {
++		pcie_config_aspm_path(link);
++		pcie_set_clkpm(link, policy_to_clkpm_state(link));
++	}
++
+ unlock:
+ 	mutex_unlock(&aspm_lock);
+ out:


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.2064
retrieving revision 1.2065
diff -u -p -r1.2064 -r1.2065
--- kernel.spec	7 Jul 2010 06:56:33 -0000	1.2064
+++ kernel.spec	7 Jul 2010 09:58:38 -0000	1.2065
@@ -621,6 +621,8 @@ Patch204: linux-2.6-debug-always-inline-
 
 Patch380: linux-2.6-defaults-pci_no_msi.patch
 Patch383: linux-2.6-defaults-aspm.patch
+Patch384: pci-acpi-disable-aspm-if-no-osc.patch
+Patch385: pci-aspm-dont-enable-too-early.patch
 
 Patch390: linux-2.6-defaults-acpi-video.patch
 Patch391: linux-2.6-acpi-video-dos.patch
@@ -1170,6 +1172,10 @@ ApplyPatch linux-2.6-debug-always-inline
 ApplyPatch linux-2.6-defaults-pci_no_msi.patch
 # enable ASPM by default on hardware we expect to work
 ApplyPatch linux-2.6-defaults-aspm.patch
+# disable aspm if acpi doesn't provide an _OSC method
+ApplyPatch pci-acpi-disable-aspm-if-no-osc.patch
+# allow drivers to disable aspm at load time
+ApplyPatch pci-aspm-dont-enable-too-early.patch
 
 #
 # SCSI Bits.
@@ -1877,6 +1883,10 @@ fi
 #                 ||     ||
 
 %changelog
+* Wed Jul 07 2010 Chuck Ebbert <cebbert at redhat.com>
+- pci-acpi-disable-aspm-if-no-osc.patch, pci-aspm-dont-enable-too-early.patch
+  PCI layer fixes for problems with hardware that doesn't support ASPM.
+
 * Wed Jul 07 2010 Ben Skeggs <bskeggs at redhat.com>
 - nouveau: bring in nouveau upstream
 



More information about the scm-commits mailing list