]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.16.4/thunderbolt-serialize-pcie-tunnel-creation-with-pci-rescan.patch
drop drm patch
[thirdparty/kernel/stable-queue.git] / releases / 4.16.4 / thunderbolt-serialize-pcie-tunnel-creation-with-pci-rescan.patch
CommitLineData
0f23eb5b
GKH
1From a03e828915c00ed0ea5aa40647c81472cfa7a984 Mon Sep 17 00:00:00 2001
2From: Mika Westerberg <mika.westerberg@linux.intel.com>
3Date: Thu, 18 Jan 2018 20:27:47 +0300
4Subject: thunderbolt: Serialize PCIe tunnel creation with PCI rescan
5
6From: Mika Westerberg <mika.westerberg@linux.intel.com>
7
8commit a03e828915c00ed0ea5aa40647c81472cfa7a984 upstream.
9
10We need to make sure a new PCIe tunnel is not created in a middle of
11previous PCI rescan because otherwise the rescan code might find too
12much and fail to reconfigure devices properly. This is important when
13native PCIe hotplug is used. In BIOS assisted hotplug there should be no
14such issue.
15
16Fixes: f67cf491175a ("thunderbolt: Add support for Internal Connection Manager (ICM)")
17Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
18Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
19Cc: Bjorn Helgaas <bhelgaas@google.com>
20Cc: stable@vger.kernel.org
21Signed-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 */