Skip to contentSkip to conversation

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

PATCH Applied Matthew Garrett 4 participants 5 messages Jun 22, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/acpi/pci_root.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/acpi/pci_root.c +9 -0
index 1af8081..7167213 100644
@@ -32,6 +32,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>
@@ -576,6 +577,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();
+	}
+
 	return 0;
 
 end:
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Matthew Garrett

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.

Quoted 1 line
Quoted 32 lines
---
 drivers/acpi/pci_root.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/acpi/pci_root.c +9 -0
index 1af8081..7167213 100644
@@ -32,6 +32,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>
@@ -576,6 +577,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();
+	}
+
 	return 0;
 
 end:
Applied
#2 lore raw
Quoted 19 lines · On Tue, 22 Jun 2010 20:17:29 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 18 lines · Matthew Garrett

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.

Quoted 3 lines
Quoted 1 line

Applied to my linux-next branch, thanks.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#3 lore raw
Quoted 22 lines · Jesse Barnes
Quoted 19 lines · On Tue, 22 Jun 2010 20:17:29 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 18 lines · Matthew Garrett

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.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied to my linux-next branch, thanks.

I think it's 2.6.35 (and probably -stable) material, these problems aleady happen in the field.

Matthew, what do you think?

Rafael

#4 lore raw
Quoted 4 lines · Rafael J. Wysocki

I think it's 2.6.35 (and probably -stable) material, these problems aleady happen in the field.

Matthew, what do you think?

I'd lean that way, but it's not a regression and it'll probably only trigger if the policy is changed to "powersave" rather than "default".

Signature · 1 line
Matthew Garrett | [email protected]