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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'acpi-pci-4.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull PCI / ACPI fix from Rafael Wysocki:
"This fixes a bug uncovered by a recent driver core change that
modified the implementation of the ACPI_COMPANION_SET() macro to
strictly rely on its second argument to be either NULL or a valid
pointer to struct acpi_device.

As it turns out, pcibios_root_bridge_prepare() on x86 and ia64 works
with the assumption that the only code path calling pci_create_root_bus()
is pci_acpi_scan_root() and therefore the sysdata argument passed to
it will always match the expectations of pcibios_root_bridge_prepare().

That need not be the case, however, and in particular it is not the
case for the Xen pcifront driver that passes a pointer to its own
private data strcture as sysdata to pci_scan_bus_parented() which then
passes it to pci_create_root_bus() and it ends up being used incorrectly
by pcibios_root_bridge_prepare()"

* tag 'acpi-pci-4.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PCI / ACPI: Do not set ACPI companions for host bridges with parents

+20 -6
+10 -3
arch/ia64/pci/pci.c
··· 478 478 479 479 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) 480 480 { 481 - struct pci_controller *controller = bridge->bus->sysdata; 482 - 483 - ACPI_COMPANION_SET(&bridge->dev, controller->companion); 481 + /* 482 + * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL 483 + * here, pci_create_root_bus() has been called by someone else and 484 + * sysdata is likely to be different from what we expect. Let it go in 485 + * that case. 486 + */ 487 + if (!bridge->dev.parent) { 488 + struct pci_controller *controller = bridge->bus->sysdata; 489 + ACPI_COMPANION_SET(&bridge->dev, controller->companion); 490 + } 484 491 return 0; 485 492 } 486 493
+10 -3
arch/x86/pci/acpi.c
··· 482 482 483 483 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) 484 484 { 485 - struct pci_sysdata *sd = bridge->bus->sysdata; 486 - 487 - ACPI_COMPANION_SET(&bridge->dev, sd->companion); 485 + /* 486 + * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL 487 + * here, pci_create_root_bus() has been called by someone else and 488 + * sysdata is likely to be different from what we expect. Let it go in 489 + * that case. 490 + */ 491 + if (!bridge->dev.parent) { 492 + struct pci_sysdata *sd = bridge->bus->sysdata; 493 + ACPI_COMPANION_SET(&bridge->dev, sd->companion); 494 + } 488 495 return 0; 489 496 } 490 497