]> git.itanic.dy.fi Git - linux-stable/commitdiff
powerpc/fsl-pci: Choose PCI host bridge with alias pci0 as the primary
authorPali Rohár <pali@kernel.org>
Sat, 20 Aug 2022 12:33:27 +0000 (14:33 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 30 Nov 2022 10:46:48 +0000 (21:46 +1100)
If there's no PCI host bridge with ISA then check for PCI host bridge with
alias "pci0" (first PCI host bridge) and if it exists then choose it as the
primary PCI host bridge.

This makes choice of primary PCI host bridge more stable across boots and
updates as the last fallback candidate for primary PCI host bridge (if
there is no choice) is selected arbitrary.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220820123327.20551-1-pali@kernel.org
arch/powerpc/sysdev/fsl_pci.c

index 974d3db6faab237dc7d56ce5a89eb0420e8e8c31..b7232c46b24481a8f6b35ef266fb2e074a21abdb 100644 (file)
@@ -1138,6 +1138,19 @@ void __init fsl_pci_assign_primary(void)
                        return;
        }
 
+       /*
+        * If there's no PCI host bridge with ISA then check for
+        * PCI host bridge with alias "pci0" (first PCI host bridge).
+        */
+       np = of_find_node_by_path("pci0");
+       if (np && of_match_node(pci_ids, np) && of_device_is_available(np)) {
+               fsl_pci_primary = np;
+               of_node_put(np);
+               return;
+       }
+       if (np)
+               of_node_put(np);
+
        /*
         * If there's no PCI host bridge with ISA, arbitrarily
         * designate one as primary.  This can go away once