Skip to content

Commit

Permalink
PCI: Add pcie_ptm_enabled()
Browse files Browse the repository at this point in the history
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@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Vinicius Costa Gomes authored and Tony Nguyen committed Aug 24, 2021
1 parent 1d71eb5 commit 014408c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/pci/pcie/ptm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 014408c

Please sign in to comment.