diff options
author | Wei Yang <weiyang@linux.vnet.ibm.com> | 2015-03-25 04:23:44 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-30 22:02:35 -0400 |
commit | 0e6c9122a6ec96d19f1db61e9750287d86b6829c (patch) | |
tree | 8bcf0dad431a260735d35172fd336c09185a74f3 /include/linux/pci.h | |
parent | e88ae01d2c43be3c3a6f340bfa7bab8b87127f57 (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.h | 3 |
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); | |||
1675 | int pci_vfs_assigned(struct pci_dev *dev); | 1675 | int pci_vfs_assigned(struct pci_dev *dev); |
1676 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); | 1676 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); |
1677 | int pci_sriov_get_totalvfs(struct pci_dev *dev); | 1677 | int pci_sriov_get_totalvfs(struct pci_dev *dev); |
1678 | resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno); | ||
1678 | #else | 1679 | #else |
1679 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1680 | static 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; } |
1687 | static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) | 1688 | static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) |
1688 | { return 0; } | 1689 | { return 0; } |
1690 | static 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) |