Message ID | 20211007161552.272771-2-kai.heng.feng@canonical.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | r8169: Implement dynamic ASPM mechanism for recent 1.0/2.5Gbps Realtek NICs | expand |
On Fri, Oct 08, 2021 at 12:15:50AM +0800, Kai-Heng Feng wrote: > Introduce a new helper, pcie_aspm_capable(), to report ASPM capability. > > The user will be introduced by next patch. > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Change subject to: PCI/ASPM: Add pcie_aspm_capable() Acked-by: Bjorn Helgaas <bhelgaas@google.com> > --- > v6: > v5: > - No change. > > v4: > - Report aspm_capable instead. > > v3: > - This is a new patch > > drivers/pci/pcie/aspm.c | 11 +++++++++++ > include/linux/pci.h | 2 ++ > 2 files changed, 13 insertions(+) > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > index 013a47f587cea..788e7496f33b1 100644 > --- a/drivers/pci/pcie/aspm.c > +++ b/drivers/pci/pcie/aspm.c > @@ -1201,6 +1201,17 @@ bool pcie_aspm_enabled(struct pci_dev *pdev) > } > EXPORT_SYMBOL_GPL(pcie_aspm_enabled); > > +bool pcie_aspm_capable(struct pci_dev *pdev) > +{ > + struct pcie_link_state *link = pcie_aspm_get_link(pdev); > + > + if (!link) > + return false; > + > + return link->aspm_capable; > +} > +EXPORT_SYMBOL_GPL(pcie_aspm_capable); > + > static ssize_t aspm_attr_show_common(struct device *dev, > struct device_attribute *attr, > char *buf, u8 state) > diff --git a/include/linux/pci.h b/include/linux/pci.h > index cd8aa6fce2041..a17baa39141f4 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1639,6 +1639,7 @@ int pci_disable_link_state_locked(struct pci_dev *pdev, int state); > void pcie_no_aspm(void); > bool pcie_aspm_support_enabled(void); > bool pcie_aspm_enabled(struct pci_dev *pdev); > +bool pcie_aspm_capable(struct pci_dev *pdev); > #else > static inline int pci_disable_link_state(struct pci_dev *pdev, int state) > { return 0; } > @@ -1647,6 +1648,7 @@ static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state) > static inline void pcie_no_aspm(void) { } > static inline bool pcie_aspm_support_enabled(void) { return false; } > static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; } > +static inline bool pcie_aspm_capable(struct pci_dev *pdev) { return false; } > #endif > > #ifdef CONFIG_PCIEAER > -- > 2.32.0 >
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 013a47f587cea..788e7496f33b1 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1201,6 +1201,17 @@ bool pcie_aspm_enabled(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(pcie_aspm_enabled); +bool pcie_aspm_capable(struct pci_dev *pdev) +{ + struct pcie_link_state *link = pcie_aspm_get_link(pdev); + + if (!link) + return false; + + return link->aspm_capable; +} +EXPORT_SYMBOL_GPL(pcie_aspm_capable); + static ssize_t aspm_attr_show_common(struct device *dev, struct device_attribute *attr, char *buf, u8 state) diff --git a/include/linux/pci.h b/include/linux/pci.h index cd8aa6fce2041..a17baa39141f4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1639,6 +1639,7 @@ int pci_disable_link_state_locked(struct pci_dev *pdev, int state); void pcie_no_aspm(void); bool pcie_aspm_support_enabled(void); bool pcie_aspm_enabled(struct pci_dev *pdev); +bool pcie_aspm_capable(struct pci_dev *pdev); #else static inline int pci_disable_link_state(struct pci_dev *pdev, int state) { return 0; } @@ -1647,6 +1648,7 @@ static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state) static inline void pcie_no_aspm(void) { } static inline bool pcie_aspm_support_enabled(void) { return false; } static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; } +static inline bool pcie_aspm_capable(struct pci_dev *pdev) { return false; } #endif #ifdef CONFIG_PCIEAER
Introduce a new helper, pcie_aspm_capable(), to report ASPM capability. The user will be introduced by next patch. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> --- v6: v5: - No change. v4: - Report aspm_capable instead. v3: - This is a new patch drivers/pci/pcie/aspm.c | 11 +++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 13 insertions(+)