linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF
@ 2021-09-14  9:51 Jean-Philippe Brucker
  2021-09-14 13:32 ` Rob Herring
  2021-09-14 15:01 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Philippe Brucker @ 2021-09-14  9:51 UTC (permalink / raw)
  To: rafael, lenb, bhelgaas
  Cc: linux-acpi, linux-pci, sdonthineni, robh, Jean-Philippe Brucker

Commit 375553a93201 ("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: 375553a93201 ("PCI: Setup ACPI fwnode early and at the same time with OF")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
v2: Use dev_fwnode()
v1: https://lore.kernel.org/linux-pci/20210913172358.1775381-1-jean-philippe@linaro.org/
This fixes boot of virtio-iommu under OF on v5.15-rc1
---
 drivers/pci/pci-acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index a1b1e2a01632..0f40943a9a18 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -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));
 }
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF
  2021-09-14  9:51 [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF Jean-Philippe Brucker
@ 2021-09-14 13:32 ` Rob Herring
  2021-09-14 15:01 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2021-09-14 13:32 UTC (permalink / raw)
  To: Jean-Philippe Brucker
  Cc: Rafael J. Wysocki, Len Brown, Bjorn Helgaas,
	open list:ACPI FOR ARM64 (ACPI/arm64),
	PCI, Shanker Donthineni

On Tue, Sep 14, 2021 at 4:55 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> Commit 375553a93201 ("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: 375553a93201 ("PCI: Setup ACPI fwnode early and at the same time with OF")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
> v2: Use dev_fwnode()
> v1: https://lore.kernel.org/linux-pci/20210913172358.1775381-1-jean-philippe@linaro.org/
> This fixes boot of virtio-iommu under OF on v5.15-rc1
> ---
>  drivers/pci/pci-acpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF
  2021-09-14  9:51 [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF Jean-Philippe Brucker
  2021-09-14 13:32 ` Rob Herring
@ 2021-09-14 15:01 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-09-14 15:01 UTC (permalink / raw)
  To: Jean-Philippe Brucker
  Cc: Rafael J. Wysocki, Len Brown, Bjorn Helgaas,
	ACPI Devel Maling List, Linux PCI, Shanker Donthineni,
	Rob Herring

On Tue, Sep 14, 2021 at 11:55 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> Commit 375553a93201 ("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: 375553a93201 ("PCI: Setup ACPI fwnode early and at the same time with OF")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
> v2: Use dev_fwnode()
> v1: https://lore.kernel.org/linux-pci/20210913172358.1775381-1-jean-philippe@linaro.org/
> This fixes boot of virtio-iommu under OF on v5.15-rc1
> ---
>  drivers/pci/pci-acpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index a1b1e2a01632..0f40943a9a18 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -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));
>  }
> --
> 2.33.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-14 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  9:51 [PATCH v2] PCI/ACPI: Don't reset a fwnode set by OF Jean-Philippe Brucker
2021-09-14 13:32 ` Rob Herring
2021-09-14 15:01 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).