diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-04-01 17:47:39 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-04-02 20:02:40 -0400 |
commit | b8178f130e25c1bdac1c33e0996f1ff6e20ec08e (patch) | |
tree | dab9efc9bff1a32cee96024078c83acee1526a9a | |
parent | be7f088bd01a32e683d5645c8b7f87ca6dfd90b5 (diff) |
Revert "PCI/ACPI: Request _OSC control before scanning PCI root bus"
This reverts commit 8c33f51df406e1a1f7fa4e9b244845b7ebd61fa6.
Conflicts:
drivers/acpi/pci_root.c
This commit broke some pre-1.1 PCIe devices by leaving them with
ASPM enabled. Previously, we had disabled ASPM on these devices
because many of them don't implement it correctly (per 149e1637).
Requesting _OSC control early means that aspm_disabled may be set
before we scan the PCI bus and configure link ASPM state. But the
ASPM configuration currently skips the check for pre-PCIe 1.1 devices
when aspm_disabled is set, like this:
acpi_pci_root_add
acpi_pci_osc_support
if (flags != base_flags)
pcie_no_aspm
aspm_disabled = 1
pci_acpi_scan_root
...
pcie_aspm_init_link_state
pcie_aspm_sanity_check
if (!aspm_disabled)
/* check for pre-PCIe 1.1 device */
Therefore, setting aspm_disabled early means that we leave ASPM enabled
on these pre-PCIe 1.1 devices, which is a regression for some devices.
The best fix would be to clean up the ASPM init so we can evaluate
_OSC before scanning the bug (that way boot-time and hot-add discovery
will work the same), but that requires significant rework.
For now, we'll just revert the _OSC change as the lowest-risk fix.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=55211
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
CC: stable@vger.kernel.org # v3.8+
-rw-r--r-- | drivers/acpi/pci_root.c | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0ac546d5e53f..c740364d4abe 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
415 | struct acpi_pci_root *root; | 415 | struct acpi_pci_root *root; |
416 | struct acpi_pci_driver *driver; | 416 | struct acpi_pci_driver *driver; |
417 | u32 flags, base_flags; | 417 | u32 flags, base_flags; |
418 | bool is_osc_granted = false; | ||
419 | 418 | ||
420 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 419 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
421 | if (!root) | 420 | if (!root) |
@@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
476 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | 475 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; |
477 | acpi_pci_osc_support(root, flags); | 476 | acpi_pci_osc_support(root, flags); |
478 | 477 | ||
478 | /* | ||
479 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
480 | */ | ||
481 | |||
482 | mutex_lock(&acpi_pci_root_lock); | ||
483 | list_add_tail(&root->node, &acpi_pci_roots); | ||
484 | mutex_unlock(&acpi_pci_root_lock); | ||
485 | |||
486 | /* | ||
487 | * Scan the Root Bridge | ||
488 | * -------------------- | ||
489 | * Must do this prior to any attempt to bind the root device, as the | ||
490 | * PCI namespace does not get created until this call is made (and | ||
491 | * thus the root bridge's pci_dev does not exist). | ||
492 | */ | ||
493 | root->bus = pci_acpi_scan_root(root); | ||
494 | if (!root->bus) { | ||
495 | printk(KERN_ERR PREFIX | ||
496 | "Bus %04x:%02x not present in PCI namespace\n", | ||
497 | root->segment, (unsigned int)root->secondary.start); | ||
498 | result = -ENODEV; | ||
499 | goto out_del_root; | ||
500 | } | ||
501 | |||
479 | /* Indicate support for various _OSC capabilities. */ | 502 | /* Indicate support for various _OSC capabilities. */ |
480 | if (pci_ext_cfg_avail()) | 503 | if (pci_ext_cfg_avail()) |
481 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | 504 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; |
@@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
494 | flags = base_flags; | 517 | flags = base_flags; |
495 | } | 518 | } |
496 | } | 519 | } |
520 | |||
497 | if (!pcie_ports_disabled | 521 | if (!pcie_ports_disabled |
498 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | 522 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { |
499 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | 523 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
@@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
514 | status = acpi_pci_osc_control_set(device->handle, &flags, | 538 | status = acpi_pci_osc_control_set(device->handle, &flags, |
515 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 539 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); |
516 | if (ACPI_SUCCESS(status)) { | 540 | if (ACPI_SUCCESS(status)) { |
517 | is_osc_granted = true; | ||
518 | dev_info(&device->dev, | 541 | dev_info(&device->dev, |
519 | "ACPI _OSC control (0x%02x) granted\n", flags); | 542 | "ACPI _OSC control (0x%02x) granted\n", flags); |
543 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
544 | /* | ||
545 | * We have ASPM control, but the FADT indicates | ||
546 | * that it's unsupported. Clear it. | ||
547 | */ | ||
548 | pcie_clear_aspm(root->bus); | ||
549 | } | ||
520 | } else { | 550 | } else { |
521 | is_osc_granted = false; | ||
522 | dev_info(&device->dev, | 551 | dev_info(&device->dev, |
523 | "ACPI _OSC request failed (%s), " | 552 | "ACPI _OSC request failed (%s), " |
524 | "returned control mask: 0x%02x\n", | 553 | "returned control mask: 0x%02x\n", |
525 | acpi_format_exception(status), flags); | 554 | acpi_format_exception(status), flags); |
555 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
556 | "disabling ASPM\n"); | ||
557 | pcie_no_aspm(); | ||
526 | } | 558 | } |
527 | } else { | 559 | } else { |
528 | dev_info(&device->dev, | 560 | dev_info(&device->dev, |
529 | "Unable to request _OSC control " | 561 | "Unable to request _OSC control " |
530 | "(_OSC support mask: 0x%02x)\n", flags); | 562 | "(_OSC support mask: 0x%02x)\n", flags); |
531 | } | ||
532 | |||
533 | /* | ||
534 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
535 | */ | ||
536 | |||
537 | mutex_lock(&acpi_pci_root_lock); | ||
538 | list_add_tail(&root->node, &acpi_pci_roots); | ||
539 | mutex_unlock(&acpi_pci_root_lock); | ||
540 | |||
541 | /* | ||
542 | * Scan the Root Bridge | ||
543 | * -------------------- | ||
544 | * Must do this prior to any attempt to bind the root device, as the | ||
545 | * PCI namespace does not get created until this call is made (and | ||
546 | * thus the root bridge's pci_dev does not exist). | ||
547 | */ | ||
548 | root->bus = pci_acpi_scan_root(root); | ||
549 | if (!root->bus) { | ||
550 | printk(KERN_ERR PREFIX | ||
551 | "Bus %04x:%02x not present in PCI namespace\n", | ||
552 | root->segment, (unsigned int)root->secondary.start); | ||
553 | result = -ENODEV; | ||
554 | goto out_del_root; | ||
555 | } | ||
556 | |||
557 | /* ASPM setting */ | ||
558 | if (is_osc_granted) { | ||
559 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | ||
560 | pcie_clear_aspm(root->bus); | ||
561 | } else { | ||
562 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
563 | "disabling ASPM\n"); | ||
564 | pcie_no_aspm(); | ||
565 | } | 563 | } |
566 | 564 | ||
567 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 565 | pci_acpi_add_bus_pm_notifier(device, root->bus); |