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