From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>
Cc: Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
linux@weissschuh.net, Dell.Client.Kernel@dell.com,
corbet@lwn.net, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 1/9] platform/wmi: Introduce marshalling support
Date: Tue, 6 Jan 2026 17:56:36 +0200 (EET) [thread overview]
Message-ID: <bc985391-8b0e-aed8-5d0e-0e1ad07f593e@linux.intel.com> (raw)
In-Reply-To: <20251220204622.3541-2-W_Armin@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 3433 bytes --]
On Sat, 20 Dec 2025, Armin Wolf wrote:
> The Windows WMI-ACPI driver likely uses wmilib [1] to interact with
> the WMI service in userspace. Said library uses plain byte buffers
> for exchanging data, so the WMI-ACPI driver has to convert between
> those byte buffers and ACPI objects returned by the ACPI firmware.
>
> The format of the byte buffer is publicly documented [2], and after
> some reverse eingineering of the WMI-ACPI driver using a set of custom
> ACPI tables, the following conversion rules have been discovered:
>
> - ACPI integers are always converted into a uint32
> - ACPI strings are converted into special WMI strings
> - ACPI buffers are copied as-is
> - ACPI packages are unpacked
>
> Extend the ACPI-WMI driver to also perform this kind of marshalling
> for WMI data blocks, methods and events. During so gives us a number
> of benefits:
>
> - WMI drivers are not restricted to a fixed set of supported ACPI data
> types anymore, see dell-wmi-aio (integer vs buffer) and
> hp-wmi-sensors (string vs buffer)
>
> - correct marshalling of WMI strings when data blocks are marked
> as requiring ACPI strings instead of ACPI buffers
>
> - development of WMI drivers without having to understand ACPI
>
> This eventually should result in better compatibility with some
> ACPI firmware implementations and in simpler WMI drivers. There are
> however some differences between the original Windows driver and
> the ACPI-WMI driver when it comes to ACPI object conversions:
>
> - the Windows driver copies internal _ACPI_METHOD_ARGUMENT_V1 data
> structures into the output buffer when encountering nested ACPI
> packages. This is very likely an error inside the driver itself, so
> we do not support nested ACPI packages.
>
> - when converting WMI strings (UTF-16LE) into ACPI strings (ASCII),
> the Windows driver replaces non-ascii characters (ä -> a, & -> ?)
> instead of returning an error. This behavior is not documented
> anywhere and might lead to severe errors in some cases (like
> setting BIOS passwords over WMI), so we simply return an error.
>
> As the current bus-based WMI API is based on ACPI buffers, a new
> API is necessary. The legacy GUID-based WMI API is not extended to
> support marshalling, as WMI drivers using said API are expected to
> move to the bus-based WMI API in the future.
>
> [1] https://learn.microsoft.com/de-de/windows-hardware/drivers/ddi/wmilib/
> [2] https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/
> driver-defined-wmi-data-items
>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> diff --git a/drivers/platform/wmi/internal.h b/drivers/platform/wmi/internal.h
> new file mode 100644
> index 000000000000..707d1a4711e0
> --- /dev/null
> +++ b/drivers/platform/wmi/internal.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Internal interfaces used by the WMI core.
> + *
> + * Copyright (C) 2025 Armin Wolf <W_Armin@gmx.de>
> + */
> +
> +#ifndef _WMI_INTERNAL_H_
> +#define _WMI_INTERNAL_H_
> +
> +int wmi_unmarshal_acpi_object(const union acpi_object *obj, struct wmi_buffer *buffer);
> +int wmi_marshal_string(const struct wmi_buffer *buffer, struct acpi_buffer *out);
These currently depends on the includes in the C file including this as
you do not introduce these types beforehand.
--
i.
next prev parent reply other threads:[~2026-01-06 15:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-20 20:46 [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf
2025-12-20 20:46 ` [PATCH v2 1/9] " Armin Wolf
2026-01-06 15:35 ` Ilpo Järvinen
2026-01-06 15:56 ` Ilpo Järvinen [this message]
2025-12-20 20:46 ` [PATCH v2 2/9] platform/wmi: Add kunit test for the marshalling code Armin Wolf
2026-01-06 15:39 ` Ilpo Järvinen
2025-12-20 20:46 ` [PATCH v2 3/9] platform/wmi: Add helper functions for WMI string conversions Armin Wolf
2025-12-20 20:46 ` [PATCH v2 4/9] platform/wmi: Add kunit test for the string conversion code Armin Wolf
2025-12-20 20:46 ` [PATCH v2 5/9] platform/x86: intel-wmi-sbl-fw-update: Use new buffer-based WMI API Armin Wolf
2025-12-20 20:46 ` [PATCH v2 6/9] platform/x86/intel/wmi: thunderbolt: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 7/9] platform/x86: xiaomi-wmi: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 8/9] platform/x86: wmi-bmof: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 9/9] platform/wmi: Update driver development guide Armin Wolf
2026-01-06 15:15 ` [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf
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=bc985391-8b0e-aed8-5d0e-0e1ad07f593e@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=hansg@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=platform-driver-x86@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox