From: Ayush Singh <ayush@beagleboard.org>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: Ayush Singh <ayush@beagleboard.org>, Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI: power: Add serialize_power_on_quirk
Date: Thu, 26 Nov 2026 20:26:19 +0530 [thread overview]
Message-ID: <8733sniquk.fsf@beagleboard.org> (raw)
In-Reply-To: <CAJZ5v0hVX0vQ3oy_jiSAqERc4tmTZECFbsGfRi3=3Gz1Q2+H1w@mail.gmail.com>
"Rafael J. Wysocki (Intel)" <rafael@kernel.org> writes:
> On Tue, Nov 24, 2026 at 1:16 PM Ayush Singh <ayush@beagleboard.org> wrote:
>>
>> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan), the NVMe drive in
>> the second M.2 slot is frequently lost after resuming from s2idle:
>>
>> pcieport 0000:00:02.1: broken device, retraining non-functional downstream link at 2.5GT/s
>> pcieport 0000:00:02.1: retraining failed
>> pcieport 0000:00:02.1: Data Link Layer Link Active not set in 100 msec
>> nvme nvme1: Disabling device after reset failure: -19
>>
>> The _ON methods of the two M.2 slots' power resources update a clock
>> control register shared by both slots without any locking, and sleep in
>> the middle of the update. Since the root ports are resumed
>> asynchronously, the two methods can run concurrently, and one of them
>> can undo the other's change, leaving that slot's reference clock
>> disabled. Its link then never trains.
>>
>> Evaluate power resource _ON methods one at a time on this machine.
>> With this, 20/20 s2idle cycles succeeded, versus failure within 1-2
>> cycles before. Also tested in normal laptop usage for a few days.
>>
>> The same symptom has been reported on the closely related IdeaPad Pro 5
>> 14AKP10 (83JL) [0], which may need this quirk as well, but it is not
>> included here as it could not be tested.
>>
>> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
>>
>> Assisted-by: claude-opus-5-5
>> Signed-off-by: Ayush Singh <ayush@beagleboard.org>
>> ---
>> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan, BIOS QFCN29WW),
>> the NVMe drive behind root port 00:02.1 (ACPI GPP3) is lost on nearly
>> every s2idle resume, while the drive in the other M.2 slot (GP10) always
>> comes back. Updating to the latest BIOS did not help, and neither did
>> disabling SSD power management via kernel parameters or recovering the
>> device from userspace.
>>
>> The "broken device, retraining non-functional downstream link at
>> 2.5GT/s" / "retraining failed" messages come from the Target Speed quirk
>> reacting to a link that cannot train at all. The actual cause is a race
>> between the two slots' power resource _ON methods in firmware, which
>> can leave one slot's reference clock disabled, as described in the
>> patch. I can share the relevant AML and debug logs if useful.
>>
>> Testing: 20/20 s2idle cycles with real S0i3 residency, versus failure
>> within 1-2 cycles without the patch. I have also done normal daily use
>> testing outside of synthetic suspend.
>>
>> The IdeaPad Pro 5 14AKP10 (83JL) appears to have the same problem on
>> the same root port [0]. I don't have one to test, so it is not in the
>> DMI table.
>>
>> I went with a DMI quirk that serializes power resource _ON methods
>> on this machine only. If serializing them unconditionally, or some
>> other approach, is preferred, I'm happy to rework it.
>>
>> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
>
> So there is acpi_evaluate_object_exclusive() now and you can use it
> for _ON evaluation.
>
> It will serialize the method with other things too, but that's not a big deal.
>
>> ---
>> drivers/acpi/power.c | 41 ++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 40 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
>> index 23a4e207a01e..b997d98f38c4 100644
>> --- a/drivers/acpi/power.c
>> +++ b/drivers/acpi/power.c
>> @@ -64,6 +64,10 @@ struct acpi_power_resource_entry {
>>
>> static bool hp_eb_gp12pxp_quirk;
>> static bool unused_power_resources_quirk;
>> +static bool serialize_power_on_quirk;
>> +
>> +/* Serializes _ON evaluation when serialize_power_on_quirk is set */
>> +static DEFINE_MUTEX(power_on_lock);
>>
>> static LIST_HEAD(acpi_power_resource_list);
>> static DEFINE_MUTEX(power_resource_list_lock);
>> @@ -362,13 +366,27 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev,
>> acpi_power_resource_remove_dependent(entry->resource, dev);
>> }
>>
>> +static acpi_status acpi_power_evaluate_on(acpi_handle handle)
>> +{
>> + acpi_status status;
>> +
>> + if (!serialize_power_on_quirk)
>> + return acpi_evaluate_object(handle, "_ON", NULL, NULL);
>> +
>> + mutex_lock(&power_on_lock);
>> + status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
>> + mutex_unlock(&power_on_lock);
>> +
>> + return status;
>> +}
>> +
>> static int __acpi_power_on(struct acpi_power_resource *resource)
>> {
>> acpi_handle handle = resource->device.handle;
>> struct acpi_power_dependent_device *dep;
>> acpi_status status = AE_OK;
>>
>> - status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
>> + status = acpi_power_evaluate_on(handle);
>
> So I'd replace acpi_evaluate_object() above with
> acpi_evaluate_object_exclusive().
Sure, that sounds good. Just to confirm though, I should do that only for
devices with the quirk though, right? i.e. behind a conditional. Or do you
mean that it should use acpi_evaluate_object_exclusive unconditionally?
>
>> if (ACPI_FAILURE(status)) {
>> resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
>> return -ENODEV;
>> @@ -1096,6 +1114,24 @@ static const struct dmi_system_id dmi_hp_elitebook_gp12pxp_quirk[] = {
>> {}
>> };
>>
>> +static const struct dmi_system_id dmi_serialize_power_on[] = {
>> + /*
>> + * On the Lenovo Yoga Pro 7 14AKP10, the _ON methods of the M.2 slot
>> + * power resources update a shared clock control register without
>> + * locking and sleep in the middle of the update. When the root ports
>> + * are resumed concurrently, one slot's reference clock can end up
>> + * disabled and its NVMe drive is lost after resume.
>> + */
>> + {
>> + /* Lenovo Yoga Pro 7 14AKP10 */
>> + .matches = {
>> + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
>> + DMI_MATCH(DMI_PRODUCT_NAME, "83KG"),
>> + },
>> + },
>> + {}
>> +};
>> +
>> static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
>> {
>> /*
>> @@ -1156,4 +1192,7 @@ void __init acpi_power_resources_init(void)
>> hp_eb_gp12pxp_quirk = dmi_check_system(dmi_hp_elitebook_gp12pxp_quirk);
>> unused_power_resources_quirk =
>> dmi_check_system(dmi_leave_unused_power_resources_on);
>> + serialize_power_on_quirk = dmi_check_system(dmi_serialize_power_on);
>> + if (serialize_power_on_quirk)
>> + pr_info("Serializing power resource _ON methods\n");
>> }
>>
>> ---
>> base-commit: 988117cc1bb17338c586a4e21ade88b5397eac33
>> change-id: 20261122-ssd-fix-6b7ab639796d
>>
>> Best regards,
>> --
>> Ayush Singh <ayush@beagleboard.org>
>>
>>
Best Regards,
Ayush Singh
--
BeagleBoard.org Foundation
https://www.beagleboard.org
next prev parent reply other threads:[~2026-11-26 14:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:15 [PATCH] ACPI: power: Add serialize_power_on_quirk Ayush Singh
2026-11-26 14:21 ` Rafael J. Wysocki (Intel)
2026-11-26 14:56 ` Ayush Singh [this message]
2026-11-26 15:01 ` Rafael J. Wysocki (Intel)
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=8733sniquk.fsf@beagleboard.org \
--to=ayush@beagleboard.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.