Commit 32fdc623 authored by Guilherme G. Piccoli's avatar Guilherme G. Piccoli Committed by Khalid Elmously

UBUNTU: SAUCE: x86/quirks: Scan all busses for early PCI quirks

BugLink: https://bugs.launchpad.net/bugs/1797990

Recently was noticed in an HP GEN9 system that kdump couldn't succeed
due to an irq storm coming from an Intel NIC, narrowed down to be lack
of clearing the MSI/MSI-X enable bits during the kdump kernel boot.
For that, we need an early quirk to manually turn off MSI/MSI-X for
PCI devices - this was worked as an optional boot parameter in a
(~subsequent~) previous patch.

Problem is that in our test system, the Intel NICs were not present in
any secondary bus under the first PCIe root complex, so they couldn't
be reached by the recursion in check_dev_quirk(). Modern systems,
specially with multi-processors and multiple NUMA nodes expose multiple
root complexes, describing more than one PCI hierarchy domain. Currently
the simple recursion present in the early-quirks code from x86 starts a
descending recursion from bus 0000:00, and reach many other busses by
navigating this hierarchy walking through the bridges. This is not
enough in systems with more than one root complex/host bridge, since
the recursion won't "traverse" to other root complexes by starting
statically in 0000:00 (for more details, see [0]).

This patch hence implements the full bus/device/function scan in
early_quirks(), by checking all possible busses instead of using a
recursion based on the first root bus or limiting the search scope to
the first 32 busses (like it was done in the beginning [1]).

[0] https://bugs.launchpad.net/bugs/1797990

[1] From historical perspective, early PCI scan dates back
to BitKeeper, added by Andi Kleen's "[PATCH] APIC fixes for x86-64",
on October/2003. It initially restricted the search to the first
32 busses and slots.

Due to a potential bug found in Nvidia chipsets, the scan
was changed to run only in the first root bus: see
commit 8659c406 ("x86: only scan the root bus in early PCI quirks")

Finally, secondary busses reachable from the 1st bus were re-added back by:
commit 850c3210 ("x86/quirks: Reintroduce scanning of secondary buses")
Reported-by: default avatarDan Streetman <ddstreet@canonical.com>
Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@canonical.com>
[mfo: v2:
 - gate the bus-scan differences with the cmdline option.
 - update changelog: subsequent/previous patch.]
Signed-off-by: default avatarMauricio Faria de Oliveira <mfo@canonical.com>
Acked-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Acked-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent e3ce78c4
...@@ -785,6 +785,10 @@ static int __init check_dev_quirk(int num, int slot, int func) ...@@ -785,6 +785,10 @@ static int __init check_dev_quirk(int num, int slot, int func)
PCI_HEADER_TYPE); PCI_HEADER_TYPE);
if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) { if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
/* pci_early_clear_msi scans the buses differently. */
if (pci_early_clear_msi)
return -1;
sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS); sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS);
if (sec > num) if (sec > num)
early_pci_scan_bus(sec); early_pci_scan_bus(sec);
...@@ -811,8 +815,13 @@ static void __init early_pci_scan_bus(int bus) ...@@ -811,8 +815,13 @@ static void __init early_pci_scan_bus(int bus)
void __init early_quirks(void) void __init early_quirks(void)
{ {
int bus;
if (!early_pci_allowed()) if (!early_pci_allowed())
return; return;
early_pci_scan_bus(0); early_pci_scan_bus(0);
/* pci_early_clear_msi scans more buses. */
for (bus = 1; pci_early_clear_msi && bus < 256; bus++)
early_pci_scan_bus(bus);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment