Re: [PATCH v4] PCI: Call _REG when transitioning D-states

Limonciello, Mario
2023-06-23T18:08:23Z

On 6/23/2023 12:35 PM, Bjorn Helgaas wrote:
> On Wed, Jun 21, 2023 at 05:52:52PM -0500, Limonciello, Mario wrote:
>> On 6/21/2023 5:28 PM, Bjorn Helgaas wrote:
>>> On Tue, Jun 20, 2023 at 09:04:51AM -0500, Mario Limonciello wrote:
>>>> Section 6.5.4 of the ACPI 6.4 spec describes how AML is unable to access
>>>> an OperationRegion unless `_REG` has been called.
>>>> ...
>>>> It is reported that ASMedia PCIe GPIO controllers fail
>>>> functional tests after the system has returning from suspend (S3
>>>> or s2idle). This is because the BIOS checks whether the OSPM has
>>>> called the `_REG` method to determine whether it can interact
>>>> with the OperationRegion assigned to the device as part of the
>>>> other AML called for the device.
>> I double checked a BIOS debug log which shows ACPI calls
>> to confirm and didn't see a single _REG call for any device
>> before this patch across a boot/suspend/resume cycle.
> Sorry to follow up on this again.
>
> The commit log says these GPIO controllers fail functional tests after
> returning from suspend. Do those functional tests pass *before*
> suspend? If so, why?
>
> Without this patch, we *never* call _REG, so the fact that calling
> _REG when we return the device to D0 while resuming fixes something
> suggests that it might have been broken even before the suspend.
>
> Bjorn
The reason it works is because the only time the AML attempts
to access the config space is part of suspend/resume.  If it
attempted to access config space as part of startup then I'd
expect the same failure at startup.