Skip to content

Commit a03e828

Browse files
committed
thunderbolt: Serialize PCIe tunnel creation with PCI rescan
We need to make sure a new PCIe tunnel is not created in a middle of previous PCI rescan because otherwise the rescan code might find too much and fail to reconfigure devices properly. This is important when native PCIe hotplug is used. In BIOS assisted hotplug there should be no such issue. Fixes: f67cf49 ("thunderbolt: Add support for Internal Connection Manager (ICM)") Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: [email protected]
1 parent f2a659f commit a03e828

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/thunderbolt/switch.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,13 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
716716
if (sw->authorized)
717717
goto unlock;
718718

719+
/*
720+
* Make sure there is no PCIe rescan ongoing when a new PCIe
721+
* tunnel is created. Otherwise the PCIe rescan code might find
722+
* the new tunnel too early.
723+
*/
724+
pci_lock_rescan_remove();
725+
719726
switch (val) {
720727
/* Approve switch */
721728
case 1:
@@ -735,6 +742,8 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
735742
break;
736743
}
737744

745+
pci_unlock_rescan_remove();
746+
738747
if (!ret) {
739748
sw->authorized = val;
740749
/* Notify status change to the userspace */

0 commit comments

Comments
 (0)