Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/fsl-pci: Choose PCI host bridge with alias pci0 as the primary

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

authored by

Pali Rohár and committed by
Michael Ellerman
e082e99f 67bbb62f

+13
+13
arch/powerpc/sysdev/fsl_pci.c
··· 1139 1139 } 1140 1140 1141 1141 /* 1142 + * If there's no PCI host bridge with ISA then check for 1143 + * PCI host bridge with alias "pci0" (first PCI host bridge). 1144 + */ 1145 + np = of_find_node_by_path("pci0"); 1146 + if (np && of_match_node(pci_ids, np) && of_device_is_available(np)) { 1147 + fsl_pci_primary = np; 1148 + of_node_put(np); 1149 + return; 1150 + } 1151 + if (np) 1152 + of_node_put(np); 1153 + 1154 + /* 1142 1155 * If there's no PCI host bridge with ISA, arbitrarily 1143 1156 * designate one as primary. This can go away once 1144 1157 * various bugs with primary-less systems are fixed.