mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
PCI: Stop caching ATS Invalidate Queue Depth
Stop caching the Invalidate Queue Depth in struct pci_dev. pci_ats_queue_depth() is typically called only once per device, and it returns a fixed value per-device, so callers who need the value frequently can cache it themselves. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
ff9bee895c
commit
a71f938f3a
2 changed files with 4 additions and 6 deletions
|
@ -20,16 +20,12 @@
|
||||||
void pci_ats_init(struct pci_dev *dev)
|
void pci_ats_init(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
u16 cap;
|
|
||||||
|
|
||||||
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
|
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
|
||||||
if (!pos)
|
if (!pos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dev->ats_cap = pos;
|
dev->ats_cap = pos;
|
||||||
pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
|
|
||||||
dev->ats_qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) :
|
|
||||||
PCI_ATS_MAX_QDEP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,13 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state);
|
||||||
*/
|
*/
|
||||||
int pci_ats_queue_depth(struct pci_dev *dev)
|
int pci_ats_queue_depth(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
|
u16 cap;
|
||||||
|
|
||||||
if (!dev->ats_cap)
|
if (!dev->ats_cap)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (dev->is_virtfn)
|
if (dev->is_virtfn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return dev->ats_qdep;
|
pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
|
||||||
|
return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pci_ats_queue_depth);
|
EXPORT_SYMBOL_GPL(pci_ats_queue_depth);
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,6 @@ struct pci_dev {
|
||||||
};
|
};
|
||||||
u16 ats_cap; /* ATS Capability offset */
|
u16 ats_cap; /* ATS Capability offset */
|
||||||
u8 ats_stu; /* ATS Smallest Translation Unit */
|
u8 ats_stu; /* ATS Smallest Translation Unit */
|
||||||
u8 ats_qdep; /* ATS Invalidate Queue Depth */
|
|
||||||
atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */
|
atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */
|
||||||
#endif
|
#endif
|
||||||
phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
|
phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
|
||||||
|
|
Loading…
Reference in a new issue