arm64: PCI: Preserve firmware configuration when necessary On Sat, Jun 15, 2019 at 10:23:59AM +1000, Benjamin Herrenschmidt wrote: > When _DSM #5 returns 0 for a host bridge, we need to claim the existing > resources rather than reassign everything. Use imperative mood. I'd remove the reference to _DSM #5. This patch does not directly reference _DSM, and it's conceivable a kernel command line parameter or other mechanism could set host->preserve_config. > Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> > --- > arch/arm64/kernel/pci.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index 1419b1b4e9b9..a2c608a3fc41 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -168,6 +168,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) > struct acpi_pci_generic_root_info *ri; > struct pci_bus *bus, *child; > struct acpi_pci_root_ops *root_ops; > + struct pci_host_bridge *hb; > > ri = kzalloc(sizeof(*ri), GFP_KERNEL); > if (!ri) > @@ -193,6 +194,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) > if (!bus) > return NULL; > > + hb = pci_find_host_bridge(bus); > + > + /* If ACPI tells us to preserve the resource configuration, claim now */ > + if (hb->preserve_config) > + pci_bus_claim_resources(bus); > + > + /* > + * Assign whatever was left unassigned. If we didn't claim above, this will > + * reassign everything. Wrap the comment so it fits in 80 columns (unless local arch/arm64 style allows wider lines, but I don't see any other wide lines in the file). This series generally looks good to me. > + */ > pci_assign_unassigned_root_bus_resources(bus); > > list_for_each_entry(child, &bus->children, node) > -- > 2.17.1 >