Skip to content

Commit b1801bf

Browse files
committed
Merge branch 'pci/aspm'
- Fix ASPM link_state teardown on removal (Lukas Wunner) - Fix misleading _OSC ASPM message (Sinan Kaya) - Make _OSC optional for PCI (Sinan Kaya) - Don't initialize ASPM link state when ACPI_FADT_NO_ASPM is set (Patrick Talbert) * pci/aspm: PCI/ASPM: Do not initialize link state when aspm_disabled is set PCI/ACPI: Allow _OSC presence to be optional for PCI PCI/ACPI: Correct error message for ASPM disabling PCI/ASPM: Fix link_state teardown on device removal
2 parents 7876320 + 17c9148 commit b1801bf

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

drivers/acpi/pci_root.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
421421
}
422422
EXPORT_SYMBOL(acpi_pci_osc_control_set);
423423

424-
static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
424+
static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
425+
bool is_pcie)
425426
{
426427
u32 support, control, requested;
427428
acpi_status status;
@@ -455,9 +456,15 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
455456
decode_osc_support(root, "OS supports", support);
456457
status = acpi_pci_osc_support(root, support);
457458
if (ACPI_FAILURE(status)) {
458-
dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
459-
acpi_format_exception(status));
460459
*no_aspm = 1;
460+
461+
/* _OSC is optional for PCI host bridges */
462+
if ((status == AE_NOT_FOUND) && !is_pcie)
463+
return;
464+
465+
dev_info(&device->dev, "_OSC failed (%s)%s\n",
466+
acpi_format_exception(status),
467+
pcie_aspm_support_enabled() ? "; disabling ASPM" : "");
461468
return;
462469
}
463470

@@ -533,6 +540,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
533540
acpi_handle handle = device->handle;
534541
int no_aspm = 0;
535542
bool hotadd = system_state == SYSTEM_RUNNING;
543+
bool is_pcie;
536544

537545
root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
538546
if (!root)
@@ -590,7 +598,8 @@ static int acpi_pci_root_add(struct acpi_device *device,
590598

591599
root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle);
592600

593-
negotiate_os_control(root, &no_aspm);
601+
is_pcie = strcmp(acpi_device_hid(device), "PNP0A08") == 0;
602+
negotiate_os_control(root, &no_aspm, is_pcie);
594603

595604
/*
596605
* TBD: Need PCI interface for enumeration/configuration of roots.

drivers/pci/pcie/aspm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
895895
struct pcie_link_state *link;
896896
int blacklist = !!pcie_aspm_sanity_check(pdev);
897897

898-
if (!aspm_support_enabled)
898+
if (!aspm_support_enabled || aspm_disabled)
899899
return;
900900

901901
if (pdev->link_state)
@@ -991,7 +991,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
991991
* All PCIe functions are in one slot, remove one function will remove
992992
* the whole slot, so just wait until we are the last function left.
993993
*/
994-
if (!list_is_last(&pdev->bus_list, &parent->subordinate->devices))
994+
if (!list_empty(&parent->subordinate->devices))
995995
goto out;
996996

997997
link = parent->link_state;

drivers/pci/remove.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ static void pci_stop_dev(struct pci_dev *dev)
2525

2626
pci_dev_assign_added(dev, false);
2727
}
28-
29-
if (dev->bus->self)
30-
pcie_aspm_exit_link_state(dev);
3128
}
3229

3330
static void pci_destroy_dev(struct pci_dev *dev)
@@ -41,6 +38,7 @@ static void pci_destroy_dev(struct pci_dev *dev)
4138
list_del(&dev->bus_list);
4239
up_write(&pci_bus_sem);
4340

41+
pcie_aspm_exit_link_state(dev);
4442
pci_bridge_d3_update(dev);
4543
pci_free_resources(dev);
4644
put_device(&dev->dev);

0 commit comments

Comments
 (0)