From: "Ali Ahmet Memiş" <aliamemis@disroot.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>
Cc: "Hans de Goede" <johannes.goede@oss.qualcomm.com>,
"Rong Zhang" <i@rong.moe>, "Len Brown" <lenb@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@kernel.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Ike Panhc" <ikepanhc@gmail.com>,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Armin Wolf" <W_Armin@gmx.de>,
"Charis Stratakis" <c.stratakis@proton.me>,
"Avraham Hollander" <anhollander516@gmail.com>,
"Jeffrey Wälti" <jeffrey@waelti.dev>, Rick <rickk1166@gmail.com>,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
acpica-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/4] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively
Date: Sat, 17 Oct 2026 16:08:46 +0300 [thread overview]
Message-ID: <20261017130847.319661-1-aliamemis@disroot.org> (raw)
In-Reply-To: <20261017130652.318778-1-aliamemis@disroot.org>
On some Lenovo IdeaPad and Yoga models, the battery _BIX takes the EC
AML mutex and then calls the serialized RDER through RDIF, while GBMD
calls RDER first and then takes the EC mutex. When the two run
interleaved they deadlock until the mutex acquisition in RDER times
out, and GBMD returns garbage that is reported as both charge types
being enabled.
Evaluate all methods with the exclusive helpers, so that GBMD never runs
interleaved with the battery methods.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221065
Link: https://lore.kernel.org/all/58586fa666f09c209f9d7fe8c692a8bdda6d4410.camel@rong.moe/
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
drivers/platform/x86/lenovo/ideapad-laptop.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c
index 8213524504ee..1335f4e48870 100644
--- a/drivers/platform/x86/lenovo/ideapad-laptop.c
+++ b/drivers/platform/x86/lenovo/ideapad-laptop.c
@@ -297,12 +297,16 @@ static void ideapad_shared_exit(struct ideapad_private *priv)
#define IDEAPAD_EC_POLL_MIN_US 150
#define IDEAPAD_EC_POLL_MAX_US 300
+/*
+ * On some models GBMD and the battery _BIX take the EC mutex and a
+ * serialized method in opposite order, so evaluate all methods exclusively.
+ */
static int eval_int(acpi_handle handle, const char *name, unsigned long *res)
{
unsigned long long result;
acpi_status status;
- status = acpi_evaluate_integer(handle, (char *)name, NULL, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, NULL, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -324,7 +328,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
in_obj.type = ACPI_TYPE_INTEGER;
in_obj.integer.value = arg;
- status = acpi_evaluate_integer(handle, (char *)name, ¶ms, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, ¶ms, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -336,7 +340,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
static int exec_simple_method(acpi_handle handle, const char *name, unsigned long arg)
{
- acpi_status status = acpi_execute_simple_method(handle, (char *)name, arg);
+ acpi_status status = acpi_execute_simple_method_exclusive(handle, (char *)name, arg);
return ACPI_FAILURE(status) ? -EIO : 0;
}
@@ -394,7 +398,7 @@ static int eval_vpcw(acpi_handle handle, unsigned long cmd, unsigned long data)
in_obj[1].type = ACPI_TYPE_INTEGER;
in_obj[1].integer.value = data;
- status = acpi_evaluate_object(handle, "VPCW", ¶ms, NULL);
+ status = acpi_evaluate_object_exclusive(handle, "VPCW", ¶ms, NULL);
if (ACPI_FAILURE(status))
return -EIO;
--
2.55.0
next prev parent reply other threads:[~2026-10-17 13:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 13:06 [PATCH v2 0/4] ACPI: Serialize battery, INT3403 _TMP and ideapad methods Ali Ahmet Memiş
2026-10-17 13:06 ` [PATCH v2 1/4] ACPI: utils: Add exclusive AML evaluation helpers Ali Ahmet Memiş
2026-10-17 13:06 ` [PATCH v2 2/4] ACPI: battery: Evaluate battery methods exclusively Ali Ahmet Memiş
2026-10-17 13:06 ` [PATCH v2 3/4] thermal: intel: int340x: Evaluate _TMP exclusively Ali Ahmet Memiş
2026-10-17 13:08 ` Ali Ahmet Memiş [this message]
2026-10-17 18:06 ` [PATCH v2 0/4] ACPI: Serialize battery, INT3403 _TMP and ideapad methods Rong Zhang
2026-10-17 18:24 ` Rong Zhang
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=20261017130847.319661-1-aliamemis@disroot.org \
--to=aliamemis@disroot.org \
--cc=W_Armin@gmx.de \
--cc=acpica-devel@lists.linux.dev \
--cc=anhollander516@gmail.com \
--cc=c.stratakis@proton.me \
--cc=daniel.lezcano@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=i@rong.moe \
--cc=ikepanhc@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jeffrey@waelti.dev \
--cc=johannes.goede@oss.qualcomm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rickk1166@gmail.com \
--cc=rui.zhang@intel.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
all inboxes | Powered by JetHome®