From: Bjorn Helgaas <helgaas@kernel.org>
To: Zhou Shengqing <zhoushengqing@ttyinfo.com>
Cc: bhelgaas@google.com, lenb@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
rafael@kernel.org
Subject: Re: Re: [PATCHv4] PCI/ACPI: _DSM PRESERVE_BOOT_CONFIG function rev id doesn't match with spec
Date: Mon, 3 Mar 2025 16:46:30 -0600 [thread overview]
Message-ID: <20250303224630.GA204751@bhelgaas> (raw)
In-Reply-To: <20250301032822.17486-1-zhoushengqing@ttyinfo.com>
On Sat, Mar 01, 2025 at 03:28:22AM +0000, Zhou Shengqing wrote:
> On Thu, Feb 27, 2025 at 6:40 PM Bjorn Helgaas wrote:
> > On Mon, Dec 16, 2024 at 05:27:51AM +0000, Zhou Shengqing wrote:
> > > Per PCI Firmware Specification Revision 3.3 Table 4-7 _DSM Definitions
> > > for PCI. Preserve PCI Boot Configuration Initial Revision ID changed to 2.
> > > But the code remains unchanged, still 1.
> > >
> > > v4:Initialize *obj to NULL.
> > > v3:try revision id 1 first, then try revision id 2.
> > > v2:add Fixes tag.
> >
> > Thanks for working on this issue.
> >
> > - Thanks for the revision history. For future posts, put it below
> > the "---" line so it's in the email but not part of the commit log.
> >
> > - I think there's a leak in pci_acpi_preserve_config() because it
> > doesn't free "obj" before it returns true. If you agree, add a
> > preparatory patch to fix this.
> >
> > - Add a preparatory patch to return false early in
> > pci_acpi_preserve_config() if !ACPI_HANDLE(&host_bridge->dev) so
> > the body of the function is unindented, similar to what
> > acpi_pci_add_bus() does.
> >
> > - Add another preparatory patch that adds acpi_check_dsm() of the
> > desired function/rev ID for DSM_PCI_PRESERVE_BOOT_CONFIG,
> > DSM_PCI_POWER_ON_RESET_DELAY, DSM_PCI_DEVICE_READINESS_DURATIONS.
> > Move the "Evaluate PCI Boot Configuration" comment above the
> > acpi_check_dsm() since it applies to the whole function, not just
> > the rev 1 code in this patch.
> >
> > - Rework this patch so it only adds acpi_check_dsm() and
> > acpi_evaluate_dsm_typed() for rev 2.
>
> Could you please explain this in more detail? Do you mean we don't need to
> consider rev 1 anymore?
No, I think we still need to handle platforms that implemented PCI
Firmware spec r3.2 and used rev 1.
Platforms that implemented spec r3.3 probably use rev 2, and we don't
know whether they support rev 1.
So I think the ultimate function would look something like this:
bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge)
{
bool rc = false;
if (!ACPI_HANDLE(&host_bridge->dev))
return false;
if (acpi_check_dsm(..., 1, BIT(DSM_PCI_PRESERVE_BOOT_CONFIG))) {
obj = acpi_evaluate_dsm_typed(..., 1, DSM_PCI_PRESERVE_BOOT_CONFIG, ...);
if (obj && obj->integer.value == 0)
rc = true;
ACPI_FREE(obj);
} else if (acpi_check_dsm(..., 2, BIT(DSM_PCI_PRESERVE_BOOT_CONFIG))) {
obj = acpi_evaluate_dsm_typed(..., 2, DSM_PCI_PRESERVE_BOOT_CONFIG, ...);
if (obj && obj->integer.value == 0)
rc = true;
ACPI_FREE(obj);
}
return rc;
}
prev parent reply other threads:[~2025-03-03 22:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 5:27 [PATCHv4] PCI/ACPI: _DSM PRESERVE_BOOT_CONFIG function rev id doesn't match with spec Zhou Shengqing
2025-02-27 18:40 ` Bjorn Helgaas
2025-03-01 3:28 ` Zhou Shengqing
2025-03-03 22:46 ` Bjorn Helgaas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250303224630.GA204751@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=zhoushengqing@ttyinfo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox