Skip to content

Commit

Permalink
Merge branch 'pci/aspm'
Browse files Browse the repository at this point in the history
  - 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
  • Loading branch information
Bjorn Helgaas committed Oct 20, 2018
2 parents 7876320 + 17c9148 commit b1801bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
17 changes: 13 additions & 4 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
}
EXPORT_SYMBOL(acpi_pci_osc_control_set);

static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
bool is_pcie)
{
u32 support, control, requested;
acpi_status status;
Expand Down Expand Up @@ -455,9 +456,15 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
decode_osc_support(root, "OS supports", support);
status = acpi_pci_osc_support(root, support);
if (ACPI_FAILURE(status)) {
dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
acpi_format_exception(status));
*no_aspm = 1;

/* _OSC is optional for PCI host bridges */
if ((status == AE_NOT_FOUND) && !is_pcie)
return;

dev_info(&device->dev, "_OSC failed (%s)%s\n",
acpi_format_exception(status),
pcie_aspm_support_enabled() ? "; disabling ASPM" : "");
return;
}

Expand Down Expand Up @@ -533,6 +540,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
acpi_handle handle = device->handle;
int no_aspm = 0;
bool hotadd = system_state == SYSTEM_RUNNING;
bool is_pcie;

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

root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle);

negotiate_os_control(root, &no_aspm);
is_pcie = strcmp(acpi_device_hid(device), "PNP0A08") == 0;
negotiate_os_control(root, &no_aspm, is_pcie);

/*
* TBD: Need PCI interface for enumeration/configuration of roots.
Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/pcie/aspm.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
struct pcie_link_state *link;
int blacklist = !!pcie_aspm_sanity_check(pdev);

if (!aspm_support_enabled)
if (!aspm_support_enabled || aspm_disabled)
return;

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

link = parent->link_state;
Expand Down
4 changes: 1 addition & 3 deletions drivers/pci/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ static void pci_stop_dev(struct pci_dev *dev)

pci_dev_assign_added(dev, false);
}

if (dev->bus->self)
pcie_aspm_exit_link_state(dev);
}

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

pcie_aspm_exit_link_state(dev);
pci_bridge_d3_update(dev);
pci_free_resources(dev);
put_device(&dev->dev);
Expand Down

0 comments on commit b1801bf

Please sign in to comment.