]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0006-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch
fix #4039: backport aquantia atlantic NIC fixes
[pve-kernel.git] / patches / kernel / 0006-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 Date: Mon, 27 Sep 2021 11:28:39 +0200
4 Subject: [PATCH] Revert "PCI: Coalesce host bridge contiguous apertures"
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This reverts commit ab20e43b20b60f5cc8e2ea3763ffa388158469ac.
10
11 was reverted upstream because of reports similar to
12
13 Link: https://bugzilla.proxmox.com/show_bug.cgi?id=3552
14 Link: https://lore.kernel.org/r/20210709231529.GA3270116@roeck-us.net
15 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
16 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 ---
18 drivers/pci/probe.c | 50 ++++-----------------------------------------
19 1 file changed, 4 insertions(+), 46 deletions(-)
20
21 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
22 index cb70d2605e97..258350f80f6c 100644
23 --- a/drivers/pci/probe.c
24 +++ b/drivers/pci/probe.c
25 @@ -20,7 +20,6 @@
26 #include <linux/irqdomain.h>
27 #include <linux/pm_runtime.h>
28 #include <linux/bitfield.h>
29 -#include <linux/list_sort.h>
30 #include "pci.h"
31
32 #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
33 @@ -881,31 +880,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
34 dev_set_msi_domain(&bus->dev, d);
35 }
36
37 -static int res_cmp(void *priv, const struct list_head *a,
38 - const struct list_head *b)
39 -{
40 - struct resource_entry *entry1, *entry2;
41 -
42 - entry1 = container_of(a, struct resource_entry, node);
43 - entry2 = container_of(b, struct resource_entry, node);
44 -
45 - if (entry1->res->flags != entry2->res->flags)
46 - return entry1->res->flags > entry2->res->flags;
47 -
48 - if (entry1->offset != entry2->offset)
49 - return entry1->offset > entry2->offset;
50 -
51 - return entry1->res->start > entry2->res->start;
52 -}
53 -
54 static int pci_register_host_bridge(struct pci_host_bridge *bridge)
55 {
56 struct device *parent = bridge->dev.parent;
57 - struct resource_entry *window, *next, *n;
58 + struct resource_entry *window, *n;
59 struct pci_bus *bus, *b;
60 - resource_size_t offset, next_offset;
61 + resource_size_t offset;
62 LIST_HEAD(resources);
63 - struct resource *res, *next_res;
64 + struct resource *res;
65 char addr[64], *fmt;
66 const char *name;
67 int err;
68 @@ -988,35 +970,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
69 if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE)
70 dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n");
71
72 - /* Sort and coalesce contiguous windows */
73 - list_sort(NULL, &resources, res_cmp);
74 - resource_list_for_each_entry_safe(window, n, &resources) {
75 - if (list_is_last(&window->node, &resources))
76 - break;
77 -
78 - next = list_next_entry(window, node);
79 - offset = window->offset;
80 - res = window->res;
81 - next_offset = next->offset;
82 - next_res = next->res;
83 -
84 - if (res->flags != next_res->flags || offset != next_offset)
85 - continue;
86 -
87 - if (res->end + 1 == next_res->start) {
88 - next_res->start = res->start;
89 - res->flags = res->start = res->end = 0;
90 - }
91 - }
92 -
93 /* Add initial resources to the bus */
94 resource_list_for_each_entry_safe(window, n, &resources) {
95 + list_move_tail(&window->node, &bridge->windows);
96 offset = window->offset;
97 res = window->res;
98 - if (!res->end)
99 - continue;
100 -
101 - list_move_tail(&window->node, &bridge->windows);
102
103 if (res->flags & IORESOURCE_BUS)
104 pci_bus_insert_busn_res(bus, bus->number, res->end);