Commit 3f579c340fe6d6bdd8c6f9f144e7c3b85d4174ec

Authored by Yinghai Lu
Committed by Jesse Barnes
1 parent 0ba10bc752

PCI hotplug: make sure child bridges are enabled at hotplug time

Found one PCIe Module with several bridges built-in where a "cold"
hotadd doesn't work.

If we end up reassigning bridge windows at hotadd time, and have to loop
through assigning new ranges, we won't end up enabling the child bridges
because the first assignment pass already tried to enable them, which
prevents __pci_bridge_assign_resource from updating the windows.

So try to move enabling of child bridges to the end, and only do it
once.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff

drivers/pci/setup-bus.c
... ... @@ -874,19 +874,16 @@
874 874 again:
875 875 pci_bus_size_bridges(parent);
876 876 __pci_bridge_assign_resources(bridge, &head);
877   - retval = pci_reenable_device(bridge);
878   - pci_set_master(bridge);
879   - pci_enable_bridges(parent);
880 877  
881 878 tried_times++;
882 879  
883 880 if (!head.next)
884   - return;
  881 + goto enable_all;
885 882  
886 883 if (tried_times >= 2) {
887 884 /* still fail, don't need to try more */
888 885 free_failed_list(&head);
889   - return;
  886 + goto enable_all;
890 887 }
891 888  
892 889 printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
... ... @@ -919,6 +916,11 @@
919 916 free_failed_list(&head);
920 917  
921 918 goto again;
  919 +
  920 +enable_all:
  921 + retval = pci_reenable_device(bridge);
  922 + pci_set_master(bridge);
  923 + pci_enable_bridges(parent);
922 924 }
923 925 EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources);