Re: [PATCH 1/2] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops

From: Daniel Gibson

Date: Thu May 07 2026 - 19:56:17 EST


On 08.05.26 01:48, Mario Limonciello wrote:
>
>>
>> Are you sure it behaves like this?
>> The check is basically "is the SMU table's s0i3_last_entry_status != 0".
>> And as far as I can tell this is the case after every successful suspend,
>> it only seems to be reset by rebooting or if a suspend fails.
>>
>> See smu_fw_info_show() (for /sys/kern/debug/amd_pmc/smu_fw_info):
>> seq_printf(s, "Last S0i3 Status: %s\n", table.s0i3_last_entry_status ?
>> "Success" :
>>            "Unknown/Fail");
>>
>> When I read /sys/kern/debug/amd_pmc/smu_fw_info right after booting,
>> it prints
>> "Last S0i3 Status: Unknown/Fail"
>> After resuming, even minutes (and presumably hours) later, it prints
>> "Last S0i3 Status: Success"
>> indicating that s0i3_last_entry_status still is != 0.
>>
>>>
>>> Now you might have been confused by not looking at commit
>>> 4dbd11796f3a8eb95647507befc41995458a4023.  This fixes the behavior as
>>> it's supposed to be.
>>>
> First suspend entry:
>
> amd_pmc_s2idle_prepare()
> ->amd_pmc_setup_smu_logging()
> ->->memset_io(dev->smu_virt_addr, 0, sizeof(struct smu_metrics))
>
> That is the table is cleared.
>
> amd_pmc_s2idle_check()
> ->get_metrics_table() && table.s0i3_last_entry_status
>
> The table is fetched and check (last entry will be 0).
> No delay.
>
> At this point system is in hardware sleep.
>
> If system resumes from hardware sleep table.s0i3_last_entry_status will
> be non-zero.
>
> If you re-enter:
>
> amd_pmc_s2idle_check() will do the msleep.
>
> If you exit:
>
> amd_pmc_s2idle_restore()
> -> amd_pmc_validate_deepest()
>
> This will read metrics table and tell you in logs if you didn't get to
> HW sleep.
>

Ah, now I get it - sorry for the confusion!
I somehow missed that amd_pmc_setup_smu_logging() is called at each
amd_pmc_s2idle_prepare() - my mistake.

There goes the simple solution :-/