Linux USB
 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 1/4] ACPI: utils: Add acpi_evaluate_dsm_exclusive()
Date: Wed, 14 Oct 2026 22:04:53 +0300	[thread overview]
Message-ID: <20261014190544.150093-2-aliamemis@disroot.org> (raw)
In-Reply-To: <20261014190544.150093-1-aliamemis@disroot.org>

Add an exclusive variant of acpi_evaluate_dsm() for _DSM methods that
are known to break when interleaved with other AML.

Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
 drivers/acpi/utils.c    | 54 +++++++++++++++++++++++++++--------------
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  8 ++++++
 3 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index f28680424f14..32689c901564 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -799,23 +799,9 @@ acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function)
 }
 EXPORT_SYMBOL(acpi_evaluate_reg);
 
-/**
- * acpi_evaluate_dsm - evaluate device's _DSM method
- * @handle: ACPI device handle
- * @guid: GUID of requested functions, should be 16 bytes
- * @rev: revision number of requested function
- * @func: requested function number
- * @argv4: the function specific parameter
- *
- * Evaluate device's _DSM method with specified GUID, revision id and
- * function number. Caller needs to free the returned object.
- *
- * Though ACPI defines the fourth parameter for _DSM should be a package,
- * some old BIOSes do expect a buffer or an integer etc.
- */
-union acpi_object *
-acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
-		  union acpi_object *argv4)
+static union acpi_object *
+__acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
+		    union acpi_object *argv4, bool exclusive)
 {
 	acpi_status ret;
 	struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
@@ -840,7 +826,10 @@ acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
 		params[3].package.elements = NULL;
 	}
 
-	ret = acpi_evaluate_object(handle, "_DSM", &input, &buf);
+	if (exclusive)
+		ret = acpi_evaluate_object_exclusive(handle, "_DSM", &input, &buf);
+	else
+		ret = acpi_evaluate_object(handle, "_DSM", &input, &buf);
 	if (ACPI_SUCCESS(ret))
 		return (union acpi_object *)buf.pointer;
 
@@ -851,8 +840,37 @@ acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
 
 	return NULL;
 }
+
+/**
+ * acpi_evaluate_dsm - evaluate device's _DSM method
+ * @handle: ACPI device handle
+ * @guid: GUID of requested functions, should be 16 bytes
+ * @rev: revision number of requested function
+ * @func: requested function number
+ * @argv4: the function specific parameter
+ *
+ * Evaluate device's _DSM method with specified GUID, revision id and
+ * function number. Caller needs to free the returned object.
+ *
+ * Though ACPI defines the fourth parameter for _DSM should be a package,
+ * some old BIOSes do expect a buffer or an integer etc.
+ */
+union acpi_object *
+acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
+		  union acpi_object *argv4)
+{
+	return __acpi_evaluate_dsm(handle, guid, rev, func, argv4, false);
+}
 EXPORT_SYMBOL(acpi_evaluate_dsm);
 
+union acpi_object *
+acpi_evaluate_dsm_exclusive(acpi_handle handle, const guid_t *guid, u64 rev,
+			    u64 func, union acpi_object *argv4)
+{
+	return __acpi_evaluate_dsm(handle, guid, rev, func, argv4, true);
+}
+EXPORT_SYMBOL_GPL(acpi_evaluate_dsm_exclusive);
+
 /**
  * acpi_check_dsm - check if _DSM method supports requested functions.
  * @handle: ACPI device handle
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e7a671dba624..e9859fdf76e8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -66,6 +66,9 @@ bool acpi_dock_match(acpi_handle handle);
 bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
 union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
 			u64 rev, u64 func, union acpi_object *argv4);
+union acpi_object *acpi_evaluate_dsm_exclusive(acpi_handle handle,
+			const guid_t *guid, u64 rev, u64 func,
+			union acpi_object *argv4);
 #ifdef CONFIG_ACPI
 bool
 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddacac812094..6a798d5bde5c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1042,6 +1042,14 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
 	return NULL;
 }
 
+static inline union acpi_object *acpi_evaluate_dsm_exclusive(acpi_handle handle,
+							     const guid_t *guid,
+							     u64 rev, u64 func,
+							     union acpi_object *argv4)
+{
+	return NULL;
+}
+
 static inline union acpi_object *acpi_evaluate_dsm_typed(acpi_handle handle,
 							 const guid_t *guid,
 							 u64 rev, u64 func,
-- 
2.55.0


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

Thread overview: 10+ 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 ` Ali Ahmet Memiş [this message]
2026-10-14 19:11   ` [PATCH 1/4] ACPI: utils: Add acpi_evaluate_dsm_exclusive() sashiko-bot
2026-10-14 19:04 ` [PATCH 2/4] ACPI: EC: Evaluate _Qxx methods exclusively Ali Ahmet Memiş
2026-10-14 19:17   ` sashiko-bot
2026-10-14 19:04 ` [PATCH 3/4] usb: typec: ucsi: acpi: Evaluate _DSM exclusively Ali Ahmet Memiş
2026-10-14 19:14   ` sashiko-bot
2026-10-14 19:04 ` [PATCH 4/4] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively Ali Ahmet Memiş
2026-10-14 19:13   ` sashiko-bot
2026-10-15 11:52 ` [PATCH 0/4] ACPI: Serialize EC queries, UCSI and ideapad methods 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=20261014190544.150093-2-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