2021-08-12 15:50:41 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2021-09-27 13:43:06 +03:00
|
|
|
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
|
|
Date: Mon, 27 Sep 2021 11:28:39 +0200
|
2021-08-12 15:50:41 +03:00
|
|
|
Subject: [PATCH] Revert "PCI: Coalesce host bridge contiguous apertures"
|
2021-10-19 14:40:56 +03:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
2021-08-12 15:50:41 +03:00
|
|
|
|
2021-09-27 13:43:06 +03:00
|
|
|
This reverts commit ab20e43b20b60f5cc8e2ea3763ffa388158469ac.
|
2021-08-12 15:50:41 +03:00
|
|
|
|
|
|
|
was reverted upstream because of reports similar to
|
|
|
|
|
|
|
|
Link: https://bugzilla.proxmox.com/show_bug.cgi?id=3552
|
|
|
|
Link: https://lore.kernel.org/r/20210709231529.GA3270116@roeck-us.net
|
|
|
|
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
2021-09-27 13:43:06 +03:00
|
|
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
2021-08-12 15:50:41 +03:00
|
|
|
---
|
2021-10-19 14:40:56 +03:00
|
|
|
drivers/pci/probe.c | 50 ++++-----------------------------------------
|
|
|
|
1 file changed, 4 insertions(+), 46 deletions(-)
|
2021-08-12 15:50:41 +03:00
|
|
|
|
|
|
|
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
|
2021-09-27 13:43:06 +03:00
|
|
|
index f6046a16dac1..275204646c68 100644
|
2021-08-12 15:50:41 +03:00
|
|
|
--- a/drivers/pci/probe.c
|
|
|
|
+++ b/drivers/pci/probe.c
|
|
|
|
@@ -19,7 +19,6 @@
|
|
|
|
#include <linux/hypervisor.h>
|
|
|
|
#include <linux/irqdomain.h>
|
|
|
|
#include <linux/pm_runtime.h>
|
|
|
|
-#include <linux/list_sort.h>
|
|
|
|
#include "pci.h"
|
|
|
|
|
|
|
|
#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
|
2021-09-27 13:43:06 +03:00
|
|
|
@@ -875,31 +874,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
|
2021-08-12 15:50:41 +03:00
|
|
|
dev_set_msi_domain(&bus->dev, d);
|
|
|
|
}
|
|
|
|
|
2021-09-27 13:43:06 +03:00
|
|
|
-static int res_cmp(void *priv, const struct list_head *a,
|
|
|
|
- const struct list_head *b)
|
2021-08-12 15:50:41 +03:00
|
|
|
-{
|
|
|
|
- struct resource_entry *entry1, *entry2;
|
|
|
|
-
|
|
|
|
- entry1 = container_of(a, struct resource_entry, node);
|
|
|
|
- entry2 = container_of(b, struct resource_entry, node);
|
|
|
|
-
|
|
|
|
- if (entry1->res->flags != entry2->res->flags)
|
|
|
|
- return entry1->res->flags > entry2->res->flags;
|
|
|
|
-
|
|
|
|
- if (entry1->offset != entry2->offset)
|
|
|
|
- return entry1->offset > entry2->offset;
|
|
|
|
-
|
|
|
|
- return entry1->res->start > entry2->res->start;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int pci_register_host_bridge(struct pci_host_bridge *bridge)
|
|
|
|
{
|
|
|
|
struct device *parent = bridge->dev.parent;
|
|
|
|
- struct resource_entry *window, *next, *n;
|
|
|
|
+ struct resource_entry *window, *n;
|
|
|
|
struct pci_bus *bus, *b;
|
|
|
|
- resource_size_t offset, next_offset;
|
|
|
|
+ resource_size_t offset;
|
|
|
|
LIST_HEAD(resources);
|
|
|
|
- struct resource *res, *next_res;
|
|
|
|
+ struct resource *res;
|
|
|
|
char addr[64], *fmt;
|
|
|
|
const char *name;
|
|
|
|
int err;
|
2021-09-27 13:43:06 +03:00
|
|
|
@@ -979,35 +961,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
|
2021-08-12 15:50:41 +03:00
|
|
|
if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE)
|
|
|
|
dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n");
|
|
|
|
|
|
|
|
- /* Sort and coalesce contiguous windows */
|
|
|
|
- list_sort(NULL, &resources, res_cmp);
|
|
|
|
- resource_list_for_each_entry_safe(window, n, &resources) {
|
|
|
|
- if (list_is_last(&window->node, &resources))
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- next = list_next_entry(window, node);
|
|
|
|
- offset = window->offset;
|
|
|
|
- res = window->res;
|
|
|
|
- next_offset = next->offset;
|
|
|
|
- next_res = next->res;
|
|
|
|
-
|
|
|
|
- if (res->flags != next_res->flags || offset != next_offset)
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
- if (res->end + 1 == next_res->start) {
|
|
|
|
- next_res->start = res->start;
|
|
|
|
- res->flags = res->start = res->end = 0;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/* Add initial resources to the bus */
|
|
|
|
resource_list_for_each_entry_safe(window, n, &resources) {
|
2021-10-19 14:40:56 +03:00
|
|
|
+ list_move_tail(&window->node, &bridge->windows);
|
|
|
|
offset = window->offset;
|
|
|
|
res = window->res;
|
2021-08-12 15:50:41 +03:00
|
|
|
- if (!res->end)
|
|
|
|
- continue;
|
|
|
|
-
|
2021-10-19 14:40:56 +03:00
|
|
|
- list_move_tail(&window->node, &bridge->windows);
|
2021-08-12 15:50:41 +03:00
|
|
|
|
|
|
|
if (res->flags & IORESOURCE_BUS)
|
|
|
|
pci_bus_insert_busn_res(bus, bus->number, res->end);
|