Skip to content

Commit

Permalink
PCI: Enable upstream bridges even for VFs on virtual buses
Browse files Browse the repository at this point in the history
Previously we enabled the upstream PCI-to-PCI bridge only when
"dev->bus->self != NULL".  In the case of a VF on a virtual bus, where
"bus->self == NULL", we didn't enable the upstream bridge.

This fixes that by enabling the upstream bridge of the PF corresponding to
the VF.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
  • Loading branch information
Bjorn Helgaas committed Nov 7, 2013
1 parent c6bde21 commit 7927213
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,12 @@ int pci_reenable_device(struct pci_dev *dev)

static void pci_enable_bridge(struct pci_dev *dev)
{
struct pci_dev *bridge;
int retval;

if (!dev)
return;

pci_enable_bridge(dev->bus->self);
bridge = pci_upstream_bridge(dev);
if (bridge)
pci_enable_bridge(bridge);

if (pci_is_enabled(dev)) {
if (!dev->is_busmaster)
Expand All @@ -1170,6 +1170,7 @@ static void pci_enable_bridge(struct pci_dev *dev)

static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
{
struct pci_dev *bridge;
int err;
int i, bars = 0;

Expand All @@ -1188,7 +1189,9 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
if (atomic_inc_return(&dev->enable_cnt) > 1)
return 0; /* already enabled */

pci_enable_bridge(dev->bus->self);
bridge = pci_upstream_bridge(dev);
if (bridge)
pci_enable_bridge(bridge);

/* only skip sriov related */
for (i = 0; i <= PCI_ROM_RESOURCE; i++)
Expand Down

0 comments on commit 7927213

Please sign in to comment.