rpms/kernel/F-12 pci-acpi-disable-aspm-if-no-osc.patch, NONE, 1.1 pci-aspm-dont-enable-too-early.patch, NONE, 1.1 kernel.spec, 1.2107, 1.2108

Chuck Ebbert cebbert at fedoraproject.org
Thu Jul 22 02:33:51 UTC 2010


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-12
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv30566

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(+)

--- NEW FILE pci-acpi-disable-aspm-if-no-osc.patch ---
From: Matthew Garrett <mjg at redhat.com>
Subject: ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe

ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe

[ backport to 2.6.32 ]

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.

Signed-off-by: Matthew Garrett <mjg at redhat.com>
---

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.h>
 #include <linux/pci.h>
 #include <linux/pci-acpi.h>
+#include <linux/pci-aspm.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.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,
+					  0);
+
+	if (status == AE_NOT_EXIST) {
+		printk(KERN_INFO "Unable to assume PCIe control: Disabling ASPM\n");
+		pcie_no_aspm();
+	}
+
 	return 0;
 
 end:
pci-aspm-dont-enable-too-early.patch:
 aspm.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

--- NEW FILE pci-aspm-dont-enable-too-early.patch ---
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/F-12/kernel.spec,v
retrieving revision 1.2107
retrieving revision 1.2108
diff -u -p -r1.2107 -r1.2108
--- kernel.spec	21 Jul 2010 12:19:01 -0000	1.2107
+++ kernel.spec	22 Jul 2010 02:33:50 -0000	1.2108
@@ -667,6 +667,9 @@ Patch380: linux-2.6-defaults-pci_no_msi.
 Patch381: linux-2.6-pciehp-update.patch
 Patch382: linux-2.6-defaults-pciehp.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
 Patch450: linux-2.6-input-kill-stupid-messages.patch
@@ -1357,6 +1360,10 @@ ApplyPatch linux-2.6-defaults-pci_no_msi
 #ApplyPatch linux-2.6-defaults-pciehp.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.
@@ -2194,6 +2201,10 @@ fi
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-146
+- 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 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-145
 - crypto-add-async-hash-testing.patch: fix the rest of the errors
   reported during crypto testing (#571577)



More information about the scm-commits mailing list