Re: [PATCH] PCI: Use pci_is_root_bus() to check for root bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> > commit 4e5415f02e32c85e902cd9692eab18200e14b347
>> > Author: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
>> > Date:   Wed Nov 6 10:00:51 2013 -0700
>> >
>> >     PCI: Enable upstream bridges even for VFs on virtual buses
>> >
>> >     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@xxxxxxxxxx>
>> >
>> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> > index ac40f90..744dc26 100644
>> > --- a/drivers/pci/pci.c
>> > +++ b/drivers/pci/pci.c
>> > @@ -1150,10 +1150,8 @@ static void pci_enable_bridge(struct pci_dev *dev)
>> >  {
>> >         int retval;
>> >
>> > -       if (!dev)
>> > -               return;
>> > -
>> > -       pci_enable_bridge(dev->bus->self);
>> > +       if (!pci_is_root_bus(dev->bus))
>> > +               pci_enable_bridge(pci_upstream_bridge(dev));
>> >
>> >         if (pci_is_enabled(dev)) {
>> >                 if (!dev->is_busmaster)
>> > @@ -1188,7 +1186,8 @@ 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);
>> > +       if (!pci_is_root_bus(dev->bus))
>> > +               pci_enable_bridge(pci_upstream_bridge(dev));
>> >
>> >         /* only skip sriov related */
>> >         for (i = 0; i <= PCI_ROM_RESOURCE; i++)
>>
>> still have problem.
>>
>> pci_upstream_bridge() could return NULL. so later pci_enable_bridge()
>> referring dev->bus could panic, as you remove !dev checking.
>
> pci_upstream_bridge(dev) can only return NULL if dev is on a root bus,
> and we never call pci_enable_bridge() in that case.  So I don't see
> the problem.

how about it is VF and it is on it's own virtual bus ?
and it will pass !pci_is_root_bus(dev->bus) checking and get into
pci_enable_bridge(pci_upstream_bridge(dev));


Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux