aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorWei Yang <weiyang@linux.vnet.ibm.com>2015-03-25 04:23:44 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-03-30 22:02:35 -0400
commit0e6c9122a6ec96d19f1db61e9750287d86b6829c (patch)
tree8bcf0dad431a260735d35172fd336c09185a74f3 /include/linux/pci.h
parente88ae01d2c43be3c3a6f340bfa7bab8b87127f57 (diff)
PCI: Keep individual VF BAR size in struct pci_sriov
Currently we don't store the individual VF BAR size. We calculate it when needed by dividing the PF's IOV resource size (which contains space for *all* the VFs) by total_VFs or by reading the BAR in the SR-IOV capability again. Keep the individual VF BAR size in struct pci_sriov.barsz[], add pci_iov_resource_size() to retrieve it, and use that instead of doing the division or reading the SR-IOV capability BAR. [bhelgaas: rename to "barsz[]", simplify barsz[] index computation, remove SR-IOV capability BAR sizing] Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 211e9da8a7d7..15596582e575 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1675,6 +1675,7 @@ int pci_num_vf(struct pci_dev *dev);
1675int pci_vfs_assigned(struct pci_dev *dev); 1675int pci_vfs_assigned(struct pci_dev *dev);
1676int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1676int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1677int pci_sriov_get_totalvfs(struct pci_dev *dev); 1677int pci_sriov_get_totalvfs(struct pci_dev *dev);
1678resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
1678#else 1679#else
1679static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1680static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1680{ return -ENODEV; } 1681{ return -ENODEV; }
@@ -1686,6 +1687,8 @@ static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1686{ return 0; } 1687{ return 0; }
1687static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) 1688static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1688{ return 0; } 1689{ return 0; }
1690static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
1691{ return 0; }
1689#endif 1692#endif
1690 1693
1691#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1694#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)