Skip to content

Commit

Permalink
PCI/ACPI: Don't reset a fwnode set by OF
Browse files Browse the repository at this point in the history
Commit 375553a ("PCI: Setup ACPI fwnode early and at the same time
with OF") added a call to pci_set_acpi_fwnode() in pci_setup_device(),
which unconditionally clears any fwnode previously set by
pci_set_of_node().

pci_set_acpi_fwnode() looks for ACPI_COMPANION(), which only returns the
existing fwnode if it was set by ACPI_COMPANION_SET(). If it was set by
OF instead, ACPI_COMPANION() returns NULL and pci_set_acpi_fwnode()
accidentally clears the fwnode. To fix this, look for any fwnode instead
of just ACPI companions.

Fixes a virtio-iommu boot regression in v5.15-rc1.

Fixes: 375553a ("PCI: Setup ACPI fwnode early and at the same time with OF")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jean-Philippe Brucker <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Acked-by: Rob Herring <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
jpbrucker authored and bjorn-helgaas committed Sep 15, 2021
1 parent 00e1a5d commit 6bd6597
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev);

void pci_set_acpi_fwnode(struct pci_dev *dev)
{
if (!ACPI_COMPANION(&dev->dev) && !pci_dev_is_added(dev))
if (!dev_fwnode(&dev->dev) && !pci_dev_is_added(dev))
ACPI_COMPANION_SET(&dev->dev,
acpi_pci_find_companion(&dev->dev));
}
Expand Down

0 comments on commit 6bd6597

Please sign in to comment.