• Naga Chumbalkar's avatar
    PCI: PCIe links may not get configured for ASPM under POWERSAVE mode · 1a680b7c
    Naga Chumbalkar authored
    v3 -> v2: Moved ASPM enabling logic to pci_set_power_state()
    v2 -> v1: Preserved the logic in pci_raw_set_power_state()
    	: Added ASPM enabling logic after scanning Root Bridge
    	: http://marc.info/?l=linux-pci&m=130046996216391&w=2
    v1	: http://marc.info/?l=linux-pci&m=130013164703283&w=2
    
    The assumption made in commit 41cd766b
    (PCI: Don't enable aspm before drivers have had a chance to veto it) that
    pci_enable_device() will result in re-configuring ASPM when aspm_policy is
    POWERSAVE is no longer valid.  This is due to commit
    97c145f7 (PCI: read current power state
    at enable time) which resets dev->current_state to D0. Due to this the
    call to pcie_aspm_pm_state_change() is never made. Note the equality check
    (below) that returns early:
    ./drivers/pci/pci.c: pci_raw_set_pci_power_state()
    546         /* Check if we're already there */
    547         if (dev->current_state == state)
    548                 return 0;
    
    Therefore OSPM never configures the PCIe links for ASPM to turn them "on".
    
    Fix it by configuring ASPM from the pci_enable_device() code path. This
    also allows a driver such as the e1000e networking driver a chance to
    disable ASPM (L0s, L1), if need be, prior to enabling the device. A
    driver may perform this action if the device is known to mis-behave
    wrt ASPM.
    Signed-off-by: default avatarNaga Chumbalkar <nagananda.chumbalkar@hp.com>
    Acked-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    Cc: Matthew Garrett <mjg59@srcf.ucam.org>
    Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
    1a680b7c
pci.c 80.7 KB