Commit dcfe32c6 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by guzitao
Browse files

pci: let pcibios_root_bridge_prepare() access bridge->windows

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IBDJNZ

--------------------------------

This is backport of commit 661c4c4f("PCI: Let
pci_bios_root_bridge_prepare() access bridge->windows")

When pci_register_host_bridge() is called, bridge->windows are already
available. However these windows are being moved temporarily from there.

To let pcibios_root_bridge_prepare() have access to these windows, move the
windows movement after calling this function. This is useful for the MIPS
ralink mt7621 platform so it can set up I/O coherence units and avoid
custom MIPS code in the mt7621 PCIe controller driver.

Link: https://lore.kernel.org/r/20211207104924.21327-2-sergio.paracuellos@gmail.com


Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJing Li <jingli@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 25664756
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -891,8 +891,6 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)

	bridge->bus = bus;

	/* Temporarily move resources off the list */
	list_splice_init(&bridge->windows, &resources);
	bus->sysdata = bridge->sysdata;
	bus->msi = bridge->msi;
	bus->ops = bridge->ops;
@@ -917,6 +915,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
	if (err)
		goto free;

	/* Temporarily move resources off the list */
	list_splice_init(&bridge->windows, &resources);
	err = device_add(&bridge->dev);
	if (err) {
		put_device(&bridge->dev);