Re: [PATCH V3] PCI: Add support for preserving boot configuration

Bjorn Helgaas
2024-02-22T22:08:13Z

On Fri, Feb 23, 2024 at 02:48:24AM +0530, Vidya Sagar wrote:
> On 22-02-2024 22:36, Bjorn Helgaas wrote:
> > On Thu, Feb 22, 2024 at 06:11:10PM +0530, Vidya Sagar wrote:

> > > + if (&host_bridge->dev) {
> > Checking &host_bridge->dev doesn't seem like the right way to
> > determine whether this is an ACPI host bridge.

BTW, I think this condition is *always* true, since it's testing the
address of a member of a struct.

> Honestly, I couldn't find a clear way to differentiate between an
> ACPI based host bridge and a DT based host bridge. Hence, the
> current code tries to get the information using both ways and since
> a system can only be either ACPI or DT based, but one at a time,
> preserve_config will be set only once (assuming the system wants it
> to be set). Let me know if there is a better approach for this?

I'm not sure ACPI and DT will always be mutually exclusive; I think
we're headed toward some combinations, e.g.,
https://lore.kernel.org/linux-pci/1692120000-46900-1-git-send-email-lizhi.hou@amd.com/

But I think "if (ACPI_HANDLE(&host_bridge->dev))" would work.

Bjorn