Skip to content

Commit 3f579c3

Browse files
Yinghai Lujbarnes993
authored andcommitted
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 <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 0ba10bc commit 3f579c3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/pci/setup-bus.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,19 +874,16 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
874874
again:
875875
pci_bus_size_bridges(parent);
876876
__pci_bridge_assign_resources(bridge, &head);
877-
retval = pci_reenable_device(bridge);
878-
pci_set_master(bridge);
879-
pci_enable_bridges(parent);
880877

881878
tried_times++;
882879

883880
if (!head.next)
884-
return;
881+
goto enable_all;
885882

886883
if (tried_times >= 2) {
887884
/* still fail, don't need to try more */
888885
free_failed_list(&head);
889-
return;
886+
goto enable_all;
890887
}
891888

892889
printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
@@ -919,5 +916,10 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
919916
free_failed_list(&head);
920917

921918
goto again;
919+
920+
enable_all:
921+
retval = pci_reenable_device(bridge);
922+
pci_set_master(bridge);
923+
pci_enable_bridges(parent);
922924
}
923925
EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources);

0 commit comments

Comments
 (0)