diff mbox

[2/6] PCI: acpiphp: enable_device(): rescan even if no new devices on slot

Message ID 20130627163246.GZ9294@intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Mika Westerberg June 27, 2013, 4:32 p.m. UTC
On Thu, Jun 27, 2013 at 04:02:29PM +0300, Mika Westerberg wrote:
> On Wed, Jun 26, 2013 at 05:37:58PM -0600, Bjorn Helgaas wrote:
> > > @@ -707,8 +702,11 @@ static int __ref enable_device(struct acpiphp_slot *slot)
> > >                             dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
> > >                                 max = pci_scan_bridge(bus, dev, max, pass);
> > >                                 if (pass && dev->subordinate) {
> > > -                                       check_hotplug_bridge(slot, dev);
> > > -                                       pcibios_resource_survey_bus(dev->subordinate);
> > > +                                       if (!dev->subordinate->is_added) {
> > > +                                               check_hotplug_bridge(slot, dev);
> > > +                                               pcibios_resource_survey_bus(
> > > +                                                       dev->subordinate);
> > 
> > It's a shame that pcibios_resource_survey_bus() can't be called twice.
> >  It would be nice if it were smart enough to notice on the second call
> > that "oh, resources have already been assigned, so there's nothing
> > more to be done."  Did you look to see whether that's feasible?
> 
> I didn't but now that you mentioned I went and checked. I'm pretty sure we
> can handle it there in the next revision and drop this change.

With following patch that fixes pcibios_resource_survey_bus() Thunderbolt
seems to be working just fine (and the quirk is gone).

If it looks okay, I'll include it into the next iteration of the patches.

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

Comments

Bjorn Helgaas June 27, 2013, 4:50 p.m. UTC | #1
On Thu, Jun 27, 2013 at 10:32 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Thu, Jun 27, 2013 at 04:02:29PM +0300, Mika Westerberg wrote:
>> On Wed, Jun 26, 2013 at 05:37:58PM -0600, Bjorn Helgaas wrote:
>> > > @@ -707,8 +702,11 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>> > >                             dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
>> > >                                 max = pci_scan_bridge(bus, dev, max, pass);
>> > >                                 if (pass && dev->subordinate) {
>> > > -                                       check_hotplug_bridge(slot, dev);
>> > > -                                       pcibios_resource_survey_bus(dev->subordinate);
>> > > +                                       if (!dev->subordinate->is_added) {
>> > > +                                               check_hotplug_bridge(slot, dev);
>> > > +                                               pcibios_resource_survey_bus(
>> > > +                                                       dev->subordinate);
>> >
>> > It's a shame that pcibios_resource_survey_bus() can't be called twice.
>> >  It would be nice if it were smart enough to notice on the second call
>> > that "oh, resources have already been assigned, so there's nothing
>> > more to be done."  Did you look to see whether that's feasible?
>>
>> I didn't but now that you mentioned I went and checked. I'm pretty sure we
>> can handle it there in the next revision and drop this change.
>
> With following patch that fixes pcibios_resource_survey_bus() Thunderbolt
> seems to be working just fine (and the quirk is gone).
>
> If it looks okay, I'll include it into the next iteration of the patches.

That looks great, thanks a lot for exploring this!

> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
> index 94919e3..db6b1ab 100644
> --- a/arch/x86/pci/i386.c
> +++ b/arch/x86/pci/i386.c
> @@ -210,6 +210,8 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
>                 r = &dev->resource[idx];
>                 if (!r->flags)
>                         continue;
> +               if (r->parent)  /* Already allocated */
> +                       continue;
>                 if (!r->start || pci_claim_resource(dev, idx) < 0) {
>                         /*
>                          * Something is wrong with the region.
> @@ -318,6 +320,8 @@ static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
>         r = &dev->resource[PCI_ROM_RESOURCE];
>         if (!r->flags || !r->start)
>                 return;
> +       if (r->parent) /* Already allocated */
> +               return;
>
>         if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
>                 r->end -= r->start;
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas June 27, 2013, 4:54 p.m. UTC | #2
On Thu, Jun 27, 2013 at 10:32 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Thu, Jun 27, 2013 at 04:02:29PM +0300, Mika Westerberg wrote:
>> On Wed, Jun 26, 2013 at 05:37:58PM -0600, Bjorn Helgaas wrote:
>> > > @@ -707,8 +702,11 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>> > >                             dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
>> > >                                 max = pci_scan_bridge(bus, dev, max, pass);
>> > >                                 if (pass && dev->subordinate) {
>> > > -                                       check_hotplug_bridge(slot, dev);
>> > > -                                       pcibios_resource_survey_bus(dev->subordinate);
>> > > +                                       if (!dev->subordinate->is_added) {
>> > > +                                               check_hotplug_bridge(slot, dev);
>> > > +                                               pcibios_resource_survey_bus(
>> > > +                                                       dev->subordinate);
>> >
>> > It's a shame that pcibios_resource_survey_bus() can't be called twice.
>> >  It would be nice if it were smart enough to notice on the second call
>> > that "oh, resources have already been assigned, so there's nothing
>> > more to be done."  Did you look to see whether that's feasible?
>>
>> I didn't but now that you mentioned I went and checked. I'm pretty sure we
>> can handle it there in the next revision and drop this change.
>
> With following patch that fixes pcibios_resource_survey_bus() Thunderbolt
> seems to be working just fine (and the quirk is gone).
>
> If it looks okay, I'll include it into the next iteration of the patches.

That looks great, thanks a lot for exploring this!

> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
> index 94919e3..db6b1ab 100644
> --- a/arch/x86/pci/i386.c
> +++ b/arch/x86/pci/i386.c
> @@ -210,6 +210,8 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
>                 r = &dev->resource[idx];
>                 if (!r->flags)
>                         continue;
> +               if (r->parent)  /* Already allocated */
> +                       continue;
>                 if (!r->start || pci_claim_resource(dev, idx) < 0) {
>                         /*
>                          * Something is wrong with the region.
> @@ -318,6 +320,8 @@ static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
>         r = &dev->resource[PCI_ROM_RESOURCE];
>         if (!r->flags || !r->start)
>                 return;
> +       if (r->parent) /* Already allocated */
> +               return;
>
>         if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
>                 r->end -= r->start;
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 94919e3..db6b1ab 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -210,6 +210,8 @@  static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
 		r = &dev->resource[idx];
 		if (!r->flags)
 			continue;
+		if (r->parent)	/* Already allocated */
+			continue;
 		if (!r->start || pci_claim_resource(dev, idx) < 0) {
 			/*
 			 * Something is wrong with the region.
@@ -318,6 +320,8 @@  static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
 	r = &dev->resource[PCI_ROM_RESOURCE];
 	if (!r->flags || !r->start)
 		return;
+	if (r->parent) /* Already allocated */
+		return;
 
 	if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
 		r->end -= r->start;