mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-29 20:16:44 +07:00
3c076351c4
Right now we forcibly clear ASPM state on all devices if the BIOS indicates that the feature isn't supported. Based on the Microsoft presentation "PCI Express In Depth for Windows Vista and Beyond", I'm starting to think that this may be an error. The implication is that unless the platform grants full control via _OSC, Windows will not touch any PCIe features - including ASPM. In that case clearing ASPM state would be an error unless the platform has granted us that control. This patch reworks the ASPM disabling code such that the actual clearing of state is triggered by a successful handoff of PCIe control to the OS. The general ASPM code undergoes some changes in order to ensure that the ability to clear the bits isn't overridden by ASPM having already been disabled. Further, this theoretically now allows for situations where only a subset of PCIe roots hand over control, leaving the others in the BIOS state. It's difficult to know for sure that this is the right thing to do - there's zero public documentation on the interaction between all of these components. But enough vendors enable ASPM on platforms and then set this bit that it seems likely that they're expecting the OS to leave them alone. Measured to save around 5W on an idle Thinkpad X220. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
70 lines
1.8 KiB
C
70 lines
1.8 KiB
C
/*
|
|
* aspm.h
|
|
*
|
|
* PCI Express ASPM defines and function prototypes
|
|
*
|
|
* Copyright (C) 2007 Intel Corp.
|
|
* Zhang Yanmin (yanmin.zhang@intel.com)
|
|
* Shaohua Li (shaohua.li@intel.com)
|
|
*
|
|
* For more information, please consult the following manuals (look at
|
|
* http://www.pcisig.com/ for how to get them):
|
|
*
|
|
* PCI Express Specification
|
|
*/
|
|
|
|
#ifndef LINUX_ASPM_H
|
|
#define LINUX_ASPM_H
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#define PCIE_LINK_STATE_L0S 1
|
|
#define PCIE_LINK_STATE_L1 2
|
|
#define PCIE_LINK_STATE_CLKPM 4
|
|
|
|
#ifdef CONFIG_PCIEASPM
|
|
extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
|
|
extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
|
|
extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
|
|
extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
|
|
extern void pci_disable_link_state(struct pci_dev *pdev, int state);
|
|
extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
|
|
extern void pcie_clear_aspm(struct pci_bus *bus);
|
|
extern void pcie_no_aspm(void);
|
|
#else
|
|
static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
|
|
{
|
|
}
|
|
static inline void pcie_clear_aspm(struct pci_bus *bus)
|
|
{
|
|
}
|
|
static inline void pcie_no_aspm(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
|
|
extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
|
|
extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
|
|
#else
|
|
static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
#endif
|
|
#endif /* LINUX_ASPM_H */
|