lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gwLU2rsUWga+aEyWtXb=CHx2wqbrXX1hc+M_Po64a11A@mail.gmail.com>
Date:   Wed, 11 Jan 2023 11:56:05 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Bjorn Helgaas <helgaas@...nel.org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        "Limonciello, Mario" <mario.limonciello@....com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Mehta Sanju <Sanju.Mehta@....com>,
        Lukas Wunner <lukas@...ner.de>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] PCI/ACPI: PCI/ACPI: Validate devices with power
 resources support D3

On Tue, Jan 10, 2023 at 9:55 PM Bjorn Helgaas <helgaas@...nel.org> wrote:
>
> On Mon, Jan 02, 2023 at 05:59:36PM +0100, Rafael J. Wysocki wrote:
> > On Monday, January 2, 2023 5:34:19 PM CET Rafael J. Wysocki wrote:
> > ...
>
> > > I don't really think that Root Port support is required for a bridge below
> > > a Root Port if that bridge itself is power-manageable via ACPI.  Moreover,
> > > I don't think that the _S0W of a Root Port has any bearing on devices below
> > > it that have their own _S0W.
> > >
> > > So what we really want appears to be to evaluate _S0W for the target bridge,
> > > regardless of whether or not it is a Root Port, and return 'false' if that
> > > produces D2 or a shallower power state.  Otherwise, we can do what we've
> > > done so far.
>
> > +bool acpi_dev_no_wakeup_from_d3(struct acpi_device *adev)
> > +{
> > +     unsigned long long state;
> > +     acpi_status status;
> > +
> > +     status = acpi_evaluate_integer(adev->handle, "_S0W", NULL, &state);
> > +     return ACPI_SUCCESS(status) && state < ACPI_STATE_D3_HOT;
>
> This returns "false" (i.e., "yes, device can signal wakeup from D3")
> if _S0W doesn't exist.  Is that right?

Yes, it is.

The reason why I did it that way was because the bridge cannot signal
wakeup from D3 if both the following conditions take place:

1. There is _S0W and it can be evaluated successfully.
2. _S0W produces D2 or a shallower power state.

In particular, if 1 is not the case, it is still not clear whether or
not the bridge can signal wakeup from D3 and additional checks are
needed.

> I think this might be less confusing as:
>
>   bool acpi_dev_can_wake_from_d3(struct acpi_device *adev)
>   {
>     status = acpi_evaluate_integer(adev->handle, "_S0W", NULL, &state);
>     return ACPI_SUCCESS(status) && state >= ACPI_STATE_D3_HOT;
>   }

So I don't think the above will work, because
!acpi_dev_can_wake_from_d3(adev) is also true if _S0W is not present,
for example, in which case acpi_pci_bridge_d3() should not return
'false' right away.

However, the additional function can simply return the value produced
by _S0W or ACPI_STATE_UNKNOWN on all errors and its caller can do the
checks as needed which is done here:

https://patchwork.kernel.org/project/linux-acpi/patch/5659681.DvuYhMxLoT@kreacher/

(posted as a proper patch, because I wanted patchwork to pick it up).

I've also picked up the idea of using rpadev for representing the ACPI
companion of the Root Port in acpi_pci_bridge_d3().

Cheers!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ