From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: hkallweit1@gmail.com, nic_swsd@realtek.com, bhelgaas@google.com
Cc: davem@davemloft.net, kuba@kernel.org, anthony.wong@canonical.com,
netdev@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
"Saheed O. Bolarinwa" <refactormyself@gmail.com>,
"Logan Gunthorpe" <logang@deltatee.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Vidya Sagar" <vidyas@nvidia.com>
Subject: [RFC] [PATCH net-next v5 1/3] PCI/ASPM: Introduce a new helper to report ASPM capability
Date: Fri, 8 Oct 2021 00:15:50 +0800 [thread overview]
Message-ID: <20211007161552.272771-2-kai.heng.feng@canonical.com> (raw)
In-Reply-To: <20211007161552.272771-1-kai.heng.feng@canonical.com>
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(+)
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
next prev parent reply other threads:[~2021-10-07 16:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 16:15 [RFC] [PATCH net-next v6 0/3] r8169: Implement dynamic ASPM mechanism for recent 1.0/2.5Gbps Realtek NICs Kai-Heng Feng
2021-10-07 16:15 ` Kai-Heng Feng [this message]
2021-10-08 22:18 ` [RFC] [PATCH net-next v5 1/3] PCI/ASPM: Introduce a new helper to report ASPM capability Bjorn Helgaas
2021-10-07 16:15 ` [RFC] [PATCH net-next v6 2/3] r8169: Enable chip-specific ASPM regardless of PCIe ASPM status Kai-Heng Feng
2021-10-07 16:15 ` [RFC] [PATCH net-next v6 3/3] r8169: Implement dynamic ASPM mechanism Kai-Heng Feng
2021-10-07 19:11 ` Bjorn Helgaas
2021-10-08 6:18 ` Kai-Heng Feng
2021-10-08 13:58 ` Bjorn Helgaas
2021-10-15 4:11 ` Kai-Heng Feng
-- strict thread matches above, loose matches on Subject: below --
2021-09-16 15:44 [RFC] [PATCH net-next v5 0/3] r8169: Implement dynamic ASPM mechanism for recent 1.0/2.5Gbps Realtek NICs Kai-Heng Feng
2021-09-16 15:44 ` [RFC] [PATCH net-next v5 1/3] PCI/ASPM: Introduce a new helper to report ASPM capability Kai-Heng Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211007161552.272771-2-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=anthony.wong@canonical.com \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=refactormyself@gmail.com \
--cc=vidyas@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.