PCI: Keep individual VF BAR size in struct pci_sriov
authorWei Yang <weiyang@linux.vnet.ibm.com>
Wed, 25 Mar 2015 08:23:44 +0000 (16:23 +0800)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 31 Mar 2015 02:02:35 +0000 (13:02 +1100)
commit0e6c9122a6ec96d19f1db61e9750287d86b6829c
tree8bcf0dad431a260735d35172fd336c09185a74f3
parente88ae01d2c43be3c3a6f340bfa7bab8b87127f57
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>
drivers/pci/iov.c
drivers/pci/pci.h
include/linux/pci.h