]>
Commit | Line | Data |
---|---|---|
0f23eb5b GKH |
1 | From a03e828915c00ed0ea5aa40647c81472cfa7a984 Mon Sep 17 00:00:00 2001 |
2 | From: Mika Westerberg <mika.westerberg@linux.intel.com> | |
3 | Date: Thu, 18 Jan 2018 20:27:47 +0300 | |
4 | Subject: thunderbolt: Serialize PCIe tunnel creation with PCI rescan | |
5 | ||
6 | From: Mika Westerberg <mika.westerberg@linux.intel.com> | |
7 | ||
8 | commit a03e828915c00ed0ea5aa40647c81472cfa7a984 upstream. | |
9 | ||
10 | We need to make sure a new PCIe tunnel is not created in a middle of | |
11 | previous PCI rescan because otherwise the rescan code might find too | |
12 | much and fail to reconfigure devices properly. This is important when | |
13 | native PCIe hotplug is used. In BIOS assisted hotplug there should be no | |
14 | such issue. | |
15 | ||
16 | Fixes: f67cf491175a ("thunderbolt: Add support for Internal Connection Manager (ICM)") | |
17 | Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> | |
18 | Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> | |
19 | Cc: Bjorn Helgaas <bhelgaas@google.com> | |
20 | Cc: stable@vger.kernel.org | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | ||
23 | --- | |
24 | drivers/thunderbolt/switch.c | 9 +++++++++ | |
25 | 1 file changed, 9 insertions(+) | |
26 | ||
27 | --- a/drivers/thunderbolt/switch.c | |
28 | +++ b/drivers/thunderbolt/switch.c | |
29 | @@ -716,6 +716,13 @@ static int tb_switch_set_authorized(stru | |
30 | if (sw->authorized) | |
31 | goto unlock; | |
32 | ||
33 | + /* | |
34 | + * Make sure there is no PCIe rescan ongoing when a new PCIe | |
35 | + * tunnel is created. Otherwise the PCIe rescan code might find | |
36 | + * the new tunnel too early. | |
37 | + */ | |
38 | + pci_lock_rescan_remove(); | |
39 | + | |
40 | switch (val) { | |
41 | /* Approve switch */ | |
42 | case 1: | |
43 | @@ -735,6 +742,8 @@ static int tb_switch_set_authorized(stru | |
44 | break; | |
45 | } | |
46 | ||
47 | + pci_unlock_rescan_remove(); | |
48 | + | |
49 | if (!ret) { | |
50 | sw->authorized = val; | |
51 | /* Notify status change to the userspace */ |