Skip to content

Commit 67d8d36

Browse files
committed
Merge tag 'pci-v5.14-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull pci fix from Bjorn Helgaas: "Revert host bridge window patch that fixed HP EliteDesk 805 G6, but broke ppc:sam460ex (Bjorn Helgaas)" * tag 'pci-v5.14-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: Revert "PCI: Coalesce host bridge contiguous apertures"
2 parents 88bbd8a + 62efe3e commit 67d8d36

1 file changed

Lines changed: 4 additions & 46 deletions

File tree

drivers/pci/probe.c

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/hypervisor.h>
2020
#include <linux/irqdomain.h>
2121
#include <linux/pm_runtime.h>
22-
#include <linux/list_sort.h>
2322
#include "pci.h"
2423

2524
#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
@@ -875,31 +874,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
875874
dev_set_msi_domain(&bus->dev, d);
876875
}
877876

878-
static int res_cmp(void *priv, const struct list_head *a,
879-
const struct list_head *b)
880-
{
881-
struct resource_entry *entry1, *entry2;
882-
883-
entry1 = container_of(a, struct resource_entry, node);
884-
entry2 = container_of(b, struct resource_entry, node);
885-
886-
if (entry1->res->flags != entry2->res->flags)
887-
return entry1->res->flags > entry2->res->flags;
888-
889-
if (entry1->offset != entry2->offset)
890-
return entry1->offset > entry2->offset;
891-
892-
return entry1->res->start > entry2->res->start;
893-
}
894-
895877
static int pci_register_host_bridge(struct pci_host_bridge *bridge)
896878
{
897879
struct device *parent = bridge->dev.parent;
898-
struct resource_entry *window, *next, *n;
880+
struct resource_entry *window, *n;
899881
struct pci_bus *bus, *b;
900-
resource_size_t offset, next_offset;
882+
resource_size_t offset;
901883
LIST_HEAD(resources);
902-
struct resource *res, *next_res;
884+
struct resource *res;
903885
char addr[64], *fmt;
904886
const char *name;
905887
int err;
@@ -979,35 +961,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
979961
if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE)
980962
dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n");
981963

982-
/* Sort and coalesce contiguous windows */
983-
list_sort(NULL, &resources, res_cmp);
984-
resource_list_for_each_entry_safe(window, n, &resources) {
985-
if (list_is_last(&window->node, &resources))
986-
break;
987-
988-
next = list_next_entry(window, node);
989-
offset = window->offset;
990-
res = window->res;
991-
next_offset = next->offset;
992-
next_res = next->res;
993-
994-
if (res->flags != next_res->flags || offset != next_offset)
995-
continue;
996-
997-
if (res->end + 1 == next_res->start) {
998-
next_res->start = res->start;
999-
res->flags = res->start = res->end = 0;
1000-
}
1001-
}
1002-
1003964
/* Add initial resources to the bus */
1004965
resource_list_for_each_entry_safe(window, n, &resources) {
966+
list_move_tail(&window->node, &bridge->windows);
1005967
offset = window->offset;
1006968
res = window->res;
1007-
if (!res->end)
1008-
continue;
1009-
1010-
list_move_tail(&window->node, &bridge->windows);
1011969

1012970
if (res->flags & IORESOURCE_BUS)
1013971
pci_bus_insert_busn_res(bus, bus->number, res->end);

0 commit comments

Comments
 (0)