[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210824204248.2957134-3-anthony.l.nguyen@intel.com>
Date: Tue, 24 Aug 2021 13:42:46 -0700
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: davem@...emloft.net, kuba@...nel.org
Cc: Vinicius Costa Gomes <vinicius.gomes@...el.com>,
netdev@...r.kernel.org, anthony.l.nguyen@...el.com,
bhelgaas@...gle.com, linux-pci@...r.kernel.org,
sasha.neftin@...el.com, vitaly.lifshits@...el.com,
richardcochran@...il.com
Subject: [PATCH net-next 2/4] PCI: Add pcie_ptm_enabled()
From: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Add a predicate that returns if PCIe PTM (Precision Time Measurement)
is enabled.
It will only return true if it's enabled in all the ports in the path
from the device to the root.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Acked-by: Bjorn Helgaas <bhelgaas@...gle.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
---
drivers/pci/pcie/ptm.c | 9 +++++++++
include/linux/pci.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
index 95d4eef2c9e8..8a4ad974c5ac 100644
--- a/drivers/pci/pcie/ptm.c
+++ b/drivers/pci/pcie/ptm.c
@@ -204,3 +204,12 @@ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
return 0;
}
EXPORT_SYMBOL(pci_enable_ptm);
+
+bool pcie_ptm_enabled(struct pci_dev *dev)
+{
+ if (!dev)
+ return false;
+
+ return dev->ptm_enabled;
+}
+EXPORT_SYMBOL(pcie_ptm_enabled);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 21a9d244e4e4..947430637cac 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1622,9 +1622,12 @@ bool pci_ats_disabled(void);
#ifdef CONFIG_PCIE_PTM
int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
+bool pcie_ptm_enabled(struct pci_dev *dev);
#else
static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
{ return -EINVAL; }
+static inline bool pcie_ptm_enabled(struct pci_dev *dev)
+{ return false; }
#endif
void pci_cfg_access_lock(struct pci_dev *dev);
--
2.26.2
Powered by blists - more mailing lists