mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ali Ahmet Memiş" <aliamemis@disroot.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>
Cc: "Hans de Goede" <johannes.goede@oss.qualcomm.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Len Brown" <lenb@kernel.org>, "Ike Panhc" <ikepanhc@gmail.com>,
	"Derek J . Clark" <derekjohn.clark@gmail.com>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Rong Zhang" <i@rong.moe>, "Armin Wolf" <W_Armin@gmx.de>,
	"Avraham Hollander" <anhollander516@gmail.com>,
	"Jeffrey Wälti" <jeffrey@waelti.dev>, Rick <rickk1166@gmail.com>,
	linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	linux-usb@vger.kernel.org, acpica-devel@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively
Date: Wed, 14 Oct 2026 22:04:56 +0300	[thread overview]
Message-ID: <20261014190544.150093-5-aliamemis@disroot.org> (raw)
In-Reply-To: <20261014190544.150093-1-aliamemis@disroot.org>

On some Lenovo IdeaPad and Yoga models, GBMD, SBMC, SALS and DYTC hold a
shared AML mutex while waiting for the EC to finish a command, long
enough for the UCSI and _Qxx methods waiting on it to time out.

Evaluate all methods with the exclusive helpers.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=221065
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
 drivers/platform/x86/lenovo/ideapad-laptop.c | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c
index 8213524504ee..9fb842e6383d 100644
--- a/drivers/platform/x86/lenovo/ideapad-laptop.c
+++ b/drivers/platform/x86/lenovo/ideapad-laptop.c
@@ -297,12 +297,18 @@ static void ideapad_shared_exit(struct ideapad_private *priv)
 #define IDEAPAD_EC_POLL_MIN_US 150
 #define IDEAPAD_EC_POLL_MAX_US 300
 
+/*
+ * Some of these methods hold an AML mutex shared with the UCSI and EC
+ * query methods for long enough for those to time out, so evaluate all
+ * of them 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 +330,8 @@ 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, &params, &result);
+	status = acpi_evaluate_integer_exclusive(handle, (char *)name, &params,
+						 &result);
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
@@ -336,7 +343,13 @@ 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);
+	union acpi_object in_obj = { .type = ACPI_TYPE_INTEGER };
+	struct acpi_object_list params = { .count = 1, .pointer = &in_obj };
+	acpi_status status;
+
+	in_obj.integer.value = arg;
+	status = acpi_evaluate_object_exclusive(handle, (char *)name, &params,
+						NULL);
 
 	return ACPI_FAILURE(status) ? -EIO : 0;
 }
@@ -394,7 +407,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", &params, NULL);
+	status = acpi_evaluate_object_exclusive(handle, "VPCW", &params, NULL);
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
-- 
2.55.0


      parent reply	other threads:[~2026-10-14 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 19:04 [PATCH 0/4] ACPI: Serialize EC queries, UCSI and ideapad methods Ali Ahmet Memiş
2026-10-14 19:04 ` [PATCH 1/4] ACPI: utils: Add acpi_evaluate_dsm_exclusive() Ali Ahmet Memiş
2026-10-14 19:04 ` [PATCH 2/4] ACPI: EC: Evaluate _Qxx methods exclusively Ali Ahmet Memiş
2026-10-14 19:04 ` [PATCH 3/4] usb: typec: ucsi: acpi: Evaluate _DSM exclusively Ali Ahmet Memiş
2026-10-14 19:04 ` Ali Ahmet Memiş [this message]

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=20261014190544.150093-5-aliamemis@disroot.org \
    --to=aliamemis@disroot.org \
    --cc=W_Armin@gmx.de \
    --cc=acpica-devel@lists.linux.dev \
    --cc=anhollander516@gmail.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.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-usb@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rickk1166@gmail.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®