diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2018-10-20 18:45:35 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-10-20 18:45:35 +0200 |
commit | eff81b6f7b1ecad7e8cdf4f44b010b54ef438864 (patch) | |
tree | 6231f738f74be610a1c649baf96f87a694436449 /drivers/pci/probe.c | |
parent | Merge branch 'pci/peer-to-peer' (diff) | |
parent | PCI/IOV: Remove unnecessary include of <linux/pci-ats.h> (diff) | |
download | linux-eff81b6f7b1ecad7e8cdf4f44b010b54ef438864.tar.xz linux-eff81b6f7b1ecad7e8cdf4f44b010b54ef438864.zip |
Merge branch 'pci/virtualization'
- Cache VF config space size to optimize enumeration of many VFs
(KarimAllah Ahmed)
- Remove unnecessary <linux/pci-ats.h> include (Bjorn Helgaas)
* pci/virtualization:
PCI/IOV: Remove unnecessary include of <linux/pci-ats.h>
PCI/IOV: Use VF0 cached config space size for other VFs
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 966641d517ba..b1c05b5054a0 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1439,12 +1439,29 @@ static int pci_cfg_space_size_ext(struct pci_dev *dev) return PCI_CFG_SPACE_EXP_SIZE; } +#ifdef CONFIG_PCI_IOV +static bool is_vf0(struct pci_dev *dev) +{ + if (pci_iov_virtfn_devfn(dev->physfn, 0) == dev->devfn && + pci_iov_virtfn_bus(dev->physfn, 0) == dev->bus->number) + return true; + + return false; +} +#endif + int pci_cfg_space_size(struct pci_dev *dev) { int pos; u32 status; u16 class; +#ifdef CONFIG_PCI_IOV + /* Read cached value for all VFs except for VF0 */ + if (dev->is_virtfn && !is_vf0(dev)) + return dev->physfn->sriov->cfg_size; +#endif + if (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_EXTCFG) return PCI_CFG_SPACE_SIZE; |