diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-07-20 10:24:32 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-08-13 16:59:58 -0400 |
commit | a71f938f3a9a7bc879296cd34ecae9effe5edf3f (patch) | |
tree | 87649fae821222f40fc9a15231623fc3dcdc25a9 | |
parent | ff9bee895c4d11a519a6b2c49451376025a6af4e (diff) |
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>
-rw-r--r-- | drivers/pci/ats.c | 9 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c index 9355f754c7c2..ceda7dc556d4 100644 --- a/drivers/pci/ats.c +++ b/drivers/pci/ats.c | |||
@@ -20,16 +20,12 @@ | |||
20 | void pci_ats_init(struct pci_dev *dev) | 20 | void pci_ats_init(struct pci_dev *dev) |
21 | { | 21 | { |
22 | int pos; | 22 | int pos; |
23 | u16 cap; | ||
24 | 23 | ||
25 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); | 24 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); |
26 | if (!pos) | 25 | if (!pos) |
27 | return; | 26 | return; |
28 | 27 | ||
29 | dev->ats_cap = pos; | 28 | dev->ats_cap = pos; |
30 | pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap); | ||
31 | dev->ats_qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : | ||
32 | PCI_ATS_MAX_QDEP; | ||
33 | } | 29 | } |
34 | 30 | ||
35 | /** | 31 | /** |
@@ -131,13 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state); | |||
131 | */ | 127 | */ |
132 | int pci_ats_queue_depth(struct pci_dev *dev) | 128 | int pci_ats_queue_depth(struct pci_dev *dev) |
133 | { | 129 | { |
130 | u16 cap; | ||
131 | |||
134 | if (!dev->ats_cap) | 132 | if (!dev->ats_cap) |
135 | return -EINVAL; | 133 | return -EINVAL; |
136 | 134 | ||
137 | if (dev->is_virtfn) | 135 | if (dev->is_virtfn) |
138 | return 0; | 136 | return 0; |
139 | 137 | ||
140 | return dev->ats_qdep; | 138 | pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap); |
139 | return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP; | ||
141 | } | 140 | } |
142 | EXPORT_SYMBOL_GPL(pci_ats_queue_depth); | 141 | EXPORT_SYMBOL_GPL(pci_ats_queue_depth); |
143 | 142 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 307f96a58e8b..4b484fdfd66f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -378,7 +378,6 @@ struct pci_dev { | |||
378 | }; | 378 | }; |
379 | u16 ats_cap; /* ATS Capability offset */ | 379 | u16 ats_cap; /* ATS Capability offset */ |
380 | u8 ats_stu; /* ATS Smallest Translation Unit */ | 380 | u8 ats_stu; /* ATS Smallest Translation Unit */ |
381 | u8 ats_qdep; /* ATS Invalidate Queue Depth */ | ||
382 | atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */ | 381 | atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */ |
383 | #endif | 382 | #endif |
384 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ | 383 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ |